$quiet = $_REQUEST["quiet"];
if ($subop == "massSubscribe") {
- $ids = split(",", db_escape_string($_GET["ids"]));
+ $ids = split(",", db_escape_string($_REQUEST["ids"]));
$subscribed = array();
return;
}
- print "<div id=\"infoBoxTitle\">".__('Other feeds: Top 25')."</div>";
+ print "<div id=\"infoBoxTitle\">".__('Feed Browser')."</div>";
print "<div class=\"infoBoxContents\">";
- print "<p>".__("Showing top 25 registered feeds, sorted by popularity:")."</p>";
+ $browser_search = db_escape_string($_REQUEST["search"]);
- $owner_uid = $_SESSION["uid"];
-
- $result = db_query($link, "SELECT feed_url,COUNT(id) AS subscribers
- FROM ttrss_feeds WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
- WHERE tf.feed_url = ttrss_feeds.feed_url
- AND owner_uid = '$owner_uid') GROUP BY feed_url
- ORDER BY subscribers DESC LIMIT 25");
-
- print "<ul class='browseFeedList' id='browseFeedList'>";
+ //print "<p>".__("Showing top 25 registered feeds, sorted by popularity:")."</p>";
- $feedctr = 0;
-
- while ($line = db_fetch_assoc($result)) {
- $feed_url = $line["feed_url"];
- $subscribers = $line["subscribers"];
+ print "
+ <div style='float : right'>
+ <img style='display : none'
+ id='feed_browser_spinner' src='images/indicator_white.gif'>
+ <input id=\"feed_browser_search\" size=\"20\" type=\"search\"
+ onfocus=\"javascript:disableHotkeys();\"
+ onblur=\"javascript:enableHotkeys();\"
+ onchange=\"javascript:updateFeedBrowser()\" value=\"$browser_search\">
+ <input type=\"submit\" class=\"button\"
+ onclick=\"javascript:updateFeedBrowser()\" value=\"".__('Search')."\">
+ </div>";
- $det_result = db_query($link, "SELECT site_url,title,id
- FROM ttrss_feeds WHERE feed_url = '$feed_url' LIMIT 1");
+ print __('Top')." <select id=\"feed_browser_limit\">";
- $details = db_fetch_assoc($det_result);
+ foreach (array(25, 50, 100, 200) as $l) {
+ $issel = ($l == $limit) ? "selected" : "";
+ print "<option $issel>$l</option>";
+ }
- $icon_file = ICONS_DIR . "/" . $details["id"] . ".ico";
+ print "</select>
+ <input type=\"submit\" class=\"button\"
+ onclick=\"updateFeedBrowser()\" value=\"".__('Show')."\">";
- if (file_exists($icon_file) && filesize($icon_file) > 0) {
- $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL .
- "/".$details["id"].".ico\">";
- } else {
- $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
- }
-
- $check_box = "<input onclick='toggleSelectListRow(this)' class='feedBrowseCB'
- type=\"checkbox\" id=\"FBCHK-" . $details["id"] . "\">";
-
- $class = ($feedctr % 2) ? "even" : "odd";
-
- print "<li class='$class' id=\"FBROW-".$details["id"]."\">$check_box".
- "$feed_icon " . $details["title"] .
- " <span class='subscribers'>($subscribers)</span></li>";
-
- ++$feedctr;
- }
+ print "<p>";
- if ($feedctr == 0) {
- print "<li style=\"text-align : center\"><p>".__('No feeds found.')."</p></li>";
- $subscribe_btn_disabled = "disabled";
- } else {
- $subscribe_btn_disabled = "";
- }
+ $owner_uid = $_SESSION["uid"];
+ print "<ul class='browseFeedList' id='browseFeedList'>";
+ $subscribe_btn_disabled = print_feed_browser($link, $search, 25) == 0 ? "disabled" : "";
print "</ul>";
print "<div align='center'>
- <input type=\"submit\" class=\"button\"
+ <input type=\"submit\" class=\"button\" id=\"feed_browser_subscribe\"
$subscribe_btn_disabled
onclick=\"feedBrowserSubscribe()\" value=\"".__('Subscribe')."\">
<input type='submit' class='button'
} else {
$is_selected = "";
}
+
+ $linked_title = truncate_string(htmlspecialchars($tmp_line["title"]), 40);
+
printf("<option $is_selected value='%d'>%s</option>",
- $tmp_line["id"], $tmp_line["title"]);
+ $tmp_line["id"], $linked_title);
}
print "</select>";
print_select_hash("update_method", $update_method, $update_methods);
}
- /* Purge intl */
+ $purge_interval = db_fetch_result($result, 0, "purge_interval");
- print "<br/>";
+ if (FORCE_ARTICLE_PURGE == 0) {
- $purge_interval = db_fetch_result($result, 0, "purge_interval");
+ /* Purge intl */
+
+ print "<br/>";
+
+ print __('Article purging:') . " ";
- print __('Article purging:') . " ";
+ print_select_hash("purge_interval", $purge_interval, $purge_intervals);
- print_select_hash("purge_interval", $purge_interval, $purge_intervals);
+ } else {
+ print "<input type='hidden' name='purge_interval' value='$purge_interval'>";
+
+ }
print "</div>";
print "<div class=\"dlgSec\">".__("Authentication")."</div>";
$auth_login = htmlspecialchars(db_fetch_result($result, 0, "auth_login"));
- print __('Login:') . " ";
+ print "<table>";
+
+ print "<tr><td>" . __('Login:') . "</td><td>";
+
print "<input size=\"20\" onkeypress=\"return filterCR(event, feedEditSave)\"
name=\"auth_login\" value=\"$auth_login\">";
- print " " . __("Password:") . " ";
+ print "</tr><tr><td>" . __("Password:") . "</td><td>";
$auth_pass = htmlspecialchars(db_fetch_result($result, 0, "auth_pass"));
onkeypress=\"return filterCR(event, feedEditSave)\"
value=\"$auth_pass\">";
+ print "</td></tr></table>";
+
print "</div>";
print "<div class=\"dlgSec\">".__("Options")."</div>";
print "<div class=\"dlgSecCont\">";
name=\"include_in_digest\"
$checked> <label for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
+
+ $always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures"));
+
+ if ($always_display_enclosures) {
+ $checked = "checked";
+ } else {
+ $checked = "";
+ }
+
+ print "<br/><input type=\"checkbox\" id=\"always_display_enclosures\"
+ name=\"always_display_enclosures\"
+ $checked> <label for=\"always_display_enclosures\">".__('Always display image attachments')."</label>";
+
+
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
if ($cache_images) {
/* Purge intl */
- print "<br/>";
+ if (FORCE_ARTICLE_PURGE != 0) {
- print __('Article purging:') . " ";
+ print "<br/>";
- print_select_hash("purge_interval", $purge_interval, $purge_intervals,
- "disabled");
+ print __('Article purging:') . " ";
- batch_edit_cbox("purge_interval");
+ print_select_hash("purge_interval", $purge_interval, $purge_intervals,
+ "disabled");
+
+ batch_edit_cbox("purge_interval");
+ }
print "</div>";
print "<div class=\"dlgSec\">".__("Authentication")."</div>";
print " "; batch_edit_cbox("include_in_digest", "include_in_digest_l");
+ print "<br/><input disabled type=\"checkbox\" id=\"always_display_enclosures\"
+ name=\"always_display_enclosures\"
+ $checked> <label id=\"always_display_enclosures_l\" class='insensitive' for=\"always_display_enclosures\">".__('Always display image attachments')."</label>";
+
+ print " "; batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l");
+
print "<br/><input disabled type=\"checkbox\" id=\"cache_images\"
name=\"cache_images\"
$checked> <label class='insensitive' id=\"cache_images_l\"
db_escape_string($_POST["cache_images"]));
$update_method = (int) db_escape_string($_POST["update_method"]);
+ $always_display_enclosures = checkbox_to_sql_bool(
+ db_escape_string($_POST["always_display_enclosures"]));
+
if (get_pref($link, 'ENABLE_FEED_CATS')) {
if ($cat_id && $cat_id != 0) {
$category_qpart = "cat_id = '$cat_id',";
hidden = $hidden,
$cache_images_qpart
include_in_digest = $include_in_digest,
+ always_display_enclosures = $always_display_enclosures,
update_method = '$update_method'
WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
$qpart = "include_in_digest = '$include_in_digest'";
break;
+ case "always_display_enclosures":
+ $qpart = "always_display_enclosures = '$always_display_enclosures'";
+ break;
+
case "cache_images":
$qpart = "cache_images = '$cache_images'";
break;
if ($subop == "remove") {
- if (!WEB_DEMO_MODE) {
-
- $ids = split(",", db_escape_string($_GET["ids"]));
+ $ids = split(",", db_escape_string($_REQUEST["ids"]));
- foreach ($ids as $id) {
-
- if ($id > 0) {
-
- db_query($link, "DELETE FROM ttrss_feeds
- WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]);
-
- $icons_dir = ICONS_DIR;
-
- if (file_exists($icons_dir . "/$id.ico")) {
- unlink($icons_dir . "/$id.ico");
- }
- } else if ($id < -10) {
-
- $label_id = -$id - 11;
-
- db_query($link, "DELETE FROM ttrss_labels
- WHERE id = '$label_id' AND owner_uid = " . $_SESSION["uid"]);
- }
- }
+ foreach ($ids as $id) {
+ remove_feed($link, $id, $_SESSION["uid"]);
}
}
if ($subop == "clear") {
- $id = db_escape_string($_GET["id"]);
+ $id = db_escape_string($_REQUEST["id"]);
clear_feed_articles($link, $id);
}
if ($subop == "rescore") {
- $ids = split(",", db_escape_string($_GET["ids"]));
+ $ids = split(",", db_escape_string($_REQUEST["ids"]));
foreach ($ids as $id) {
if ($p_from != 'tt-rss') {
print "<html>
<head>
- <title>Tiny Tiny RSS - Subscribe to feed...</title>
- <link rel=\"stylesheet\" type=\"text/css\" href=\"quicksub.css\">
+ <title>Tiny Tiny RSS</title>
+ <link rel=\"stylesheet\" type=\"text/css\" href=\"utility.css\">
</head>
<body>
- <img class=\"logo\" src=\"images/ttrss_logo.png\"
+ <img class=\"floatingLogo\" src=\"images/ttrss_logo.png\"
alt=\"Tiny Tiny RSS\"/>
- <h1>Subscribe to feed...</h1>
- <div class=\"content\">";
+ <h1>Subscribe to feed...</h1>";
}
if (subscribe_to_feed($link, $feed_url, $cat_id, $auth_login, $auth_pass)) {
$tp_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\.php.*$/', 'prefs.php', $_SERVER["REQUEST_URI"]);
- print "<p><a href='$tt_uri'>Return to Tiny Tiny RSS</a> |";
-
$result = db_query($link, "SELECT id FROM ttrss_feeds WHERE
feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]);
$feed_id = db_fetch_result($result, 0, "id");
+ print "<p>";
+
if ($feed_id) {
- print "<a href='$tp_uri?tab=feedConfig&subop=editFeed:$feed_id'>
- Edit subscription options</a> | ";
+ print "<form method=\"GET\" style='display: inline'
+ action=\"$tp_uri\">
+ <input type=\"hidden\" name=\"tab\" value=\"feedConfig\">
+ <input type=\"hidden\" name=\"subop\" value=\"editFeed\">
+ <input type=\"hidden\" name=\"subopparam\" value=\"$feed_id\">
+ <input type=\"submit\" value=\"".__("Edit subscription options")."\">
+ </form>";
}
- print "<a href='javascript:window.close()'>Close this window</a>.</p>";
+ print "<form style='display: inline' method=\"GET\" action=\"$tt_uri\">
+ <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+ </form></p>";
- print "</div></body></html>";
+ print "</body></html>";
return;
}
if (!WEB_DEMO_MODE) {
- $ids = split(",", db_escape_string($_GET["ids"]));
+ $ids = split(",", db_escape_string($_REQUEST["ids"]));
- $cat_id = db_escape_string($_GET["cat_id"]);
+ $cat_id = db_escape_string($_REQUEST["cat_id"]);
if ($cat_id == 0) {
$cat_id_qpart = 'NULL';
if ($action == "save") {
$cat_title = db_escape_string(trim($_REQUEST["value"]));
- $cat_id = db_escape_string($_GET["cid"]);
-
- $result = db_query($link, "UPDATE ttrss_feed_categories SET
- title = '$cat_title' WHERE id = '$cat_id' AND owner_uid = ".$_SESSION["uid"]);
+ $cat_id = db_escape_string($_REQUEST["cid"]);
+
+ db_query($link, "BEGIN");
+
+ $result = db_query($link, "SELECT title FROM ttrss_feed_categories
+ WHERE id = '$cat_id' AND owner_uid = ".$_SESSION["uid"]);
+
+ if (db_num_rows($result) == 1) {
+
+ $old_title = db_fetch_result($result, 0, "title");
+
+ if ($cat_title != "") {
+ $result = db_query($link, "UPDATE ttrss_feed_categories SET
+ title = '$cat_title' WHERE id = '$cat_id' AND
+ owner_uid = ".$_SESSION["uid"]);
+
+ print $cat_title;
+ } else {
+ print $old_title;
+ }
+ } else {
+ print $_REQUEST["value"];
+ }
- print $_REQUEST["value"];
+ db_query($link, "COMMIT");
return;
if (!WEB_DEMO_MODE) {
- $feed_cat = db_escape_string(trim($_GET["cat"]));
+ $feed_cat = db_escape_string(trim($_REQUEST["cat"]));
$result = db_query($link,
"SELECT id FROM ttrss_feed_categories
if ($action == "remove") {
- if (!WEB_DEMO_MODE) {
-
- $ids = split(",", db_escape_string($_GET["ids"]));
-
- foreach ($ids as $id) {
+ $ids = split(",", db_escape_string($_REQUEST["ids"]));
- db_query($link, "BEGIN");
-
- $result = db_query($link,
- "SELECT count(id) as num_feeds FROM ttrss_feeds
- WHERE cat_id = '$id'");
-
- $num_feeds = db_fetch_result($result, 0, "num_feeds");
-
- if ($num_feeds == 0) {
- db_query($link, "DELETE FROM ttrss_feed_categories
- WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]);
- } else {
-
- print format_warning(__("Unable to delete non empty feed categories."));
-
- }
-
- db_query($link, "COMMIT");
- }
+ foreach ($ids as $id) {
+ remove_feed_category($link, $id, $_SESSION["uid"]);
}
}
__('Some feeds have update errors (click for details)')."</a>");
}
- $feed_search = db_escape_string($_GET["search"]);
+ $feed_search = db_escape_string($_REQUEST["search"]);
- if (array_key_exists("search", $_GET)) {
+ if (array_key_exists("search", $_REQUEST)) {
$_SESSION["prefs_feed_search"] = $feed_search;
} else {
$feed_search = $_SESSION["prefs_feed_search"];
if (ENABLE_FEED_BROWSER && !SINGLE_USER_MODE) {
print " <input type=\"submit\" class=\"button\"
id=\"top25_feeds_btn\"
- onclick=\"javascript:browseFeeds()\" value=\"".__('Top 25')."\">";
+ onclick=\"javascript:browseFeeds()\" value=\"".__('More Feeds')."\">";
}
- $feeds_sort = db_escape_string($_GET["sort"]);
+ $feeds_sort = db_escape_string($_REQUEST["sort"]);
if (!$feeds_sort || $feeds_sort == "undefined") {
$feeds_sort = $_SESSION["pref_sort_feeds"];
$_SESSION["pref_sort_feeds"] = $feeds_sort;
if ($feed_search) {
- $search_qpart = "(UPPER(F1.title) LIKE UPPER('%$feed_search%') OR
- UPPER(F1.feed_url) LIKE UPPER('%$feed_search%')) AND";
+
+ $feed_search = split(" ", $feed_search);
+ $tokens = array();
+
+ foreach ($feed_search as $token) {
+
+ $token = trim($token);
+
+ array_push($tokens, "(UPPER(F1.title) LIKE UPPER('%$token%') OR
+ UPPER(C1.title) LIKE UPPER('%$token%') OR
+ UPPER(F1.feed_url) LIKE UPPER('%$token%'))");
+ }
+
+ $search_qpart = "(" . join($tokens, " AND ") . ") AND ";
+
} else {
$search_qpart = "";
}
$show_last_article_checked = "";
$show_last_article_qpart = "";
- if ($_GET["slat"] == "true") {
+ if ($_REQUEST["slat"] == "true") {
$show_last_article_info = true;
$show_last_article_checked = "checked";
$show_last_article_qpart = ", (SELECT ".SUBSTRING_FOR_DATE."(MAX(updated),1,16) FROM ttrss_user_entries,
}
if ($hidden) {
- $edit_title = "<span class=\"insensitive\">$edit_title (Hidden)</span>";
+ $edit_title = "<span class=\"insensitive\">$edit_title ".
+ __('(Hidden)')."</span>";
$last_updated = "<span class=\"insensitive\">$last_updated</span>";
$last_article = "<span class=\"insensitive\">$last_article</span>";
}
$parent_title = $line["parent_title"];
if ($parent_title) {
- $parent_title = "<span class='groupPrompt'>(linked to
- $parent_title)</span>";
+ $linked_to = sprintf(__("(linked to %s)"), $parent_title);
+ $parent_title = "<span class='groupPrompt'>$linked_to</span>";
}
print "<td $onclick>" . "$edit_title $parent_title" . "</td>";
print "<select id=\"feedActionChooser\" onchange=\"feedActionChange()\">
<option value=\"facDefault\" selected>".__('Actions...')."</option>
- <option disabled>--------</option>
- <option style=\"color : #5050aa\" disabled>".__('Selection:')."</option>
- <option value=\"facEdit\"> ".__('Edit')."</option>
- <option value=\"facPurge\"> ".__('Manual purge')."</option>
- <option value=\"facClear\"> ".__('Clear feed data')."</option>
- <option value=\"facRescore\"> ".__('Rescore articles')."</option>
- <option value=\"facUnsubscribe\"> ".__('Unsubscribe')."</option>";
+ <optgroup label=\"".__('Selection:')."\">
+ <option value=\"facEdit\">".__('Edit')."</option>";
+
+ if (FORCE_ARTICLE_PURGE == 0) {
+ print
+ "<option value=\"facPurge\">".__('Manual purge')."</option>";
+ }
+
+ print "
+ <option value=\"facClear\">".__('Clear feed data')."</option>
+ <option value=\"facRescore\">".__('Rescore articles')."</option>
+ <option value=\"facUnsubscribe\">".__('Unsubscribe')."</option>";
+
+ print "</optgroup>";
if (get_pref($link, 'ENABLE_FEED_CATS')) {
- print "<option disabled>--------</option>
- <option style=\"color : #5050aa\" disabled>".__('Other:')."</option>
- <option value=\"facEditCats\"> ".__('Edit categories')."
- </option>";
+ print "<optgroup label=\"".__('Other:')."\">
+ <option value=\"facEditCats\">".__('Edit categories')."
+ </option>
+ </optgroup>";
+
}
print "</select>";
+ } else {
+
+ print "<p>";
+
+ if (!$feed_search) {
+ print_warning(__("You don't have any subscribed feeds."));
+ } else {
+ print_warning(__('No matching feeds found.'));
+ }
+ print "</p>";
+
}
print "<h3>".__('OPML')."</h3>
print "</p>";
}
+
+ function print_feed_browser($link, $search, $limit) {
+
+ $owner_uid = $_SESSION["uid"];
+
+ if ($search) {
+ $search_qpart = "AND (UPPER(feed_url) LIKE UPPER('%$search%') OR
+ UPPER(title) LIKE UPPER('%$search%'))";
+ } else {
+ $search_qpart = "";
+ }
+
+ $result = db_query($link, "SELECT feed_url, subscribers FROM
+ ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
+ WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url
+ AND owner_uid = '$owner_uid') $search_qpart
+ ORDER BY subscribers DESC LIMIT $limit");
+
+ $feedctr = 0;
+
+ while ($line = db_fetch_assoc($result)) {
+ $feed_url = $line["feed_url"];
+ $subscribers = $line["subscribers"];
+
+ $det_result = db_query($link, "SELECT site_url,title,id
+ FROM ttrss_feeds WHERE feed_url = '$feed_url' LIMIT 1");
+
+ $details = db_fetch_assoc($det_result);
+
+ $icon_file = ICONS_DIR . "/" . $details["id"] . ".ico";
+
+ if (file_exists($icon_file) && filesize($icon_file) > 0) {
+ $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL .
+ "/".$details["id"].".ico\">";
+ } else {
+ $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
+ }
+
+ $check_box = "<input onclick='toggleSelectListRow(this)' class='feedBrowseCB'
+ type=\"checkbox\" id=\"FBCHK-" . $details["id"] . "\">";
+
+ $class = ($feedctr % 2) ? "even" : "odd";
+
+ if ($details["site_url"]) {
+ $site_url = "<a target=\"_blank\" href=\"".$details["site_url"]."\">
+ <img style='border-width : 0px' src='images/www.png' alt='www'></a>";
+ } else {
+ $site_url = "";
+ }
+
+ print "<li class='$class' id=\"FBROW-".$details["id"]."\">$check_box".
+ "$feed_icon " . $details["title"] .
+ " <span class='subscribers'>($subscribers)</span>
+ $site_url
+ </li>";
+
+ ++$feedctr;
+ }
+
+ if ($feedctr == 0) {
+ print "<li style=\"text-align : center\"><p>".__('No feeds found.')."</p></li>";
+ }
+
+ return $feedctr;
+
+ }
?>