"; } function module_pref_feeds($link) { global $update_intervals; global $purge_intervals; global $update_methods; $subop = $_REQUEST["subop"]; $quiet = $_REQUEST["quiet"]; if ($subop == "massSubscribe") { $ids = split(",", db_escape_string($_GET["ids"])); $subscribed = array(); foreach ($ids as $id) { $result = db_query($link, "SELECT feed_url,title FROM ttrss_feeds WHERE id = '$id'"); $feed_url = db_escape_string(db_fetch_result($result, 0, "feed_url")); $title = db_escape_string(db_fetch_result($result, 0, "title")); $title_orig = db_fetch_result($result, 0, "title"); $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) == 0) { $result = db_query($link, "INSERT INTO ttrss_feeds (owner_uid,feed_url,title,cat_id) VALUES ('".$_SESSION["uid"]."', '$feed_url', '$title', NULL)"); array_push($subscribed, $title_orig); } } if (count($subscribed) > 0) { $msg = "".__('Subscribed to feeds:')."". ""; print format_notice($msg); } } if ($subop == "browse") { if (!ENABLE_FEED_BROWSER) { print __("Feed browser is administratively disabled."); return; } print "
".__('Feed Browser')."
"; print "
"; $browser_search = db_escape_string($_GET["search"]); //print "

".__("Showing top 25 registered feeds, sorted by popularity:")."

"; print "
"; print __('Top')." "; print "

"; $owner_uid = $_SESSION["uid"]; print "

"; print "
"; print "
"; return; } if ($subop == "editfeed") { $feed_id = db_escape_string($_REQUEST["id"]); $result = db_query($link, "SELECT * FROM ttrss_feeds WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]); $title = htmlspecialchars(db_fetch_result($result, 0, "title")); $icon_file = ICONS_DIR . "/$feed_id.ico"; if (file_exists($icon_file) && filesize($icon_file) > 0) { $feed_icon = ""; } else { $feed_icon = ""; } print "
".__('Feed Editor')."
"; print "
"; print "
"; print ""; print ""; print ""; print "
".__("Feed")."
"; print "
"; /* Title */ print ""; /* Feed URL */ $feed_url = db_fetch_result($result, 0, "feed_url"); $feed_url = htmlspecialchars(db_fetch_result($result, 0, "feed_url")); print "
"; print __('URL:') . " "; print ""; /* Category */ if (get_pref($link, 'ENABLE_FEED_CATS')) { $cat_id = db_fetch_result($result, 0, "cat_id"); print "
"; print __('Place in category:') . " "; $parent_feed = db_fetch_result($result, 0, "parent_feed"); if (sprintf("%d", $parent_feed) > 0) { $disabled = "disabled"; } else { $disabled = ""; } print_feed_cat_select($link, "cat_id", $cat_id, $disabled); } /* Link to */ print "
"; print __('Link to feed:') . " "; $tmp_result = db_query($link, "SELECT COUNT(id) AS count FROM ttrss_feeds WHERE parent_feed = '$feed_id'"); $linked_count = db_fetch_result($tmp_result, 0, "count"); $parent_feed = db_fetch_result($result, 0, "parent_feed"); if ($linked_count > 0) { $disabled = "disabled"; } else { $disabled = ""; } print ""; print "
"; print "
".__("Update")."
"; print "
"; /* Update Interval */ $update_interval = db_fetch_result($result, 0, "update_interval"); print_select_hash("update_interval", $update_interval, $update_intervals); /* Update method */ if (ALLOW_SELECT_UPDATE_METHOD) { $update_method = db_fetch_result($result, 0, "update_method"); print " " . __('using') . " "; print_select_hash("update_method", $update_method, $update_methods); } $purge_interval = db_fetch_result($result, 0, "purge_interval"); if (FORCE_ARTICLE_PURGE == 0) { /* Purge intl */ print "
"; print __('Article purging:') . " "; print_select_hash("purge_interval", $purge_interval, $purge_intervals); } else { print ""; } print "
"; print "
".__("Authentication")."
"; print "
"; $auth_login = htmlspecialchars(db_fetch_result($result, 0, "auth_login")); print ""; print "
" . __('Login:') . ""; print ""; print "
" . __("Password:") . ""; $auth_pass = htmlspecialchars(db_fetch_result($result, 0, "auth_pass")); print ""; print "
"; print "
"; print "
".__("Options")."
"; print "
"; print "
"; $private = sql_bool_to_bool(db_fetch_result($result, 0, "private")); if ($private) { $checked = "checked"; } else { $checked = ""; } print " "; $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content")); if ($rtl_content) { $checked = "checked"; } else { $checked = ""; } print "
 "; $hidden = sql_bool_to_bool(db_fetch_result($result, 0, "hidden")); if ($hidden) { $checked = "checked"; } else { $checked = ""; } print "
 "; $include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest")); if ($include_in_digest) { $checked = "checked"; } else { $checked = ""; } print "
 "; $always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures")); if ($always_display_enclosures) { $checked = "checked"; } else { $checked = ""; } print "
 "; $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images")); if ($cache_images) { $checked = "checked"; } else { $checked = ""; } if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { $disabled = ""; $label_class = ""; } else { $disabled = "disabled"; $label_class = "class='insensitive'"; } print "
 "; print "
