move published OPML endpoint to public.php

This commit is contained in:
Andrew Dolgov 2021-02-21 15:16:39 +03:00
parent 2843b99171
commit d1328321be
12 changed files with 110 additions and 111 deletions

View File

@ -737,6 +737,27 @@ class Handler_Public extends Handler {
<?php <?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() { function cached() {
list ($cache_dir, $filename) = explode("/", $_GET["file"], 2); list ($cache_dir, $filename) = explode("/", $_GET["file"], 2);

View File

@ -634,13 +634,10 @@ class OPML extends Handler_Protected {
print "$msg<br/>"; print "$msg<br/>";
} }
static function opml_publish_url(){ static function get_publish_url(){
return get_self_url_prefix() .
$url_path = get_self_url_prefix(); "/public.php?op=publishOpml&key=" .
$url_path .= "/opml.php?op=publish&key=" .
Feeds::_get_access_key('OPML:Publish', false, $_SESSION["uid"]); Feeds::_get_access_key('OPML:Publish', false, $_SESSION["uid"]);
return $url_path;
} }
function get_feed_category($feed_cat, $parent_cat_id = false) { function get_feed_category($feed_cat, $parent_cat_id = false) {

View File

@ -1329,14 +1329,14 @@ class Pref_Feeds extends Handler_Protected {
} }
function getOPMLKey() { function getOPMLKey() {
print json_encode(["link" => OPML::opml_publish_url()]); print json_encode(["link" => OPML::get_publish_url()]);
} }
function regenOPMLKey() { function regenOPMLKey() {
$this->update_feed_access_key('OPML:Publish', $this->update_feed_access_key('OPML:Publish',
false, $_SESSION["uid"]); false, $_SESSION["uid"]);
print json_encode(["link" => OPML::opml_publish_url()]); print json_encode(["link" => OPML::get_publish_url()]);
} }
function regenFeedKey() { function regenFeedKey() {

View File

@ -656,12 +656,10 @@ class RPC extends Handler_Protected {
<ul class='panel panel-scrollable hotkeys-help' style='height : 300px'> <ul class='panel panel-scrollable hotkeys-help' style='height : 300px'>
<?php <?php
$cur_section = "";
foreach ($info as $section => $hotkeys) { foreach ($info as $section => $hotkeys) {
?>
if ($cur_section) print "<li>&nbsp;</li>"; <li><h3><?= $section ?></h3></li>
print "<li><h3>" . $section . "</h3></li>"; <?php
$cur_section = $section;
foreach ($hotkeys as $action => $description) { foreach ($hotkeys as $action => $description) {
@ -705,9 +703,8 @@ class RPC extends Handler_Protected {
} }
} }
} }
print "</ul>"; ?>
</ul>
?>
<footer class='text-center'> <footer class='text-center'>
<?= \Controls\submit_tag(__('Close this window')) ?> <?= \Controls\submit_tag(__('Close this window')) ?>
</footer> </footer>

View File

@ -1,36 +0,0 @@
<?php
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
require_once "autoload.php";
require_once "functions.php";
require_once "sessions.php";
require_once "sanity_check.php";
require_once "config.php";
require_once "db-prefs.php";
if (!init_plugins()) return;
$op = $_REQUEST['op'];
if ($op == "publish"){
$key = $_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("", $owner_uid, true, false);
} else {
print "<error>User not found</error>";
}
}
?>

View File

@ -898,12 +898,14 @@ body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector {
body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector {
border-top-color: #1c5c7d; border-top-color: #1c5c7d;
} }
body.ttrss_main .dijitDialog h1:first-of-type, /*body.ttrss_main .dijitDialog {
body.ttrss_main .dijitDialog h2:first-of-type, h1:first-of-type,
body.ttrss_main .dijitDialog h3:first-of-type, h2:first-of-type,
body.ttrss_main .dijitDialog h4:first-of-type { h3:first-of-type,
margin-top: 0px; h4:first-of-type {
} margin-top: 0px;
}
}*/
body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel { body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel {
color: #257aa7; color: #257aa7;
} }
@ -1413,6 +1415,13 @@ body.ttrss_prefs {
background-color: #f5f5f5; background-color: #f5f5f5;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px; font-size: 14px;
/*.dijitContentPane {
h1:first-of-type,
h2:first-of-type,
h3:first-of-type {
margin-top: 0px;
}
}*/
} }
body.ttrss_prefs h1, body.ttrss_prefs h1,
body.ttrss_prefs h2, body.ttrss_prefs h2,
@ -1422,11 +1431,6 @@ body.ttrss_prefs h4 {
font-weight: 600; font-weight: 600;
color: #555; color: #555;
} }
body.ttrss_prefs .dijitContentPane h1:first-of-type,
body.ttrss_prefs .dijitContentPane h2:first-of-type,
body.ttrss_prefs .dijitContentPane h3:first-of-type {
margin-top: 0px;
}
body.ttrss_prefs #footer, body.ttrss_prefs #footer,
body.ttrss_prefs #header { body.ttrss_prefs #header {
padding: 8px; padding: 8px;

View File

@ -898,12 +898,14 @@ body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector {
body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector {
border-top-color: #d29745; border-top-color: #d29745;
} }
body.ttrss_main .dijitDialog h1:first-of-type, /*body.ttrss_main .dijitDialog {
body.ttrss_main .dijitDialog h2:first-of-type, h1:first-of-type,
body.ttrss_main .dijitDialog h3:first-of-type, h2:first-of-type,
body.ttrss_main .dijitDialog h4:first-of-type { h3:first-of-type,
margin-top: 0px; h4:first-of-type {
} margin-top: 0px;
}
}*/
body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel { body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel {
color: #b87d2c; color: #b87d2c;
} }
@ -1413,6 +1415,13 @@ body.ttrss_prefs {
background-color: #222; background-color: #222;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px; font-size: 14px;
/*.dijitContentPane {
h1:first-of-type,
h2:first-of-type,
h3:first-of-type {
margin-top: 0px;
}
}*/
} }
body.ttrss_prefs h1, body.ttrss_prefs h1,
body.ttrss_prefs h2, body.ttrss_prefs h2,
@ -1422,11 +1431,6 @@ body.ttrss_prefs h4 {
font-weight: 600; font-weight: 600;
color: #ccc; color: #ccc;
} }
body.ttrss_prefs .dijitContentPane h1:first-of-type,
body.ttrss_prefs .dijitContentPane h2:first-of-type,
body.ttrss_prefs .dijitContentPane h3:first-of-type {
margin-top: 0px;
}
body.ttrss_prefs #footer, body.ttrss_prefs #footer,
body.ttrss_prefs #header { body.ttrss_prefs #header {
padding: 8px; padding: 8px;

