From d1328321bebadcf8a530d3c05f52a8f3c58bb969 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 21 Feb 2021 15:16:39 +0300 Subject: [PATCH] move published OPML endpoint to public.php --- classes/handler/public.php | 21 +++++++++++++++++++++ classes/opml.php | 9 +++------ classes/pref/feeds.php | 4 ++-- classes/rpc.php | 13 +++++-------- opml.php | 36 ------------------------------------ themes/compact.css | 26 +++++++++++++++----------- themes/compact_night.css | 26 +++++++++++++++----------- themes/light.css | 26 +++++++++++++++----------- themes/light/prefs.less | 4 ++-- themes/light/tt-rss.less | 4 ++-- themes/night.css | 26 +++++++++++++++----------- themes/night_blue.css | 26 +++++++++++++++----------- 12 files changed, 110 insertions(+), 111 deletions(-) delete mode 100644 opml.php diff --git a/classes/handler/public.php b/classes/handler/public.php index 8076bb303..b0ce2306d 100755 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -737,6 +737,27 @@ class Handler_Public extends Handler { 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); diff --git a/classes/opml.php b/classes/opml.php index 78ddb2842..04d287125 100644 --- a/classes/opml.php +++ b/classes/opml.php @@ -634,13 +634,10 @@ class OPML extends Handler_Protected { print "$msg
"; } - 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) { diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index cf9e7c95e..8d3f84a03 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -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() { diff --git a/classes/rpc.php b/classes/rpc.php index 20a11b994..95fd0f5ae 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -656,12 +656,10 @@ class RPC extends Handler_Protected { "; - - ?> + ?> + diff --git a/opml.php b/opml.php deleted file mode 100644 index 6f13a6f3c..000000000 --- a/opml.php +++ /dev/null @@ -1,36 +0,0 @@ -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 "User not found"; - } - } - -?> diff --git a/themes/compact.css b/themes/compact.css index 9baf14227..64f60641c 100644 --- a/themes/compact.css +++ b/themes/compact.css @@ -898,12 +898,14 @@ body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector { body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { border-top-color: #1c5c7d; } -body.ttrss_main .dijitDialog h1:first-of-type, -body.ttrss_main .dijitDialog h2:first-of-type, -body.ttrss_main .dijitDialog h3:first-of-type, -body.ttrss_main .dijitDialog h4:first-of-type { - margin-top: 0px; -} +/*body.ttrss_main .dijitDialog { + h1:first-of-type, + h2:first-of-type, + h3:first-of-type, + h4:first-of-type { + margin-top: 0px; + } +}*/ body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel { color: #257aa7; } @@ -1413,6 +1415,13 @@ body.ttrss_prefs { background-color: #f5f5f5; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 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 h2, @@ -1422,11 +1431,6 @@ body.ttrss_prefs h4 { font-weight: 600; 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 #header { padding: 8px; diff --git a/themes/compact_night.css b/themes/compact_night.css index 4d57208d0..a5acb9c86 100644 --- a/themes/compact_night.css +++ b/themes/compact_night.css @@ -898,12 +898,14 @@ body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector { body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { border-top-color: #d29745; } -body.ttrss_main .dijitDialog h1:first-of-type, -body.ttrss_main .dijitDialog h2:first-of-type, -body.ttrss_main .dijitDialog h3:first-of-type, -body.ttrss_main .dijitDialog h4:first-of-type { - margin-top: 0px; -} +/*body.ttrss_main .dijitDialog { + h1:first-of-type, + h2:first-of-type, + h3:first-of-type, + h4:first-of-type { + margin-top: 0px; + } +}*/ body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel { color: #b87d2c; } @@ -1413,6 +1415,13 @@ body.ttrss_prefs { background-color: #222; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 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 h2, @@ -1422,11 +1431,6 @@ body.ttrss_prefs h4 { font-weight: 600; 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 #header { padding: 8px; diff --git a/themes/light.css b/themes/light.css index e47ee5adf..7030e5182 100644 --- a/themes/light.css +++ b/themes/light.css @@ -898,12 +898,14 @@ body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector { body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { border-top-color: #1c5c7d; } -body.ttrss_main .dijitDialog h1:first-of-type, -body.ttrss_main .dijitDialog h2:first-of-type, -body.ttrss_main .dijitDialog h3:first-of-type, -body.ttrss_main .dijitDialog h4:first-of-type { - margin-top: 0px; -} +/*body.ttrss_main .dijitDialog { + h1:first-of-type, + h2:first-of-type, + h3:first-of-type, + h4:first-of-type { + margin-top: 0px; + } +}*/ body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel { color: #257aa7; } @@ -1413,6 +1415,13 @@ body.ttrss_prefs { background-color: #f5f5f5; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 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 h2, @@ -1422,11 +1431,6 @@ body.ttrss_prefs h4 { font-weight: 600; 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 #header { padding: 8px; diff --git a/themes/light/prefs.less b/themes/light/prefs.less index ec3006ce5..510388391 100644 --- a/themes/light/prefs.less +++ b/themes/light/prefs.less @@ -9,13 +9,13 @@ body.ttrss_prefs { color : @default-text; } - .dijitContentPane { + /*.dijitContentPane { h1:first-of-type, h2:first-of-type, h3:first-of-type { margin-top: 0px; } - } + }*/ #footer, #header { padding : 8px; diff --git a/themes/light/tt-rss.less b/themes/light/tt-rss.less index 7b24c7701..35eec3e48 100644 --- a/themes/light/tt-rss.less +++ b/themes/light/tt-rss.less @@ -1049,14 +1049,14 @@ body.ttrss_main { } } -body.ttrss_main .dijitDialog { +/*body.ttrss_main .dijitDialog { h1:first-of-type, h2:first-of-type, h3:first-of-type, h4:first-of-type { margin-top: 0px; } -} +}*/ body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree { .dijitTreeRow.Has_Marked .dijitTreeLabel { diff --git a/themes/night.css b/themes/night.css index 8ca622d8d..73f1ec96d 100644 --- a/themes/night.css +++ b/themes/night.css @@ -899,12 +899,14 @@ body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector { body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { border-top-color: #d29745; } -body.ttrss_main .dijitDialog h1:first-of-type, -body.ttrss_main .dijitDialog h2:first-of-type, -body.ttrss_main .dijitDialog h3:first-of-type, -body.ttrss_main .dijitDialog h4:first-of-type { - margin-top: 0px; -} +/*body.ttrss_main .dijitDialog { + h1:first-of-type, + h2:first-of-type, + h3:first-of-type, + h4:first-of-type { + margin-top: 0px; + } +}*/ body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel { color: #b87d2c; } @@ -1414,6 +1416,13 @@ body.ttrss_prefs { background-color: #222; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 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 h2, @@ -1423,11 +1432,6 @@ body.ttrss_prefs h4 { font-weight: 600; 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 #header { padding: 8px; diff --git a/themes/night_blue.css b/themes/night_blue.css index 6d98bbb26..aa3ead557 100644 --- a/themes/night_blue.css +++ b/themes/night_blue.css @@ -899,12 +899,14 @@ body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector { body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { border-top-color: #2e99d1; } -body.ttrss_main .dijitDialog h1:first-of-type, -body.ttrss_main .dijitDialog h2:first-of-type, -body.ttrss_main .dijitDialog h3:first-of-type, -body.ttrss_main .dijitDialog h4:first-of-type { - margin-top: 0px; -} +/*body.ttrss_main .dijitDialog { + h1:first-of-type, + h2:first-of-type, + h3:first-of-type, + h4:first-of-type { + margin-top: 0px; + } +}*/ body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel { color: #257aa7; } @@ -1414,6 +1416,13 @@ body.ttrss_prefs { background-color: #222; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 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 h2, @@ -1423,11 +1432,6 @@ body.ttrss_prefs h4 { font-weight: 600; 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 #header { padding: 8px;