"; print "
"; print "
"; $title = htmlspecialchars($title, ENT_QUOTES); print "
"; return; } if ($subop == "editfeeds") { $feed_ids = db_escape_string($_REQUEST["ids"]); print "
".__('Multiple Feed Editor')."
"; print "
"; print "
"; print ""; print ""; print ""; print "
".__("Feed")."
"; print "
"; /* Title */ print ""; batch_edit_cbox("title"); /* Feed URL */ print "
"; print __('URL:') . " "; print ""; batch_edit_cbox("feed_url"); /* Category */ if (get_pref($link, 'ENABLE_FEED_CATS')) { print "
"; print __('Place in category:') . " "; print_feed_cat_select($link, "cat_id", $cat_id, "disabled"); batch_edit_cbox("cat_id"); } print "
"; print "
".__("Update")."
"; print "
"; /* Update Interval */ print_select_hash("update_interval", $update_interval, $update_intervals, "disabled"); batch_edit_cbox("update_interval"); /* Update method */ if (ALLOW_SELECT_UPDATE_METHOD) { print " " . __('using') . " "; print_select_hash("update_method", $update_method, $update_methods, "disabled"); batch_edit_cbox("update_method"); } /* Purge intl */ if (FORCE_ARTICLE_PURGE != 0) { print "
"; print __('Article purging:') . " "; print_select_hash("purge_interval", $purge_interval, $purge_intervals, "disabled"); batch_edit_cbox("purge_interval"); } print "
"; print "
".__("Authentication")."
"; print "
"; print __('Login:') . " "; print ""; batch_edit_cbox("auth_login"); print " " . __("Password:") . " "; print ""; batch_edit_cbox("auth_pass"); print "
"; print "
".__("Options")."
"; print "
"; print "
"; print " "; print " "; batch_edit_cbox("private", "private_l"); print "
 "; print " "; batch_edit_cbox("rtl_content", "rtl_content_l"); print "
 "; print " "; batch_edit_cbox("hidden", "hidden_l"); print "
 "; print " "; batch_edit_cbox("include_in_digest", "include_in_digest_l"); print "
 "; print " "; batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l"); print "
 "; if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { print " "; batch_edit_cbox("cache_images", "cache_images_l"); } print "
