host = $host; $host->add_hook($host::HOOK_PREFS_TAB, $this); } function is_public_method($method) { return in_array($method, ["subscribe", "sharepopup"]); } 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'); ?> <?= __("Subscribe to feed...") ?>

%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 \Controls\public_method_tags($this, "subscribe"); 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 { Handler_Public::_render_login_form(); } } 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"])); ?>

"window.close()"]) ?>
" />
"/>

"; host->get_public_method_url($this, "subscribe"); $bm_share_url = $this->host->get_public_method_url($this, "sharepopup"); $confirm_str = str_replace("'", "\'", __('Subscribe to %s in Tiny Tiny RSS?')); $bm_subscribe_url = htmlspecialchars("javascript:{if(confirm('$confirm_str'.replace('%s',window.location.href)))window.location.href='$bm_subscribe_url&feed_url='+encodeURIComponent(window.location.href)}"); $bm_share_url = htmlspecialchars("javascript:(function(){var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='$bm_share_url',l=d.location,e=encodeURIComponent,g=f+'&title='+((e(s))?e(s):e(document.title))+'&url='+e(l.href);function a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=500,height=250')){l.href=g;}}a();})()"); //$bm_subscribe_url = str_replace('%s', '', $this->subscribe_to_feed_url()); //$confirm_str = str_replace("'", "\'", __('Subscribe to %s in Tiny Tiny RSS?')); //$bm_subscribe_url = htmlspecialchars("javascript:{if(confirm('$confirm_str'.replace('%s',window.location.href)))window.location.href='$bm_subscribe_url'+encodeURIComponent(window.location.href)}"); //$bm_share_url = htmlspecialchars("javascript:(function(){var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='".get_self_url_prefix()."/public.php?op=sharepopup',l=d.location,e=encodeURIComponent,g=f+'&title='+((e(s))?e(s):e(document.title))+'&url='+e(l.href);function a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=500,height=250')){l.href=g;}}a();})()"); ?>

'alt-info', "onclick" => "window.open('https://tt-rss.org/wiki/ShareAnything')"]) ?>