diff --git a/plugins/af_fsckportal/init.php b/plugins/af_fsckportal/init.php deleted file mode 100644 index 4e81fde05..000000000 --- a/plugins/af_fsckportal/init.php +++ /dev/null @@ -1,44 +0,0 @@ -host = $host; - - $host->add_hook($host::HOOK_ARTICLE_FILTER, $this); - } - - function hook_article_filter($article) { - - $doc = new DOMDocument(); - - if (@$doc->loadHTML('' . $article["content"])) { - $xpath = new DOMXPath($doc); - $entries = $xpath->query('(//img[@src]|//a[@href])'); - - foreach ($entries as $entry) { - if (preg_match("/feedsportal.com/", $entry->getAttribute("src"))) { - $entry->parentNode->removeChild($entry); - } else if (preg_match("/feedsportal.com/", $entry->getAttribute("href"))) { - $entry->parentNode->removeChild($entry); - } - } - - $article["content"] = $doc->saveHTML(); - } - - return $article; - } - - function api_version() { - return 2; - } - -} diff --git a/plugins/af_proxy_http/init.php b/plugins/af_proxy_http/init.php deleted file mode 100644 index 47e273b7e..000000000 --- a/plugins/af_proxy_http/init.php +++ /dev/null @@ -1,252 +0,0 @@ -host = $host; - $this->cache = new DiskCache("images"); - - $host->add_hook($host::HOOK_RENDER_ARTICLE, $this, 150); - $host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this, 150); - $host->add_hook($host::HOOK_ENCLOSURE_ENTRY, $this); - - $host->add_hook($host::HOOK_PREFS_TAB, $this); - - if (empty($_SESSION['af_proxy_http_token'])) - $_SESSION['af_proxy_http_token'] = bin2hex(get_random_bytes(16)); - } - - function hook_enclosure_entry($enc) { - if (preg_match("/image/", $enc["content_type"])) { - $proxy_all = $this->host->get($this, "proxy_all"); - - $enc["content_url"] = $this->rewrite_url_if_needed($enc["content_url"], $proxy_all); - } - - return $enc; - } - - function hook_render_article($article) { - return $this->hook_render_article_cdm($article); - } - - public function imgproxy() { - $url = UrlHelper::validate(clean($_REQUEST["url"])); - - // immediately redirect to original URL if: - // - url points back to ourselves - // - called without user context - // - session-spefific token is invalid - if ( - strpos($url, get_self_url_prefix()) === 0 || - empty($_SESSION["uid"]) || - $_REQUEST['af_proxy_http_token'] != $_SESSION['af_proxy_http_token']) { - header("Location: $url"); - return; - } - - $local_filename = sha1($url); - - if ($this->cache->exists($local_filename)) { - header("Location: " . $this->cache->get_url($local_filename)); - return; - } else { - $data = UrlHelper::fetch(["url" => $url, "max_size" => Config::get(Config::MAX_CACHE_FILE_SIZE)]); - - if ($data) { - if ($this->cache->put($local_filename, $data)) { - header("Location: " . $this->cache->get_url($local_filename)); - return; - } - } else { - if (function_exists("imagecreate") && !isset($_REQUEST["text"])) { - $img = imagecreate(450, 75); - - /*$bg =*/ imagecolorallocate($img, 255, 255, 255); - $textcolor = imagecolorallocate($img, 255, 0, 0); - - imagerectangle($img, 0, 0, 450-1, 75-1, $textcolor); - - imagestring($img, 5, 5, 5, "Proxy request failed", $textcolor); - imagestring($img, 5, 5, 30, truncate_middle($url, 46, "..."), $textcolor); - imagestring($img, 5, 5, 55, "HTTP Code: ".UrlHelper::$fetch_last_error_code, $textcolor); - - header("Content-type: image/png"); - print imagepng($img); - imagedestroy($img); - - } else { - header("Content-type: text/plain"); - - http_response_code(400); - - print "Proxy request failed.\n". - "Fetch error ".UrlHelper::$fetch_last_error." (".UrlHelper::$fetch_last_error_code.")\n". - "Requested URL: $url"; - } - } - } - } - - private function rewrite_url_if_needed($url, $all_remote = false) { - /* don't rewrite urls pointing to ourselves */ - - if (strpos($url, get_self_url_prefix()) === 0) - return $url; - - /* we don't need to handle URLs where local cache already exists, tt-rss rewrites those automatically */ - if (!$this->cache->exists(sha1($url))) { - - $scheme = parse_url($url, PHP_URL_SCHEME); - - if ($all_remote) { - $host = parse_url($url, PHP_URL_HOST); - $self_host = parse_url(get_self_url_prefix(), PHP_URL_HOST); - - $is_remote = $host != $self_host; - } else { - $is_remote = false; - } - - if (($scheme != 'https' && $scheme != "") || $is_remote) { - if (strpos($url, "data:") !== 0) { - $parts = parse_url($url); - - foreach (explode(" " , $this->ssl_known_whitelist) as $host) { - if (substr(strtolower($parts['host']), -strlen($host)) === strtolower($host)) { - $parts['scheme'] = 'https'; - $url = UrlHelper::build_url($parts); - if ($all_remote && $is_remote) { - break; - } else { - return $url; - } - } - } - - return $this->host->get_public_method_url($this, "imgproxy", - ["url" => $url, "af_proxy_http_token" => $_SESSION["af_proxy_http_token"]]); - } - } - } - - return $url; - } - - function hook_render_article_cdm($article, $api_mode = false) { - - $need_saving = false; - $proxy_all = $this->host->get($this, "proxy_all"); - - $doc = new DOMDocument(); - if (@$doc->loadHTML('' . $article["content"])) { - $xpath = new DOMXPath($doc); - $imgs = $xpath->query("//img[@src]"); - - foreach ($imgs as $img) { - $new_src = $this->rewrite_url_if_needed($img->getAttribute("src"), $proxy_all); - - if ($new_src != $img->getAttribute("src")) { - $img->setAttribute("src", $new_src); - $img->removeAttribute("srcset"); - - $need_saving = true; - } - } - - $vids = $xpath->query("(//video|//picture)"); - - foreach ($vids as $vid) { - if ($vid->hasAttribute("poster")) { - $new_src = $this->rewrite_url_if_needed($vid->getAttribute("poster"), $proxy_all); - - if ($new_src != $vid->getAttribute("poster")) { - $vid->setAttribute("poster", $new_src); - - $need_saving = true; - } - } - - $vsrcs = $xpath->query("source", $vid); - - foreach ($vsrcs as $vsrc) { - $new_src = $this->rewrite_url_if_needed($vsrc->getAttribute("src"), $proxy_all); - - if ($new_src != $vsrc->getAttribute("src")) { - $vid->setAttribute("src", $new_src); - - $need_saving = true; - } - } - } - } - - if ($need_saving) $article["content"] = $doc->saveHTML(); - - return $article; - } - - function hook_prefs_tab($args) { - if ($args != "prefFeeds") return; - ?> - -
- -
- - - - - -
- -
- -
- - -
-
- host->set($this, "proxy_all", $proxy_all); - - echo __("Configuration saved"); - } - - function api_version() { - return 2; - } -} diff --git a/plugins/close_button/init.php b/plugins/close_button/init.php deleted file mode 100644 index c1169fc34..000000000 --- a/plugins/close_button/init.php +++ /dev/null @@ -1,33 +0,0 @@ -host = $host; - - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - } - - function about() { - return array(null, - "Adds a button to close article panel", - "fox"); - } - - function get_css() { - return ".post .header .buttons i.material-icons.icon-close-article { color : red; }"; - } - - function hook_article_button($line) { - if (!get_pref(Prefs::COMBINED_DISPLAY_MODE)) { - return "close"; - } - } - - function api_version() { - return 2; - } - -} diff --git a/plugins/mail/init.php b/plugins/mail/init.php deleted file mode 100644 index 9835618d7..000000000 --- a/plugins/mail/init.php +++ /dev/null @@ -1,235 +0,0 @@ -host = $host; - - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - $host->add_hook($host::HOOK_PREFS_TAB, $this); - $host->add_hook($host::HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM, $this); - } - - function get_js() { - return file_get_contents(__DIR__ . "/mail.js"); - } - - function hook_headline_toolbar_select_menu_item($feed_id, $is_cat) { - return "
".__('Forward by email')."
"; - } - - function save() { - $addresslist = $_POST["addresslist"]; - - $this->host->set($this, "addresslist", $addresslist); - - echo __("Mail addresses saved."); - } - - function hook_prefs_tab($args) { - if ($args != "prefPrefs") return; - - $addresslist = $this->host->get($this, "addresslist"); - - ?> - -
- -
- - - - -
- - - -
- - - -
-
- mail"; - } - - function emailArticle() { - - $ids = explode(",", clean($_REQUEST['ids'])); - $ids_qmarks = arr_qmarks($ids); - - - $sth = $this->pdo->prepare("SELECT email, full_name FROM ttrss_users WHERE - id = ?"); - $sth->execute([$_SESSION['uid']]); - - if ($row = $sth->fetch()) { - $user_email = htmlspecialchars($row['email']); - $user_name = htmlspecialchars($row['full_name']); - } else { - $user_name = ""; - $user_email = ""; - } - - if (!$user_name) - $user_name = $_SESSION['name']; - - $tpl = new Templator(); - - $tpl->readTemplateFromFile("email_article_template.txt"); - - $tpl->setVariable('USER_NAME', $_SESSION["name"], true); - $tpl->setVariable('USER_EMAIL', $user_email, true); - $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true); - - $sth = $this->pdo->prepare("SELECT DISTINCT link, content, title, note - FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND - id IN ($ids_qmarks) AND owner_uid = ?"); - $sth->execute(array_merge($ids, [$_SESSION['uid']])); - - if (count($ids) > 1) { - $subject = __("[Forwarded]") . " " . __("Multiple articles"); - } else { - $subject = ""; - } - - while ($line = $sth->fetch()) { - - if (!$subject) - $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); - - $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"])); - $tnote = strip_tags($line["note"]); - if( $tnote != ''){ - $tpl->setVariable('ARTICLE_NOTE', $tnote, true); - $tpl->addBlock('note'); - } - $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"])); - - $tpl->addBlock('article'); - } - - $tpl->addBlock('email'); - - $content = ""; - $tpl->generateOutputToString($content); - - $addresslist = explode(",", $this->host->get($this, "addresslist")); - - ?> - -
- - - - - - - - -
-
- - "width: 380px", "required" => 1, "dojoType" => "dijit.form.ComboBox"]) ?> -
-
- -
-
- - -
-
- - - - - -
- AddReplyTo(strip_tags($_REQUEST['from_email']), - strip_tags($_REQUEST['from_name'])); - //$mail->AddAddress($_REQUEST['destination']); - $addresses = explode(';', $_REQUEST['destination']); - foreach($addresses as $nextaddr) - $mail->AddAddress($nextaddr); - - $mail->IsHTML(false); - $mail->Subject = $_REQUEST['subject']; - $mail->Body = $_REQUEST['content']; - - $rc = $mail->Send(); */ - - $to = $_REQUEST["destination"]; - $subject = strip_tags($_REQUEST["subject"]); - $message = strip_tags($_REQUEST["content"]); - $from = strip_tags($_REQUEST["from_email"]); - - $mailer = new Mailer(); - - $rc = $mailer->mail(["to_address" => $to, - "headers" => ["Reply-To: $from"], - "subject" => $subject, - "message" => $message]); - - if (!$rc) { - $reply['error'] = $mailer->error(); - } else { - //save_email_address($destination); - $reply['message'] = "UPDATE_COUNTERS"; - } - - print json_encode($reply); - } - - function api_version() { - return 2; - } - -} diff --git a/plugins/mail/mail.js b/plugins/mail/mail.js deleted file mode 100644 index d2bafe0e9..000000000 --- a/plugins/mail/mail.js +++ /dev/null @@ -1,51 +0,0 @@ -/* global Plugins, Headlines, dojo, App, xhr, Notify, fox, __ */ - -Plugins.Mail = { - send: function(id) { - if (!id) { - const ids = Headlines.getSelected(); - - if (ids.length == 0) { - alert(__("No articles selected.")); - return; - } - - id = ids.toString(); - } - - const dialog = new fox.SingleUseDialog({ - title: __("Forward article by email"), - execute: function () { - if (this.validate()) { - xhr.json("backend.php", this.attr('value'), (reply) => { - if (reply) { - const error = reply['error']; - - if (error) { - alert(__('Error sending email:') + ' ' + error); - } else { - Notify.info('Your message has been sent.'); - dialog.hide(); - } - - } - }); - } - }, - content: __("Loading, please wait...") - }); - - const tmph = dojo.connect(dialog, 'onShow', function () { - dojo.disconnect(tmph); - - xhr.post("backend.php", App.getPhArgs("mail", "emailArticle", {ids: id}), (reply) => { - dialog.attr('content', reply); - }); - }); - - dialog.show(); - }, - onHotkey: function(id) { - Plugins.Mail.send(id); - } -}; diff --git a/plugins/mailto/init.js b/plugins/mailto/init.js deleted file mode 100644 index 4a9557249..000000000 --- a/plugins/mailto/init.js +++ /dev/null @@ -1,39 +0,0 @@ -/* global Plugins, Headlines, xhr, dojo, fox, __ */ - -Plugins.Mailto = { - send: function (id) { - if (!id) { - const ids = Headlines.getSelected(); - - if (ids.length == 0) { - alert(__("No articles selected.")); - return; - } - - id = ids.toString(); - } - - const dialog = new fox.SingleUseDialog({ - title: __("Forward article by email (mailto:)"), - content: __("Loading, please wait...") - }); - - const tmph = dojo.connect(dialog, 'onShow', function () { - dojo.disconnect(tmph); - - xhr.post("backend.php", App.getPhArgs("mailto", "emailArticle", {ids: id}), (reply) => { - dialog.attr('content', reply); - }); - }); - - - dialog.show(); - } -}; - -// override default hotkey action if enabled -Plugins.Mail = Plugins.Mail || {}; - -Plugins.Mail.onHotkey = function(id) { - Plugins.Mailto.send(id); -}; diff --git a/plugins/mailto/init.php b/plugins/mailto/init.php deleted file mode 100644 index 514daacfc..000000000 --- a/plugins/mailto/init.php +++ /dev/null @@ -1,95 +0,0 @@ -host = $host; - - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - $host->add_hook($host::HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM, $this); - } - - function hook_headline_toolbar_select_menu_item($feed_id, $is_cat) { - return "
".__('Forward by email (mailto:)')."
"; - } - - function get_js() { - return file_get_contents(__DIR__ . "/init.js"); - } - - function hook_article_button($line) { - return "mail_outline"; - } - - function emailArticle() { - - $ids = explode(",", clean($_REQUEST['ids'])); - $ids_qmarks = arr_qmarks($ids); - - $tpl = new Templator(); - - $tpl->readTemplateFromFile("email_article_template.txt"); - - $tpl->setVariable('USER_NAME', $_SESSION["name"], true); - //$tpl->setVariable('USER_EMAIL', $user_email, true); - $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true); - - $sth = $this->pdo->prepare("SELECT DISTINCT link, content, title - FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND - id IN ($ids_qmarks) AND owner_uid = ?"); - $sth->execute(array_merge($ids, [$_SESSION['uid']])); - - if (count($ids) > 1) { - $subject = __("[Forwarded]") . " " . __("Multiple articles"); - } else { - $subject = ""; - } - - while ($line = $sth->fetch()) { - - if (!$subject) - $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); - - $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"])); - $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"])); - - $tpl->addBlock('article'); - } - - $tpl->addBlock('email'); - - $content = ""; - $tpl->generateOutputToString($content); - - $mailto_link = "mailto:?subject=".rawurlencode($subject)."&body=".rawurlencode($content); - - ?> - -
-
- - - -
-
- - - - { - App.updateTitle = function () { - document.title = "Tiny Tiny RSS"; - }; - }); - }); -}); diff --git a/plugins/no_title_counters/init.php b/plugins/no_title_counters/init.php deleted file mode 100644 index ff8dbe9fa..000000000 --- a/plugins/no_title_counters/init.php +++ /dev/null @@ -1,24 +0,0 @@ -host = $host; - - } - - function get_js() { - return file_get_contents(__DIR__ . "/init.js"); - } - - function api_version() { - return 2; - } - -} \ No newline at end of file