View File

@ -898,12 +898,14 @@ body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector {
body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector {
border-top-color: #1c5c7d; border-top-color: #1c5c7d;
} }
body.ttrss_main .dijitDialog h1:first-of-type, /*body.ttrss_main .dijitDialog {
body.ttrss_main .dijitDialog h2:first-of-type, h1:first-of-type,
body.ttrss_main .dijitDialog h3:first-of-type, h2:first-of-type,
body.ttrss_main .dijitDialog h4:first-of-type { h3:first-of-type,
margin-top: 0px; h4:first-of-type {
} margin-top: 0px;
}
}*/
body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel { body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel {
color: #257aa7; color: #257aa7;
} }
@ -1413,6 +1415,13 @@ body.ttrss_prefs {
background-color: #f5f5f5; background-color: #f5f5f5;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px; font-size: 14px;
/*.dijitContentPane {
h1:first-of-type,
h2:first-of-type,
h3:first-of-type {
margin-top: 0px;
}
}*/
} }
body.ttrss_prefs h1, body.ttrss_prefs h1,
body.ttrss_prefs h2, body.ttrss_prefs h2,
@ -1422,11 +1431,6 @@ body.ttrss_prefs h4 {
font-weight: 600; font-weight: 600;
color: #555; color: #555;
} }
body.ttrss_prefs .dijitContentPane h1:first-of-type,
body.ttrss_prefs .dijitContentPane h2:first-of-type,
body.ttrss_prefs .dijitContentPane h3:first-of-type {
margin-top: 0px;
}
body.ttrss_prefs #footer, body.ttrss_prefs #footer,
body.ttrss_prefs #header { body.ttrss_prefs #header {
padding: 8px; padding: 8px;

View File