"; print "
"; print "
"; print "
"; return; } if ($subop == "editSave" || $subop == "batchEditSave") { $feed_title = db_escape_string(trim($_POST["title"])); $feed_link = db_escape_string(trim($_POST["feed_url"])); $upd_intl = db_escape_string($_POST["update_interval"]); $purge_intl = db_escape_string($_POST["purge_interval"]); $feed_id = db_escape_string($_POST["id"]); /* editSave */ $feed_ids = db_escape_string($_POST["ids"]); /* batchEditSave */ $cat_id = db_escape_string($_POST["cat_id"]); $auth_login = db_escape_string(trim($_POST["auth_login"])); $auth_pass = db_escape_string(trim($_POST["auth_pass"])); $parent_feed = db_escape_string($_POST["parent_feed"]); $private = checkbox_to_sql_bool(db_escape_string($_POST["private"])); $rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"])); $hidden = checkbox_to_sql_bool(db_escape_string($_POST["hidden"])); $include_in_digest = checkbox_to_sql_bool( db_escape_string($_POST["include_in_digest"])); $cache_images = checkbox_to_sql_bool( 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',"; $category_qpart_nocomma = "cat_id = '$cat_id'"; } else { $category_qpart = 'cat_id = NULL,'; $category_qpart_nocomma = 'cat_id = NULL'; } } else { $category_qpart = ""; $category_qpart_nocomma = ""; } if ($parent_feed && $parent_feed != 0) { $parent_qpart = "parent_feed = '$parent_feed'"; } else { $parent_qpart = 'parent_feed = NULL'; } if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { $cache_images_qpart = "cache_images = $cache_images,"; } else { $cache_images_qpart = ""; } if ($subop == "editSave") { $result = db_query($link, "UPDATE ttrss_feeds SET $category_qpart $parent_qpart, title = '$feed_title', feed_url = '$feed_link', update_interval = '$upd_intl', purge_interval = '$purge_intl', auth_login = '$auth_login', auth_pass = '$auth_pass', private = $private, rtl_content = $rtl_content, 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"]); if (get_pref($link, 'ENABLE_FEED_CATS')) { # update linked feed categories $result = db_query($link, "UPDATE ttrss_feeds SET $category_qpart_nocomma WHERE parent_feed = '$feed_id' AND owner_uid = " . $_SESSION["uid"]); } } else if ($subop == "batchEditSave") { $feed_data = array(); foreach (array_keys($_POST) as $k) { if ($k != "op" && $k != "subop" && $k != "ids") { $feed_data[$k] = $_POST[$k]; } } db_query($link, "BEGIN"); foreach (array_keys($feed_data) as $k) { $qpart = ""; switch ($k) { case "title": $qpart = "title = '$feed_title'"; break; case "feed_url": $qpart = "feed_url = '$feed_link'"; break; case "update_interval": $qpart = "update_interval = '$upd_intl'"; break; case "purge_interval": $qpart = "purge_interval = '$purge_intl'"; break; case "auth_login": $qpart = "auth_login = '$auth_login'"; break; case "auth_pass": $qpart = "auth_pass = '$auth_pass'"; break; case "private": $qpart = "private = '$private'"; break; case "hidden": $qpart = "hidden = '$hidden'"; break; case "include_in_digest": $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; case "rtl_content": $qpart = "rtl_content = '$rtl_content'"; break; case "update_method": $qpart = "update_method = '$update_method'"; break; case "cat_id": $qpart = $category_qpart_nocomma; break; } if ($qpart) { db_query($link, "UPDATE ttrss_feeds SET $qpart WHERE id IN ($feed_ids) AND owner_uid = " . $_SESSION["uid"]); print "
"; } } db_query($link, "COMMIT"); } } if ($subop == "remove") { $ids = split(",", db_escape_string($_GET["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"); } ccache_remove($link, $id, $_SESSION["uid"]); } else { label_remove($link, -11-$id, $_SESSION["uid"]); ccache_remove($link, -11-$id, $_SESSION["uid"]); } } } if ($subop == "clear") { $id = db_escape_string($_GET["id"]); clear_feed_articles($link, $id); } if ($subop == "rescore") { $ids = split(",", db_escape_string($_GET["ids"])); foreach ($ids as $id) { $filters = load_filters($link, $id, $_SESSION["uid"], 6); $result = db_query($link, "SELECT title, content, link, ref_id FROM ttrss_user_entries, ttrss_entries WHERE ref_id = id AND feed_id = '$id' AND owner_uid = " .$_SESSION['uid']." "); $scores = array(); while ($line = db_fetch_assoc($result)) { $article_filters = get_article_filters($filters, $line['title'], $line['content'], $line['link']); $new_score = calculate_article_score($article_filters); if (!$scores[$new_score]) $scores[$new_score] = array(); array_push($scores[$new_score], $line['ref_id']); } foreach (array_keys($scores) as $s) { if ($s > 1000) { db_query($link, "UPDATE ttrss_user_entries SET score = '$s', marked = true WHERE ref_id IN (" . join(',', $scores[$s]) . ")"); } else if ($s < -500) { db_query($link, "UPDATE ttrss_user_entries SET score = '$s', unread = false WHERE ref_id IN (" . join(',', $scores[$s]) . ")"); } else { db_query($link, "UPDATE ttrss_user_entries SET score = '$s' WHERE ref_id IN (" . join(',', $scores[$s]) . ")"); } } } print __("All done."); } if ($subop == "rescoreAll") { $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']); while ($feed_line = db_fetch_assoc($result)) { $id = $feed_line["id"]; $filters = load_filters($link, $id, $_SESSION["uid"], 6); $tmp_result = db_query($link, "SELECT title, content, link, ref_id FROM ttrss_user_entries, ttrss_entries WHERE ref_id = id AND feed_id = '$id' AND owner_uid = " .$_SESSION['uid']." "); $scores = array(); while ($line = db_fetch_assoc($tmp_result)) { $article_filters = get_article_filters($filters, $line['title'], $line['content'], $line['link']); $new_score = calculate_article_score($article_filters); if (!$scores[$new_score]) $scores[$new_score] = array(); array_push($scores[$new_score], $line['ref_id']); } foreach (array_keys($scores) as $s) { if ($s > 1000) { db_query($link, "UPDATE ttrss_user_entries SET score = '$s', marked = true WHERE ref_id IN (" . join(',', $scores[$s]) . ")"); } else { db_query($link, "UPDATE ttrss_user_entries SET score = '$s' WHERE ref_id IN (" . join(',', $scores[$s]) . ")"); } } } print __("All done."); } if ($subop == "add") { if (!WEB_DEMO_MODE) { $feed_url = db_escape_string(trim($_REQUEST["feed_url"])); $cat_id = db_escape_string($_REQUEST["cat_id"]); $p_from = db_escape_string($_REQUEST["from"]); /* only read authentication information from POST */ $auth_login = db_escape_string(trim($_POST["auth_login"])); $auth_pass = db_escape_string(trim($_POST["auth_pass"])); if ($p_from != 'tt-rss') { print " Tiny Tiny RSS \"Tiny

Subscribe to feed...

"; } if (subscribe_to_feed($link, $feed_url, $cat_id, $auth_login, $auth_pass)) { print_notice(T_sprintf("Subscribed to %s.", $feed_url)); } else { print_warning(T_sprintf("Already subscribed to %s.", $feed_url)); } if ($p_from != 'tt-rss') { $tt_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\.php.*$/', 'tt-rss.php', $_SERVER["REQUEST_URI"]); $tp_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\.php.*$/', 'prefs.php', $_SERVER["REQUEST_URI"]); $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 "

"; if ($feed_id) { print "

"; } print "

"; print ""; return; } } } if ($subop == "categorize") { if (!WEB_DEMO_MODE) { $ids = split(",", db_escape_string($_GET["ids"])); $cat_id = db_escape_string($_GET["cat_id"]); if ($cat_id == 0) { $cat_id_qpart = 'NULL'; } else { $cat_id_qpart = "'$cat_id'"; } db_query($link, "BEGIN"); foreach ($ids as $id) { db_query($link, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart WHERE id = '$id' AND parent_feed IS NULL AND owner_uid = " . $_SESSION["uid"]); # update linked feed categories db_query($link, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart WHERE parent_feed = '$id' AND owner_uid = " . $_SESSION["uid"]); } db_query($link, "COMMIT"); } } if ($subop == "editCats") { $action = $_REQUEST["action"]; if ($action == "save") { $cat_title = db_escape_string(trim($_REQUEST["value"])); $cat_id = db_escape_string($_GET["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"]; } db_query($link, "COMMIT"); return; } print "
".__('Category editor')."
"; print "
"; if ($action == "add") { if (!WEB_DEMO_MODE) { $feed_cat = db_escape_string(trim($_GET["cat"])); $result = db_query($link, "SELECT id FROM ttrss_feed_categories WHERE title = '$feed_cat' AND owner_uid = ".$_SESSION["uid"]); if (db_num_rows($result) == 0) { $result = db_query($link, "INSERT INTO ttrss_feed_categories (owner_uid,title) VALUES ('".$_SESSION["uid"]."', '$feed_cat')"); } else { print_warning(T_sprintf("Category $%s already exists in the database.", $feed_cat)); } } } if ($action == "remove") { if (!WEB_DEMO_MODE) { $ids = split(",", db_escape_string($_GET["ids"])); foreach ($ids as $id) { 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"]); ccache_remove($link, $id, $_SESSION["uid"], true); } else { print format_warning(__("Unable to delete non empty feed categories.")); } db_query($link, "COMMIT"); } } } print "
 
