move published OPML endpoint to public.php
This commit is contained in:
@@ -737,6 +737,27 @@ class Handler_Public extends Handler {
|
||||
<?php
|
||||
}
|
||||
|
||||
function publishOpml() {
|
||||
$key = clean($_REQUEST["key"]);
|
||||
$pdo = Db::pdo();
|
||||
|
||||
$sth = $pdo->prepare( "SELECT owner_uid
|
||||
FROM ttrss_access_keys WHERE
|
||||
access_key = ? AND feed_id = 'OPML:Publish'");
|
||||
$sth->execute([$key]);
|
||||
|
||||
if ($row = $sth->fetch()) {
|
||||
$owner_uid = $row['owner_uid'];
|
||||
|
||||
$opml = new OPML($_REQUEST);
|
||||
$opml->opml_export("published.opml", $owner_uid, true, false);
|
||||
|
||||
} else {
|
||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
|
||||
echo "File not found.";
|
||||
}
|
||||
}
|
||||
|
||||
function cached() {
|
||||
list ($cache_dir, $filename) = explode("/", $_GET["file"], 2);
|
||||
|
||||
|
||||
@@ -634,13 +634,10 @@ class OPML extends Handler_Protected {
|
||||
print "$msg<br/>";
|
||||
}
|
||||
|
||||
static function opml_publish_url(){
|
||||
|
||||
$url_path = get_self_url_prefix();
|
||||
$url_path .= "/opml.php?op=publish&key=" .
|
||||
static function get_publish_url(){
|
||||
return get_self_url_prefix() .
|
||||
"/public.php?op=publishOpml&key=" .
|
||||
Feeds::_get_access_key('OPML:Publish', false, $_SESSION["uid"]);
|
||||
|
||||
return $url_path;
|
||||
}
|
||||
|
||||
function get_feed_category($feed_cat, $parent_cat_id = false) {
|
||||
|
||||
@@ -1329,14 +1329,14 @@ class Pref_Feeds extends Handler_Protected {
|
||||
}
|
||||
|
||||
function getOPMLKey() {
|
||||
print json_encode(["link" => OPML::opml_publish_url()]);
|
||||
print json_encode(["link" => OPML::get_publish_url()]);
|
||||
}
|
||||
|
||||
function regenOPMLKey() {
|
||||
$this->update_feed_access_key('OPML:Publish',
|
||||
false, $_SESSION["uid"]);
|
||||
|
||||
print json_encode(["link" => OPML::opml_publish_url()]);
|
||||
print json_encode(["link" => OPML::get_publish_url()]);
|
||||
}
|
||||
|
||||
function regenFeedKey() {
|
||||
|
||||
@@ -656,12 +656,10 @@ class RPC extends Handler_Protected {
|
||||
<ul class='panel panel-scrollable hotkeys-help' style='height : 300px'>
|
||||
<?php
|
||||
|
||||
$cur_section = "";
|
||||
foreach ($info as $section => $hotkeys) {
|
||||
|
||||
if ($cur_section) print "<li> </li>";
|
||||
print "<li><h3>" . $section . "</h3></li>";
|
||||
$cur_section = $section;
|
||||
?>
|
||||
<li><h3><?= $section ?></h3></li>
|
||||
<?php
|
||||
|
||||
foreach ($hotkeys as $action => $description) {
|
||||
|
||||
@@ -705,9 +703,8 @@ class RPC extends Handler_Protected {
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</ul>";
|
||||
|
||||
?>
|
||||
?>
|
||||
</ul>
|
||||
<footer class='text-center'>
|
||||
<?= \Controls\submit_tag(__('Close this window')) ?>
|
||||
</footer>
|
||||
|
||||
Reference in New Issue
Block a user