diff --git a/classes/feeds.php b/classes/feeds.php index 0c01ff25a..63b84edae 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -1099,6 +1099,18 @@ class Feeds extends Handler_Protected { return false; } + static function _find_by_url($feed_url, $owner_uid) { + $sth = Db::pdo()->prepare("SELECT id FROM ttrss_feeds WHERE + feed_url = ? AND owner_uid = ?"); + $sth->execute([$feed_url, $owner_uid]); + + if ($row = $sth->fetch()) { + return $row["id"]; + } + + return false; + } + static function _get_title($id, $cat = false) { $pdo = Db::pdo(); diff --git a/plugins/bookmarklets/init.php b/plugins/bookmarklets/init.php index 4c3bbf4cc..caa8b39df 100644 --- a/plugins/bookmarklets/init.php +++ b/plugins/bookmarklets/init.php @@ -118,56 +118,54 @@ class Bookmarklets extends Plugin { } if ($feed_urls) { + ?> +
"; + + = __("Return to Tiny Tiny RSS") ?> + + 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"]; + if ($rc['code'] <= 2) { + $feed_id = Feeds::_find_by_url($feed_url, $_SESSION["uid"]); } else { $feed_id = 0; } if ($feed_id) { - print ""; + ?> + + + = __("Return to Tiny Tiny RSS") ?> +