"; $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); print "

"; if (db_num_rows($result) != 0) { print ""; print ""; print "
".__('Select:')." ".__('All').", ".__('None')."
"; print "

"; print "
"; print ""; $lnum = 0; while ($line = db_fetch_assoc($result)) { $class = ($lnum % 2) ? "even" : "odd"; $cat_id = $line["id"]; $this_row_id = "id=\"FCATR-$cat_id\""; print ""; $edit_title = htmlspecialchars($line["title"]); print ""; print ""; print ""; ++$lnum; } print "
" . $edit_title . "
"; print "
"; print "
"; } else { print "

".__('No feed categories defined.')."

"; } print "
"; print "
"; print " "; print "
"; print "
"; return; } if ($quiet) return; set_pref($link, "_PREFS_ACTIVE_TAB", "feedConfig"); $result = db_query($link, "SELECT COUNT(id) AS num_errors FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); $num_errors = db_fetch_result($result, 0, "num_errors"); if ($num_errors > 0) { print format_notice("". __('Some feeds have update errors (click for details)').""); } $feed_search = db_escape_string($_GET["search"]); if (array_key_exists("search", $_GET)) { $_SESSION["prefs_feed_search"] = $feed_search; } else { $feed_search = $_SESSION["prefs_feed_search"]; } print "
"; print ""; if (ENABLE_FEED_BROWSER && !SINGLE_USER_MODE) { print " "; } $feeds_sort = db_escape_string($_GET["sort"]); if (!$feeds_sort || $feeds_sort == "undefined") { $feeds_sort = $_SESSION["pref_sort_feeds"]; if (!$feeds_sort) $feeds_sort = "title"; } $_SESSION["pref_sort_feeds"] = $feeds_sort; if ($feed_search) { $search_qpart = "(UPPER(F1.title) LIKE UPPER('%$feed_search%') OR UPPER(C1.title) LIKE UPPER('%$feed_search%') OR UPPER(F1.feed_url) LIKE UPPER('%$feed_search%')) AND"; } else { $search_qpart = ""; } $show_last_article_info = false; $show_last_article_checked = ""; $show_last_article_qpart = ""; if ($_GET["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, ttrss_entries WHERE ref_id = ttrss_entries.id AND feed_id = F1.id) AS last_article"; } else if ($feeds_sort == "last_article") { $feeds_sort = "title"; } if (get_pref($link, 'ENABLE_FEED_CATS')) { $order_by_qpart = "category,$feeds_sort,title"; } else { $order_by_qpart = "$feeds_sort,title"; } $result = db_query($link, "SELECT F1.id, F1.title, F1.feed_url, ".SUBSTRING_FOR_DATE."(F1.last_updated,1,16) AS last_updated, F1.parent_feed, F1.update_interval, F1.last_error, F1.purge_interval, F1.cat_id, F2.title AS parent_title, C1.title AS category, F1.hidden, F1.include_in_digest $show_last_article_qpart FROM ttrss_feeds AS F1 LEFT JOIN ttrss_feeds AS F2 ON (F1.parent_feed = F2.id) LEFT JOIN ttrss_feed_categories AS C1 ON (F1.cat_id = C1.id) WHERE $search_qpart F1.owner_uid = '".$_SESSION["uid"]."' ORDER by $order_by_qpart"); if (db_num_rows($result) != 0) { // print "
PLACEHOLDER
"; print "

