<?
session_start();
+
+ header("Cache-Control: no-cache, must-revalidate");
+ header("Pragma: no-cache");
+ header("Expires: -1");
if ($_GET["debug"]) {
define('DEFAULT_ERROR_LEVEL', E_ALL);
if ($op == "rpc") {
print "<error error-code=\"6\"/>";
+ } else {
+ print "
+ <html><body>
+ <p>Error: Not logged in.</p>
+ <script type=\"text/javascript\">
+ if (parent.window != 'undefined') {
+ parent.window.location = \"login.php\";
+ } else {
+ window.location = \"login.php\";
+ }
+ </script>
+ </body></html>
+ ";
}
exit;
}
exit;
}
- define('SCHEMA_VERSION', 5);
+ define('SCHEMA_VERSION', 6);
require_once "sanity_check.php";
require_once "config.php";
<script type=\"text/javascript\" src=\"pngfix.js\"></script>
<link rel=\"stylesheet\" type=\"text/css\" href=\"tt-rss-ie.css\">
<![endif]-->
- </head><body onload=\"init()\">";
+ </head><body>
+ <script type=\"text/javascript\">
+ if (document.addEventListener) {
+ document.addEventListener(\"DOMContentLoaded\", init, null);
+ }
+ window.onload = init;
+ </script>";
- print "<ul class=\"feedList\" id=\"feedList\">";
+ print "<ul class=\"feedList\" id=\"feedList\">\n";
$owner_uid = $_SESSION["uid"];
"images/mark_set.png", $link);
if (get_pref($link, 'ENABLE_FEED_CATS')) {
- print "</li></ul>";
+ print "</ul>\n";
}
if (GLOBAL_ENABLE_LABELS && get_pref($link, 'ENABLE_LABELS')) {
if (db_num_rows($result) > 0) {
if (get_pref($link, 'ENABLE_FEED_CATS')) {
- print "</li></ul>";
+ print "</ul>";
}
}
if ($category != $tmp_category && get_pref($link, 'ENABLE_FEED_CATS')) {
if ($category) {
- print "</li></ul></li>";
+ print "</ul></li>";
}
$category = $tmp_category;
print "</ul>";
+ print '
+ <script type="text/javascript">
+ /* for IE */
+ function statechange() {
+ if (document.readyState == "interactive") init();
+ }
+
+ if (document.readyState) {
+ if (document.readyState == "interactive" || document.readyState == "complete") {
+ init();
+ } else {
+ document.onreadystatechange = statechange;
+ }
+ }
+ </script></body></html>';
}
$omode = $_GET["omode"];
- if (!$omode) $omode = "tfl";
+ if (!$omode) $omode = "tflc";
if (strchr($omode, "l")) getLabelCounters($link);
if (strchr($omode, "f")) getFeedCounters($link);
if (strchr($omode, "t")) getTagCounters($link);
- if (get_pref($link, 'ENABLE_FEED_CATS')) {
- getCategoryCounters($link);
- }
- getGlobalCounters($link, $global_unread);
+ if (strchr($omode, "c")) {
+ if (get_pref($link, 'ENABLE_FEED_CATS')) {
+ getCategoryCounters($link);
+ }
+ }
}
-
+
+ getGlobalCounters($link, $global_unread);
+
print "</rpc-reply>";
}
SET unread = false,last_read = NOW()
WHERE ref_id = '$id' AND feed_id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
- $addheader = $_GET["addheader"];
-
$result = db_query($link, "SELECT title,link,content,feed_id,comments,int_id,
SUBSTRING(updated,1,16) as updated,
(SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url,
- num_comments
+ num_comments,
+ author
FROM ttrss_entries,ttrss_user_entries
WHERE id = '$id' AND ref_id = id");
- if ($addheader) {
- print "<html><head>
- <title>Tiny Tiny RSS : Article $id</title>
- <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">";
-
- $user_theme = $_SESSION["theme"];
- if ($user_theme) {
- print "<link rel=\"stylesheet\" type=\"text/css\"
- href=\"themes/$user_theme/theme.css\">";
- }
+ print "<html><head>
+ <title>Tiny Tiny RSS : Article $id</title>
+ <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">";
- if (get_pref($link, 'USE_COMPACT_STYLESHEET')) {
- print "<link rel=\"stylesheet\" type=\"text/css\"
- href=\"tt-rss_compact.css\"/>";
- } else {
- print "<link title=\"Compact Stylesheet\" rel=\"alternate stylesheet\"
- type=\"text/css\" href=\"tt-rss_compact.css\"/>";
- }
+ $user_theme = $_SESSION["theme"];
+ if ($user_theme) {
+ print "<link rel=\"stylesheet\" type=\"text/css\"
+ href=\"themes/$user_theme/theme.css\">";
+ }
- print "<script type=\"text/javascript\" src=\"functions.js\"></script>
- <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
- </head><body>";
+ if (get_pref($link, 'USE_COMPACT_STYLESHEET')) {
+ print "<link rel=\"stylesheet\" type=\"text/css\"
+ href=\"tt-rss_compact.css\"/>";
+ } else {
+ print "<link title=\"Compact Stylesheet\" rel=\"alternate stylesheet\"
+ type=\"text/css\" href=\"tt-rss_compact.css\"/>";
}
+ print "<script type=\"text/javascript\" src=\"functions.js\"></script>
+ <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
+ </head><body>";
+
if ($result) {
$line = db_fetch_assoc($result);
print "<div class=\"postHeader\"><table width=\"100%\">";
- print "<tr><td><a href=\"" . $line["link"] . "\">" . $line["title"] . "</a></td>";
+ $entry_author = $line["author"];
+
+ if ($entry_author) {
+ $entry_author = " - by $entry_author";
+ }
+
+ print "<tr><td><a href=\"" . $line["link"] . "\">" . $line["title"] .
+ "</a>$entry_author</td>";
$parsed_updated = date(get_pref($link, 'LONG_DATE_FORMAT'),
strtotime($line["updated"]));
</script>";
}
- if ($addheader) {
- print "</body></html>";
- }
+ print "</body></html>";
}
if ($op == "viewfeed") {
$skip = $_GET["skip"];
$subop = $_GET["subop"];
$view_mode = $_GET["view"];
- $addheader = $_GET["addheader"];
$limit = $_GET["limit"];
if (!$feed) {
if ($subop == "undefined") $subop = "";
- if ($addheader) {
- print "<html><head>
- <title>Tiny Tiny RSS : Feed $feed</title>
- <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">";
-
- $user_theme = $_SESSION["theme"];
- if ($user_theme) {
- print "<link rel=\"stylesheet\" type=\"text/css\"
- href=\"themes/$user_theme/theme.css\">";
- }
+ print "<html><head>
+ <title>Tiny Tiny RSS : Feed $feed</title>
+ <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">";
- if (get_pref($link, 'USE_COMPACT_STYLESHEET')) {
- print "<link rel=\"stylesheet\"
- type=\"text/css\" href=\"tt-rss_compact.css\"/>";
+ $user_theme = $_SESSION["theme"];
+ if ($user_theme) {
+ print "<link rel=\"stylesheet\" type=\"text/css\"
+ href=\"themes/$user_theme/theme.css\">";
+ }
- } else {
- print "<link title=\"Compact Stylesheet\" rel=\"alternate stylesheet\"
- type=\"text/css\" href=\"tt-rss_compact.css\"/>";
- }
+ if (get_pref($link, 'USE_COMPACT_STYLESHEET')) {
+ print "<link rel=\"stylesheet\"
+ type=\"text/css\" href=\"tt-rss_compact.css\"/>";
- print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
- <script type=\"text/javascript\" src=\"functions.js\"></script>
- <script type=\"text/javascript\" src=\"viewfeed.js\"></script>
- <!--[if gte IE 5.5000]>
- <script type=\"text/javascript\" src=\"pngfix.js\"></script>
- <link rel=\"stylesheet\" type=\"text/css\" href=\"tt-rss-ie.css\">
- <![endif]-->
- </head><body onload='init()'>";
+ } else {
+ print "<link title=\"Compact Stylesheet\" rel=\"alternate stylesheet\"
+ type=\"text/css\" href=\"tt-rss_compact.css\"/>";
}
+ print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
+ <script type=\"text/javascript\" src=\"functions.js\"></script>
+ <script type=\"text/javascript\" src=\"viewfeed.js\"></script>
+ <!--[if gte IE 5.5000]>
+ <script type=\"text/javascript\" src=\"pngfix.js\"></script>
+ <link rel=\"stylesheet\" type=\"text/css\" href=\"tt-rss-ie.css\">
+ <![endif]-->
+ </head><body>
+ <script type=\"text/javascript\">
+ if (document.addEventListener) {
+ document.addEventListener(\"DOMContentLoaded\", init, null);
+ }
+ window.onload = init;
+ </script>";
+
if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) {
/* if (ENABLE_UPDATE_DAEMON) {
// override query strategy and enable feed display when searching globally
if ($search && $search_mode == "All feeds") {
$query_strategy_part = "ttrss_entries.id > 0";
- $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
+ $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
} else if (sprintf("%d", $feed) == 0) {
$query_strategy_part = "ttrss_entries.id > 0";
$vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
id = feed_id) as feed_title,";
+ } else if ($feed >= 0 && $search && $search_mode == "This category") {
+
+ $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
+
+ $tmp_result = db_query($link, "SELECT id
+ FROM ttrss_feeds WHERE cat_id =
+ (SELECT cat_id FROM ttrss_feeds WHERE id = '$feed') AND id != '$feed'");
+
+ $cat_siblings = array();
+
+ if (db_num_rows($tmp_result) > 0) {
+ while ($p = db_fetch_assoc($tmp_result)) {
+ array_push($cat_siblings, "feed_id = " . $p["id"]);
+ }
+
+ $query_strategy_part = sprintf("(feed_id = %d OR %s)",
+ $feed, implode(" OR ", $cat_siblings));
+
+ } else {
+ $query_strategy_part = "ttrss_entries.id > 0";
+ }
+
} else if ($feed >= 0) {
$tmp_result = db_query($link, "SELECT id
$query_strategy_part = sprintf("(feed_id = %d OR %s)",
$feed, implode(" OR ", $parent_ids));
-
+
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
} else {
$query_strategy_part = "feed_id = '$feed'";
Could not display feed (query failed). Please check label match syntax or local configuration.</div>";
return;
}
-
- if (db_num_rows($result) > 0) {
- print "<table class=\"headlinesSubToolbar\"
+ function print_headline_subtoolbar($link, $feed_site_url, $feed_title,
+ $bottom = false) {
+
+ if (!$bottom) {
+ $class = "headlinesSubToolbar";
+ $tid = "headlineActionsTop";
+ } else {
+ $class = "invisible";
+ $tid = "headlineActionsBottom";
+ }
+
+ print "<table class=\"$class\" id=\"$tid\"
width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr>";
if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
print "</td>";
-
}
if ($last_error) {
print "<td align='center' class='small'>
<a class=\"warning\" href=\"javascript:alert('TT-RSS encountered an error while trying to update this feed.\\n\\n$last_error')\">Could not update this feed.</a></td>";
- }
+ }
print "<td class=\"headlineTitle\">";
if ($feed_site_url) {
- print "<a target=\"_blank\" href=\"$feed_site_url\">$feed_title</a>";
+ if (!$bottom) {
+ $target = "target=\"_blank\"";
+ }
+ print "<a $target href=\"$feed_site_url\">$feed_title</a>";
} else {
print $feed_title;
}
print "</td>";
print "</tr></table>";
+ }
+
+ if (db_num_rows($result) > 0) {
+
+ print_headline_subtoolbar($link, $feed_site_url, $feed_title);
+
if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
print "<table class=\"headlinesList\" id=\"headlinesList\"
cellspacing=\"0\" width=\"100%\">";
print "</table>";
}
+ print_headline_subtoolbar($link,
+ "javascript:catchupPage()", "Mark page as read", true);
+
+
} else {
print "<div width='100%' align='center'>No articles found.</div>";
}
print "<script type=\"text/javascript\">
document.onkeydown = hotkey_handler;
+ // if (parent.daemon_enabled) parent.updateTitle('$feed_title');
update_all_counters('$feed');
</script>";
- if ($addheader) {
- print "</body></html>";
- }
+ print '
+ <script type="text/javascript">
+ /* for IE */
+ function statechange() {
+ if (document.readyState == "interactive") init();
+ }
+
+ if (document.readyState) {
+ if (document.readyState == "interactive" || document.readyState == "complete") {
+ init();
+ } else {
+ document.onreadystatechange = statechange;
+ }
+ }
+ </script>';
+
+ print "</body></html>";
}
if ($op == "pref-rpc") {
} else {
print "<option disabled>This feed</option>";
}
-
+
+ if (get_pref($link, 'ENABLE_FEED_CATS')) {
+ print "<option>This category</option>";
+ }
+
print "</select>
<input type=\"submit\"
class=\"button\" onclick=\"javascript:search()\" value=\"Search\">