$fetch = $_GET["fetch"];
+ function getAllCounters($link) {
+ getLabelCounters($link);
+ getFeedCounters($link);
+ getTagCounters($link);
+ getGlobalCounters($link);
+ }
+
/* FIXME this needs reworking */
function getGlobalCounters($link) {
<title>Tiny Tiny RSS : Feedlist</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\">";
+ }
+
if (get_pref($link, 'USE_COMPACT_STYLESHEET')) {
print "<link rel=\"stylesheet\" type=\"text/css\"
href=\"tt-rss_compact.css\"/>";
$unread = $tags[$tag];
- $class = "odd";
+ $class = "tag";
if ($unread > 0) {
$class .= "Unread";
if ($subop == "getAllCounters") {
print "<rpc-reply>";
- getLabelCounters($link);
- getFeedCounters($link);
- getTagCounters($link);
- getGlobalCounters($link);
+ getAllCounters($link);
print "</rpc-reply>";
}
getGlobalCounters($link);
print "</rpc-reply>";
}
-
+
+ /* GET["cmode"] = 0 - mark as read, 1 - as unread, 2 - toggle */
if ($subop == "catchupSelected") {
$ids = split(",", $_GET["ids"]);
- foreach ($ids as $id) {
+ $cmode = sprintf("%d", $_GET["cmode"]);
- db_query($link, "UPDATE ttrss_user_entries SET unread=false,last_read = NOW()
- WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+ foreach ($ids as $id) {
+ if ($cmode == 0) {
+ db_query($link, "UPDATE ttrss_user_entries SET
+ unread = false,last_read = NOW()
+ WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+ } else if ($cmode == 1) {
+ db_query($link, "UPDATE ttrss_user_entries SET
+ unread = true
+ WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+ } else {
+ db_query($link, "UPDATE ttrss_user_entries SET
+ unread = NOT unread,last_read = NOW()
+ WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+ }
}
+ print "<rpc-reply>";
+ getAllCounters($link);
+ print "</rpc-reply>";
+ }
- print "Marked active page as read.";
+ if ($subop == "markSelected") {
+
+ $ids = split(",", $_GET["ids"]);
+
+ $cmode = sprintf("%d", $_GET["cmode"]);
+
+ foreach ($ids as $id) {
+
+ if ($cmode == 0) {
+ db_query($link, "UPDATE ttrss_user_entries SET
+ marked = false
+ WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+ } else if ($cmode == 1) {
+ db_query($link, "UPDATE ttrss_user_entries SET
+ marked = true
+ WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+ } else {
+ db_query($link, "UPDATE ttrss_user_entries SET
+ marked = NOT marked
+ WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+ }
+ }
+ print "<rpc-reply>";
+ getAllCounters($link);
+ print "</rpc-reply>";
}
if ($subop == "sanityCheck") {
if ($addheader) {
print "<html><head>
<title>Tiny Tiny RSS : Article $id</title>
- <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">
- <script type=\"text/javascript\" src=\"functions.js\"></script>
+ <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\">";
+ }
+
+ 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>";
}
print "</div>";
print "<script type=\"text/javascript\">
- update_label_counters('$feed_id');
+ update_all_counters('$feed_id');
</script>";
}
<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\">";
+ }
+
if (get_pref($link, 'USE_COMPACT_STYLESHEET')) {
print "<link rel=\"stylesheet\"
type=\"text/css\" href=\"tt-rss_compact.css\"/>";
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>
}
- print "<table class=\"headlinesList\" id=\"headlinesList\" width=\"100%\">";
-
$search = $_GET["search"];
$search_mode = $_GET["smode"];
$query_strategy_part = "id > 0"; // dumb
}
-
$order_by = "updated DESC";
// if ($feed < -10) {
// $order_by = "feed_id,updated DESC";
// }
+ $feed_title = "";
+
+ if ($search && $search_mode == "All feeds") {
+ $feed_title = "Search results";
+ } else if (sprintf("%d", $feed) == 0) {
+ $feed_title = $feed;
+ } else if ($feed > 0) {
+ $result = db_query($link, "SELECT title,site_url FROM ttrss_feeds
+ WHERE id = '$feed'");
+
+ $feed_title = db_fetch_result($result, 0, "title");
+ $feed_site_url = db_fetch_result($result, 0, "site_url");
+
+ } else if ($feed == -1) {
+ $feed_title = "Starred articles";
+ } else if ($feed < -10) {
+ $label_id = -$feed - 11;
+ $result = db_query($link, "SELECT description FROM ttrss_labels
+ WHERE id = '$label_id'");
+ $feed_title = db_fetch_result($result, 0, "description");
+ } else {
+ $feed_title = "?";
+ }
+
+ print "<table class=\"headlinesSubToolbar\"
+ width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr>";
+
+ print "<td class=\"headlineActions\">
+ Select:
+ <a href=\"javascript:selectTableRowsByIdPrefix('headlinesList',
+ 'RROW-', 'RCHK-', true)\">All</a>,
+ <a href=\"javascript:selectTableRowsByIdPrefix('headlinesList',
+ 'RROW-', 'RCHK-', true, 'Unread')\">Unread</a>,
+ <a href=\"javascript:selectTableRowsByIdPrefix('headlinesList',
+ 'RROW-', 'RCHK-', false)\">None</a>
+
+ Toggle: <a href=\"javascript:toggleUnread()\">Unread</a>,
+ <a href=\"javascript:toggleStarred()\">Starred</a>";
+
+/* print "
+ View:
+ <a href=\"javascript:limitView('All')\">All</a>,
+ <a href=\"javascript:limitView('Unread')\">Unread</a>,
+ <a href=\"javascript:limitView('Starred')\">Starred</a>
+
+ Feed:
+ <a href=\"javascript:updateCurrentFeed()\">Update</a>,
+ <a href=\"javascript:catchupCurrentFeed()\">Mark as read</a>"; */
+
+ print "</td>";
+
+ print "<td class=\"headlineTitle\">";
+
+ if ($feed_site_url) {
+ print "<a href=\"$feed_site_url\">$feed_title</a>";
+ } else {
+ print $feed_title;
+ }
+
+ print "</td>";
+ print "</tr></table>";
+
+ print "<table class=\"headlinesList\" id=\"headlinesList\" width=\"100%\">";
+
+
if ($feed < -10) error_reporting (0);
if (sprintf("%d", $feed) != 0) {
}
$result = db_query($link, "SELECT
- id,title,updated,unread,feed_id,marked,link,last_read,
+ id,title,
+ SUBSTRING(updated,1,16) as updated,
+ unread,feed_id,marked,link,last_read,
SUBSTRING(last_read,1,19) as last_read_noms,
$vfeed_query_part
SUBSTRING(updated,1,19) as updated_noms
$feed_kind = "Tags";
$result = db_query($link, "SELECT
- ttrss_entries.id as id,title,updated,unread,feed_id,
+ ttrss_entries.id as id,title,
+ SUBSTRING(updated,1,16) as updated,
+ unread,feed_id,
marked,link,last_read,
SUBSTRING(last_read,1,19) as last_read_noms,
$vfeed_query_part
// onclick=\"javascript:view($id,$feed_id)\">
print "<td valign='center' align='center'>$update_pic</td>";
+
+ print "<td valign='center' align='center'>
+ <input type=\"checkbox\" onclick=\"toggleSelectRow(this)\"
+ class=\"feedCheckBox\" id=\"RCHK-$id\">
+ </td>";
+
print "<td valign='center' align='center'>$marked_pic</td>";
- print "<td width='25%'>
+ print "<td width='20%'>
<a href=\"javascript:view($id,$feed_id);\">".$line["updated"]."</a></td>";
if ($line["feed_title"]) {
- print "<td width='50%'>$content_link</td>";
+ print "<td width='55%'>$content_link</td>";
print "<td width='20%'>
<a href='javascript:viewfeed($feed_id)'>".$line["feed_title"]."</a></td>";
} else {
- print "<td width='70%'>$content_link</td>";
+ print "<td width='75%'>$content_link</td>";
}
print "</tr>";
print "<script type=\"text/javascript\">
document.onkeydown = hotkey_handler;
- update_label_counters('$feed');
+ update_all_counters('$feed');
</script>";
if ($addheader) {
print "<tr><td class=\"selectPrompt\" colspan=\"8\">
Select:
<a href=\"javascript:selectTableRowsByIdPrefix('prefFeedList',
- 'FEEDR-', true)\">All</a>,
+ 'FEEDR-', 'FRCHK-', true)\">All</a>,
<a href=\"javascript:selectTableRowsByIdPrefix('prefFeedList',
- 'FEEDR-', false)\">None</a>
+ 'FEEDR-', 'FRCHK-', false)\">None</a>
</td</tr>";
print "<tr class=\"title\">
if ($subop == "edit" && $feed_id != $edit_feed_id) {
$class .= "Grayed";
+ $this_row_id = "";
+ } else {
+ $this_row_id = "id=\"FEEDR-$feed_id\"";
}
- print "<tr class=\"$class\" id=\"FEEDR-$feed_id\">";
+ print "<tr class=\"$class\" $this_row_id>";
$icon_file = ICONS_DIR . "/$feed_id.ico";
if (get_pref($link, 'ENABLE_PREFS_CATCHUP_UNCATCHUP')) {
print "
<input type=\"submit\" class=\"button\"
- onclick=\"javascript:readSelectedFeeds()\" value=\"Mark as read\">
+ onclick=\"javascript:readSelectedFeeds(true)\" value=\"Mark as read\">
<input type=\"submit\" class=\"button\"
- onclick=\"javascript:unreadSelectedFeeds()\"
+ onclick=\"javascript:readSelectedFeeds(false)\"
value=\"Mark as unread\"> ";
}
print "<tr><td class=\"selectPrompt\" colspan=\"8\">
Select:
<a href=\"javascript:selectTableRowsByIdPrefix('prefFeedCatList',
- 'FCATR-', true)\">All</a>,
+ 'FCATR-', 'FCCHK-', true)\">All</a>,
<a href=\"javascript:selectTableRowsByIdPrefix('prefFeedCatList',
- 'FCATR-', false)\">None</a>
+ 'FCATR-', 'FCCHK-', false)\">None</a>
</td</tr>";
print "<tr class=\"title\">
if ($subop == "editCat" && $cat_id != $edit_cat_id) {
$class .= "Grayed";
+ $this_row_id = "";
+ } else {
+ $this_row_id = "id=\"FCATR-$cat_id\"";
}
- print "<tr class=\"$class\" id=\"FCATR-$cat_id\">";
+ print "<tr class=\"$class\" $this_row_id>";
$edit_title = htmlspecialchars(db_unescape_string($line["title"]));
print "<tr><td class=\"selectPrompt\" colspan=\"8\">
Select:
<a href=\"javascript:selectTableRowsByIdPrefix('prefFilterList',
- 'FILRR-', true)\">All</a>,
+ 'FILRR-', 'FICHK-', true)\">All</a>,
<a href=\"javascript:selectTableRowsByIdPrefix('prefFilterList',
- 'FILRR-', false)\">None</a>
+ 'FILRR-', 'FICHK-', false)\">None</a>
</td</tr>";
print "<tr class=\"title\">
if ($subop == "edit" && $filter_id != $edit_filter_id) {
$class .= "Grayed";
+ $this_row_id = "";
+ } else {
+ $this_row_id = "id=\"FILRR-$filter_id\"";
}
- print "<tr class=\"$class\" id=\"FILRR-$filter_id\">";
+ print "<tr class=\"$class\" $this_row_id>";
$line["regexp"] = htmlspecialchars($line["reg_exp"]);
$line["description"] = htmlspecialchars($line["description"]);
if ($num_matches > 0) {
- print "<p>Query returned <b>$num_matches</b> matches, first 5:</p>";
+ print "<p>Query returned <b>$num_matches</b> matches, first 5 follow:</p>";
$result = db_query($link,
"SELECT title,
print "<tr><td class=\"selectPrompt\" colspan=\"8\">
Select:
<a href=\"javascript:selectTableRowsByIdPrefix('prefLabelList',
- 'LILRR-', true)\">All</a>,
+ 'LILRR-', 'LICHK-', true)\">All</a>,
<a href=\"javascript:selectTableRowsByIdPrefix('prefLabelList',
- 'LILRR-', false)\">None</a>
+ 'LILRR-', 'LICHK-', false)\">None</a>
</td</tr>";
print "<tr class=\"title\">
<td width=\"5%\">Select</td><td width=\"40%\">SQL expression
- <a class=\"helpLink\" href=\"javascript:popupHelp(1)\">(?)</a>
+ <a class=\"helpLink\" href=\"javascript:displayHelpInfobox(1)\">(?)</a>
</td>
<td width=\"40%\">Caption</td></tr>";
if ($subop == "edit" && $label_id != $edit_label_id) {
$class .= "Grayed";
+ $this_row_id = "";
+ } else {
+ $this_row_id = "id=\"LILRR-$label_id\"";
}
- print "<tr class=\"$class\" id=\"LILRR-$label_id\">";
+ print "<tr class=\"$class\" $this_row_id>";
$line["sql_exp"] = htmlspecialchars($line["sql_exp"]);
$line["description"] = htmlspecialchars($line["description"]);
}
if ($op == "help") {
- print "<html><head>
- <title>Tiny Tiny RSS : Help</title>
- <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">
- <script type=\"text/javascript\" src=\"functions.js\"></script>
- <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
- </head><body>";
+ if (!$_GET["noheaders"]) {
+ print "<html><head>
+ <title>Tiny Tiny RSS : Help</title>
+ <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">
+ <script type=\"text/javascript\" src=\"functions.js\"></script>
+ <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
+ </head><body>";
+ }
$tid = sprintf("%d", $_GET["tid"]);
- /* FIXME this badly needs real implementation */
-
- print "<div class='helpResponse'>";
-
- ?>
-
- <h1>Help for SQL expressions</h1>
-
- <h2>Description</h2>
-
- <p>The «SQL expression» is added to WHERE clause of
- view feed query. You can match on ttrss_entries table fields
- and even use subselect to query additional information. This
- functionality is considered to be advanced and requires basic
- understanding of SQL.</p>
-
- <h2>Examples</h2>
-
- <pre>unread = true</pre>
-
- Matches all unread articles
-
- <pre>title like '%Linux%'</pre>
-
- Matches all articles which mention Linux in the title. You get the idea.
+ print "<div class='infoBoxContents'>";
- <p>See the database schema included in the distribution package for gruesome
- details.</p>
+ if (file_exists("help/$tid.php")) {
+ include("help/$tid.php");
+ } else {
+ print "<p>Help topic not found.</p>";
+ }
- <?
+ print "</div>";
print "<div align='center'>
- <a class=\"helpLink\"
- href=\"javascript:window.close()\">(Close this window)</a></div>";
-
- print "</div>";
+ <input type='submit' class='button'
+ onclick=\"closeInfoBox()\" value=\"Close this window\"></div>";
- print "</body></html>";
+ if (!$_GET["noheaders"]) {
+ print "</body></html>";
+ }
}
$param = $_GET["param"];
if ($id == "quickAddFeed") {
- print "Feed URL: <input
+ print "
+ Feed URL: <input
onblur=\"javascript:enableHotkeys()\" onfocus=\"javascript:disableHotkeys()\"
id=\"qafInput\">
<input class=\"button\"
$f_title = db_fetch_result($result, 0, "title");
- print "Remove current feed ($f_title)?
+ print "Remove current feed (<b>$f_title</b>)?
<input class=\"button\"
type=\"submit\" onclick=\"javascript:qfdDelete($param)\" value=\"Remove\">
<input class=\"button\"
header("Location: prefs.php");
+ } else if ($subop == "Change theme") {
+
+ $theme = db_escape_string($_POST["theme"]);
+
+ if ($theme == "Default") {
+ $theme_qpart = 'NULL';
+ } else {
+ $theme_qpart = "'$theme'";
+ }
+
+ $result = db_query($link, "SELECT id,theme_path FROM ttrss_themes
+ WHERE theme_name = '$theme'");
+
+ if (db_num_rows($result) == 1) {
+ $theme_id = db_fetch_result($result, 0, "id");
+ $theme_path = db_fetch_result($result, 0, "theme_path");
+ } else {
+ $theme_id = "NULL";
+ $theme_path = "";
+ }
+
+ db_query($link, "UPDATE ttrss_users SET
+ theme_id = $theme_id WHERE id = " . $_SESSION["uid"]);
+
+ $_SESSION["theme"] = $theme_path;
+
+ header("Location: prefs.php");
+
} else {
if (!SINGLE_USER_MODE) {
}
+ $result = db_query($link, "SELECT
+ theme_id FROM ttrss_users WHERE id = " . $_SESSION["uid"]);
+
+ $user_theme_id = db_fetch_result($result, 0, "theme_id");
+
+ $result = db_query($link, "SELECT
+ id,theme_name FROM ttrss_themes ORDER BY theme_name");
+
+ if (db_num_rows($result) > 0) {
+
+ print "<form action=\"backend.php\" method=\"POST\">";
+ print "<table width=\"100%\" class=\"prefPrefsList\">";
+ print "<tr><td colspan='3'><h3>Themes</h3></tr></td>";
+ print "<tr><td width=\"40%\">Select theme</td>";
+ print "<td><select name=\"theme\">";
+ print "<option>Default</option>";
+ print "<option disabled>--------</option>";
+
+ while ($line = db_fetch_assoc($result)) {
+ if ($line["id"] == $user_theme_id) {
+ $selected = "selected";
+ } else {
+ $selected = "";
+ }
+ print "<option $selected>" . $line["theme_name"] . "</option>";
+ }
+ print "</select></td></tr>";
+ print "</table>";
+ print "<input type=\"hidden\" name=\"op\" value=\"pref-prefs\">";
+ print "<p><input class=\"button\" type=\"submit\"
+ value=\"Change theme\" name=\"subop\">";
+ print "</form>";
+ }
+
$result = db_query($link, "SELECT
ttrss_user_prefs.pref_name,short_desc,help_text,value,type_name,
section_name,def_value
print "<tr><td class=\"selectPrompt\" colspan=\"8\">
Select:
<a href=\"javascript:selectTableRowsByIdPrefix('prefUserList',
- 'UMRR-', true)\">All</a>,
+ 'UMRR-', 'UMCHK-', true)\">All</a>,
<a href=\"javascript:selectTableRowsByIdPrefix('prefUserList',
- 'UMRR-', false)\">None</a>
+ 'UMRR-', 'UMCHK-', false)\">None</a>
</td</tr>";
print "<tr class=\"title\">
if ($uid == $_SESSION["uid"] || ($subop == "edit" && $uid != $edit_uid)) {
$class .= "Grayed";
- }
-
- print "<tr class=\"$class\" id=\"UMRR-$uid\">";
+ $this_row_id = "";
+ } else {
+ $this_row_id = "id=\"UMRR-$uid\"";
+ }
+
+ print "<tr class=\"$class\" $this_row_id>";
$line["login"] = htmlspecialchars($line["login"]);