"; print ""; if (get_pref($link, 'ENABLE_FEED_ICONS')) { print ""; } print ""; if ($show_last_article_info) { print ""; } print ""; } $lnum = 0; $cur_cat_id = -1; while ($line = db_fetch_assoc($result)) { $feed_id = $line["id"]; $cat_id = $line["cat_id"]; $edit_title = htmlspecialchars($line["title"]); $edit_cat = htmlspecialchars($line["category"]); $hidden = sql_bool_to_bool($line["hidden"]); $last_error = $line["last_error"]; if (!$edit_cat) $edit_cat = __("Uncategorized"); $last_updated = $line["last_updated"]; if (!$last_updated) { $last_updated = "—"; } else if (get_pref($link, 'HEADLINES_SMART_DATE')) { $last_updated = smart_date_time(strtotime($last_updated)); } else { $short_date = get_pref($link, 'SHORT_DATE_FORMAT'); $last_updated = date($short_date, strtotime($last_updated)); } $last_article = $line["last_article"]; if (!$last_article) { $last_article = "—"; } else if (get_pref($link, 'HEADLINES_SMART_DATE')) { $last_article = smart_date_time(strtotime($last_article)); } else { $short_date = get_pref($link, 'SHORT_DATE_FORMAT'); $last_article = date($short_date, strtotime($last_article)); } if (get_pref($link, 'ENABLE_FEED_CATS') && $cur_cat_id != $cat_id) { $lnum = 0; print ""; print ""; if (get_pref($link, 'ENABLE_FEED_ICONS')) { print ""; } print ""; if ($show_last_article_info) { print ""; } print ""; $cur_cat_id = $cat_id; } $class = ($lnum % 2) ? "even" : "odd"; $this_row_id = "id=\"FEEDR-$feed_id\""; print ""; $icon_file = ICONS_DIR . "/$feed_id.ico"; if (file_exists($icon_file) && filesize($icon_file) > 0) { $feed_icon = ""; } else { $feed_icon = ""; } print ""; $onclick = "onclick='editFeed($feed_id)' title='".__('Click to edit')."'"; if (get_pref($link, 'ENABLE_FEED_ICONS')) { print ""; } if ($hidden) { $edit_title = "$edit_title ". __('(Hidden)').""; $last_updated = "$last_updated"; $last_article = "$last_article"; } if ($last_error) { $edit_title = "$edit_title"; $last_updated = "$last_updated"; $last_article = "$last_article"; } $parent_title = $line["parent_title"]; if ($parent_title) { $linked_to = sprintf(__("(linked to %s)"), $parent_title); $parent_title = "$linked_to"; } print ""; if ($show_last_article_info) { print ""; } print ""; print ""; ++$lnum; } print "
". "
". "
". __('Select:')." ".__('All').", ".__('None')." "; if (!get_pref($link, 'ENABLE_FEED_CATS')) { print "
  ".__('Title')."".__('Last Article')."".__('Updated')."
