X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=classes%2Fhandler%2Fpublic.php;h=1e96bef0034585e7bdfb90a0e45d92e44f7e33d9;hb=6322ac79a020ab584d412d782d62b2ee77d7c6cf;hp=37c704584798bc5bd5afb90857ff55db3e681b11;hpb=e470a273cf09562fb2f9c0c899002303f19c8d16;p=tt-rss.git diff --git a/classes/handler/public.php b/classes/handler/public.php index 37c70458..1e96bef0 100644 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -12,7 +12,7 @@ class Handler_Public extends Handler { "padding : 5px; border-style : dashed; border-color : #e7d796;". "margin-bottom : 1em; color : #9a8c59;"; - if (!$limit) $limit = 100; + if (!$limit) $limit = 60; $date_sort_field = "date_entered DESC, updated DESC"; @@ -21,11 +21,32 @@ class Handler_Public extends Handler { else if ($feed == -1) $date_sort_field = "last_marked DESC"; - $qfh_ret = queryFeedHeadlines($this->link, $feed, + $qfh_ret = queryFeedHeadlines( $feed, + 1, $view_mode, $is_cat, $search, $search_mode, + $date_sort_field, $offset, $owner_uid, + false, 0, false, true); + + $result = $qfh_ret[0]; + + if (db_num_rows($result) != 0) { + $ts = strtotime(db_fetch_result($result, 0, "date_entered")); + + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && + strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $ts) { + header('HTTP/1.0 304 Not Modified'); + return; + } + + $last_modified = gmdate("D, d M Y H:i:s", $ts) . " GMT"; + header("Last-Modified: $last_modified", true); + } + + $qfh_ret = queryFeedHeadlines( $feed, $limit, $view_mode, $is_cat, $search, $search_mode, $date_sort_field, $offset, $owner_uid, false, 0, false, true); + $result = $qfh_ret[0]; $feed_title = htmlspecialchars($qfh_ret[1]); $feed_site_url = $qfh_ret[2]; @@ -33,7 +54,7 @@ class Handler_Public extends Handler { $feed_self_url = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . - get_feed_access_key($this->link, -2, false, $owner_uid); + get_feed_access_key( -2, false, $owner_uid); if (!$feed_site_url) $feed_site_url = get_self_url_prefix(); @@ -53,14 +74,15 @@ class Handler_Public extends Handler { $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true); - while ($line = db_fetch_assoc($result)) { + while ($line = db_fetch_assoc($result)) { + $tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']), true); $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true); $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true); $tpl->setVariable('ARTICLE_EXCERPT', truncate_string(strip_tags($line["content_preview"]), 100, '...'), true); - $content = sanitize($this->link, $line["content_preview"], false, $owner_uid); + $content = sanitize( $line["content_preview"], false, $owner_uid); if ($line['note']) { $content = "
Article note: " . $line['note'] . "
" . @@ -77,14 +99,14 @@ class Handler_Public extends Handler { $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true); - $tags = get_article_tags($this->link, $line["id"], $owner_uid); + $tags = get_article_tags( $line["id"], $owner_uid); foreach ($tags as $tag) { $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true); $tpl->addBlock('category'); } - $enclosures = get_article_enclosures($this->link, $line["id"]); + $enclosures = get_article_enclosures( $line["id"]); foreach ($enclosures as $e) { $type = htmlspecialchars($e['content_type']); @@ -136,13 +158,13 @@ class Handler_Public extends Handler { $article['link'] = $line['link']; $article['title'] = $line['title']; $article['excerpt'] = truncate_string(strip_tags($line["content_preview"]), 100, '...'); - $article['content'] = sanitize($this->link, $line["content_preview"], false, $owner_uid); + $article['content'] = sanitize( $line["content_preview"], false, $owner_uid); $article['updated'] = date('c', strtotime($line["updated"])); if ($line['note']) $article['note'] = $line['note']; if ($article['author']) $article['author'] = $line['author']; - $tags = get_article_tags($this->link, $line["id"], $owner_uid); + $tags = get_article_tags( $line["id"], $owner_uid); if (count($tags) > 0) { $article['tags'] = array(); @@ -152,7 +174,7 @@ class Handler_Public extends Handler { } } - $enclosures = get_article_enclosures($this->link, $line["id"]); + $enclosures = get_article_enclosures( $line["id"]); if (count($enclosures) > 0) { $article['enclosures'] = array(); @@ -179,19 +201,19 @@ class Handler_Public extends Handler { } function getUnread() { - $login = db_escape_string($this->link, $_REQUEST["login"]); + $login = db_escape_string( $_REQUEST["login"]); $fresh = $_REQUEST["fresh"] == "1"; - $result = db_query($this->link, "SELECT id FROM ttrss_users WHERE login = '$login'"); + $result = db_query( "SELECT id FROM ttrss_users WHERE login = '$login'"); if (db_num_rows($result) == 1) { $uid = db_fetch_result($result, 0, "id"); - print getGlobalUnread($this->link, $uid); + print getGlobalUnread( $uid); if ($fresh) { print ";"; - print getFeedArticles($this->link, -3, false, true, $uid); + print getFeedArticles( -3, false, true, $uid); } } else { @@ -201,9 +223,9 @@ class Handler_Public extends Handler { } function getProfiles() { - $login = db_escape_string($this->link, $_REQUEST["login"]); + $login = db_escape_string( $_REQUEST["login"]); - $result = db_query($this->link, "SELECT * FROM ttrss_settings_profiles,ttrss_users + $result = db_query( "SELECT * FROM ttrss_settings_profiles,ttrss_users WHERE ttrss_users.id = ttrss_settings_profiles.owner_uid AND login = '$login' ORDER BY title"); print " + "; + + break; + } else { + print "OK!"; + } + } + + print ""; + + print_notice("Your Tiny Tiny RSS database is now updated to the latest version."); + + print "

+ +
"; + + } else { + print "

Your database is up to date.

"; + + print "

+ +
"; + } + } else { + if ($updater->isUpdateRequired()) { + + print "

Database update required

"; + + print "

"; + printf("Your Tiny Tiny RSS database needs update to the latest version: %d to %d.", + $updater->getSchemaVersion(), SCHEMA_VERSION); + print "

"; + + print_warning("Please backup your database before proceeding."); + + print "
+ + +
"; + + } else { + + print "

" . "Tiny Tiny RSS database is up to date." . "

"; + + print "

+ +
"; + + } + } + ?> + + + + +