From fc0ebf089189ca42875d31b1bec4aa1c27852506 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 19 Feb 2021 20:21:36 +0300 Subject: move bookmarklet-related methods out of public.php into the plugin --- classes/handler/public.php | 321 +-------------------------------------------- 1 file changed, 4 insertions(+), 317 deletions(-) (limited to 'classes/handler') diff --git a/classes/handler/public.php b/classes/handler/public.php index de3165e2f..62543859c 100755 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -98,7 +98,7 @@ class Handler_Public extends Handler { $tpl->setVariable('ARTICLE_ID', htmlspecialchars($orig_guid ? $line['link'] : - $this->make_article_tag_uri($line['id'], $line['date_entered'])), true); + $this->_make_article_tag_uri($line['id'], $line['date_entered'])), true); $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true); $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true); $tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true); @@ -346,165 +346,6 @@ class Handler_Public extends Handler { PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK); } - function sharepopup() { - if (SINGLE_USER_MODE) { - UserHelper::login_sequence(); - } - - header('Content-Type: text/html; charset=utf-8'); - ?> - - - - <?= __("Share with Tiny Tiny RSS") ?> - - - - - - - - -
- - "; - print "window.close();"; - print ""; - - } else { - $title = htmlspecialchars(clean($_REQUEST["title"])); - $url = htmlspecialchars(clean($_REQUEST["url"])); - - ?> -
- - - - -
- - -
- -
- - -
- -
- - -
- -
- - -
-
- -
- -
- - - -
- -
- - - - -
- - - -
- - " /> -
- -
- - - "/> -
- -
- -
- - - -
- -
- "; - } - function login() { if (!SINGLE_USER_MODE) { @@ -565,160 +406,6 @@ class Handler_Public extends Handler { } } - function subscribe() { - if (SINGLE_USER_MODE) { - UserHelper::login_sequence(); - } - - if (!empty($_SESSION["uid"])) { - - $feed_url = clean($_REQUEST["feed_url"] ?? ""); - $csrf_token = clean($_POST["csrf_token"] ?? ""); - - header('Content-Type: text/html; charset=utf-8'); - ?> - - - - Tiny Tiny RSS - - - - - - - - -
-

-
- -
- - -
- - -
- - - - -
- %s.", $feed_url)); - break; - case 1: - print_notice(T_sprintf("Subscribed to %s.", $feed_url)); - break; - case 2: - print_error(T_sprintf("Could not subscribe to %s.", $feed_url)); - break; - case 3: - print_error(T_sprintf("No feeds found in %s.", $feed_url)); - break; - case 4: - $feed_urls = $rc["feeds"]; - break; - case 5: - print_error(T_sprintf("Could not subscribe to %s.
Can't download the Feed URL.", $feed_url)); - break; - } - - if ($feed_urls) { - - print "
"; - print ""; - print \Controls\hidden_tag("csrf_token", $_SESSION["csrf_token"]); - - print "
"; - print ""; - print ""; - print "
"; - - print ""; - print "".__("Return to Tiny Tiny RSS").""; - - print "
"; - } - - $tp_uri = get_self_url_prefix() . "/prefs.php"; - - if ($rc['code'] <= 2){ - $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE - feed_url = ? AND owner_uid = ?"); - $sth->execute([$feed_url, $_SESSION['uid']]); - $row = $sth->fetch(); - - $feed_id = $row["id"]; - } else { - $feed_id = 0; - } - - if ($feed_id) { - print "
- - - - - ".__("Return to Tiny Tiny RSS")." -
"; - } - } - - print "
"; - - } else { - $this->render_login_form(); - } - } - function index() { header("Content-Type: text/plain"); print error_json(13); @@ -928,7 +615,7 @@ class Handler_Public extends Handler { if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) { $_SESSION["login_error_msg"] = __("Your access level is insufficient to run this script."); - $this->render_login_form(); + $this->_render_login_form(); exit; } @@ -1066,7 +753,7 @@ class Handler_Public extends Handler { } } - private function make_article_tag_uri($id, $timestamp) { + private function _make_article_tag_uri($id, $timestamp) { $timestamp = date("Y-m-d", strtotime($timestamp)); @@ -1108,7 +795,7 @@ class Handler_Public extends Handler { } } - static function render_login_form() { + static function _render_login_form() { header('Cache-Control: public'); require_once "login_form.php"; -- cgit v1.2.3