$edit_cat
  ".__('Title')." ".__('Last Article')." ".__('Updated')."
$feed_icon" . "$edit_title $parent_title" . "" . "$last_article$last_updated
"; print "

"; print "

"; if (get_pref($link, 'ENABLE_FEED_CATS')) { print __('Selection:') . " "; print_feed_cat_select($link, "sfeed_set_fcat", "", "disabled"); print " "; } print "
"; print ""; } else { print "

"; if (!$feed_search) { print_warning(__("You don't have any subscribed feeds.")); } else { print_warning(__('No matching feeds found.')); } print "

"; } print "

".__('OPML')."

".__('File:')."  
"; print " "; print ""; print "

" . __("Firefox Integration") . "

"; print "

" . __('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.'); print "

" . __('Click here to register this site as a feed reader.') . "

"; print "

".__("Published articles")."

"; if (!get_pref($link, "_PREFS_PUBLISH_KEY")) { set_pref($link, "_PREFS_PUBLISH_KEY", generate_publish_key()); } print "

".__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.')."

"; $url_path = article_publish_url($link); print "

".__("Link to published articles feed.")."

"; print "

"; /* print " "; */ print "

"; } 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 = ""; } else { $feed_icon = ""; } $check_box = ""; $class = ($feedctr % 2) ? "even" : "odd"; if ($details["site_url"]) { $site_url = " www"; } else { $site_url = ""; } print "
  • $check_box". "$feed_icon " . $details["title"] . " ($subscribers) $site_url
  • "; ++$feedctr; } if ($feedctr == 0) { print "
  • ".__('No feeds found.')."

  • "; } return $feedctr; } ?>