@ -9,13 +9,13 @@ body.ttrss_prefs {
color : @default-text; color : @default-text;
} }
.dijitContentPane { /*.dijitContentPane {
h1:first-of-type, h1:first-of-type,
h2:first-of-type, h2:first-of-type,
h3:first-of-type { h3:first-of-type {
margin-top: 0px; margin-top: 0px;
} }
} }*/
#footer, #header { #footer, #header {
padding : 8px; padding : 8px;

View File

@ -1049,14 +1049,14 @@ body.ttrss_main {
} }
} }
body.ttrss_main .dijitDialog { /*body.ttrss_main .dijitDialog {
h1:first-of-type, h1:first-of-type,
h2:first-of-type, h2:first-of-type,
h3:first-of-type, h3:first-of-type,
h4:first-of-type { h4:first-of-type {
margin-top: 0px; margin-top: 0px;
} }
} }*/
body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree { body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree {
.dijitTreeRow.Has_Marked .dijitTreeLabel { .dijitTreeRow.Has_Marked .dijitTreeLabel {

View File

@ -899,12 +899,14 @@ body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector {
body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector {
border-top-color: #d29745; border-top-color: #d29745;
} }
body.ttrss_main .dijitDialog h1:first-of-type, /*body.ttrss_main .dijitDialog {
body.ttrss_main .dijitDialog h2:first-of-type, h1:first-of-type,
body.ttrss_main .dijitDialog h3:first-of-type, h2:first-of-type,
body.ttrss_main .dijitDialog h4:first-of-type { h3:first-of-type,
margin-top: 0px; h4:first-of-type {
} margin-top: 0px;
}
}*/
body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel { body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel {
color: #b87d2c; color: #b87d2c;
} }
@ -1414,6 +1416,13 @@ body.ttrss_prefs {
background-color: #222; background-color: #222;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px; font-size: 14px;
/*.dijitContentPane {
h1:first-of-type,
h2:first-of-type,
h3:first-of-type {
margin-top: 0px;
}
}*/
} }
body.ttrss_prefs h1, body.ttrss_prefs h1,
body.ttrss_prefs h2, body.ttrss_prefs h2,
@ -1423,11 +1432,6 @@ body.ttrss_prefs h4 {
font-weight: 600; font-weight: 600;
color: #ccc; color: #ccc;
} }
body.ttrss_prefs .dijitContentPane h1:first-of-type,
body.ttrss_prefs .dijitContentPane h2:first-of-type,
body.ttrss_prefs .dijitContentPane h3:first-of-type {
margin-top: 0px;
}
body.ttrss_prefs #footer, body.ttrss_prefs #footer,
body.ttrss_prefs #header { body.ttrss_prefs #header {
padding: 8px; padding: 8px;

View File

@ -899,12 +899,14 @@ body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector {
body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector {
border-top-color: #2e99d1; border-top-color: #2e99d1;
} }
body.ttrss_main .dijitDialog h1:first-of-type, /*body.ttrss_main .dijitDialog {
body.ttrss_main .dijitDialog h2:first-of-type, h1:first-of-type,
body.ttrss_main .dijitDialog h3:first-of-type, h2:first-of-type,
body.ttrss_main .dijitDialog h4:first-of-type { h3:first-of-type,
margin-top: 0px; h4:first-of-type {
} margin-top: 0px;
}
}*/
body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel { body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel {
color: #257aa7; color: #257aa7;
} }
@ -1414,6 +1416,13 @@ body.ttrss_prefs {
background-color: #222; background-color: #222;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px; font-size: 14px;
/*.dijitContentPane {
h1:first-of-type,
h2:first-of-type,
h3:first-of-type {
margin-top: 0px;
}
}*/
} }
body.ttrss_prefs h1, body.ttrss_prefs h1,
body.ttrss_prefs h2, body.ttrss_prefs h2,
@ -1423,11 +1432,6 @@ body.ttrss_prefs h4 {
font-weight: 600; font-weight: 600;
color: #ccc; color: #ccc;
} }
body.ttrss_prefs .dijitContentPane h1:first-of-type,
body.ttrss_prefs .dijitContentPane h2:first-of-type,
body.ttrss_prefs .dijitContentPane h3:first-of-type {
margin-top: 0px;
}
body.ttrss_prefs #footer, body.ttrss_prefs #footer,
body.ttrss_prefs #header { body.ttrss_prefs #header {
padding: 8px; padding: 8px;