misc code cleanup around queryFeedHeadlines()
This commit is contained in:
parent
326469fcb5
commit
22fdebff47
|
@ -2343,7 +2343,7 @@
|
||||||
ttrss_feed_categories.owner_uid = " . $_SESSION["uid"]);
|
ttrss_feed_categories.owner_uid = " . $_SESSION["uid"]);
|
||||||
|
|
||||||
while ($line = db_fetch_assoc($result)) {
|
while ($line = db_fetch_assoc($result)) {
|
||||||
$line["cat_id"] = sprintf("%d", $line["cat_id"]);
|
$line["cat_id"] = (int) $line["cat_id"];
|
||||||
|
|
||||||
print "<counter type=\"category\" id=\"".$line["cat_id"]."\" counter=\"".
|
print "<counter type=\"category\" id=\"".$line["cat_id"]."\" counter=\"".
|
||||||
$line["unread"]."\"/>";
|
$line["unread"]."\"/>";
|
||||||
|
@ -2450,7 +2450,7 @@
|
||||||
function getFeedArticles($link, $feed, $is_cat = false, $unread_only = false,
|
function getFeedArticles($link, $feed, $is_cat = false, $unread_only = false,
|
||||||
$owner_uid = false) {
|
$owner_uid = false) {
|
||||||
|
|
||||||
$n_feed = sprintf("%d", $feed);
|
$n_feed = (int) $feed;
|
||||||
|
|
||||||
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
|
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
|
||||||
|
|
||||||
|
@ -3029,16 +3029,11 @@
|
||||||
} else {
|
} else {
|
||||||
return "Unknown feed ($id)";
|
return "Unknown feed ($id)";
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (preg_match("/^-?[0-9][0-9]*$/", $id)) {
|
|
||||||
return "getFeedTitle($id) failed";
|
|
||||||
} else {
|
} else {
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_session_cookie_name() {
|
function get_session_cookie_name() {
|
||||||
return ((!defined('TTRSS_SESSION_NAME')) ? "ttrss_sid" : TTRSS_SESSION_NAME);
|
return ((!defined('TTRSS_SESSION_NAME')) ? "ttrss_sid" : TTRSS_SESSION_NAME);
|
||||||
}
|
}
|
||||||
|
@ -3143,7 +3138,7 @@
|
||||||
|
|
||||||
if (ENABLE_UPDATE_DAEMON) {
|
if (ENABLE_UPDATE_DAEMON) {
|
||||||
print "<param key=\"daemon_is_running\" value=\"".
|
print "<param key=\"daemon_is_running\" value=\"".
|
||||||
sprintf("%d", file_is_locked("update_daemon.lock")) . "\"/>";
|
(int) file_is_locked("update_daemon.lock") . "\"/>";
|
||||||
|
|
||||||
if (time() - $_SESSION["daemon_stamp_check"] > 30) {
|
if (time() - $_SESSION["daemon_stamp_check"] > 30) {
|
||||||
|
|
||||||
|
@ -3271,6 +3266,7 @@
|
||||||
if ($search && $search_mode == "all_feeds") {
|
if ($search && $search_mode == "all_feeds") {
|
||||||
$query_strategy_part = "ttrss_entries.id > 0";
|
$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,";
|
||||||
|
/* tags */
|
||||||
} else if (preg_match("/^-?[0-9][0-9]*$/", $feed) == false) {
|
} else if (preg_match("/^-?[0-9][0-9]*$/", $feed) == false) {
|
||||||
$query_strategy_part = "ttrss_entries.id > 0";
|
$query_strategy_part = "ttrss_entries.id > 0";
|
||||||
$vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
|
$vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
|
||||||
|
@ -3401,69 +3397,23 @@
|
||||||
|
|
||||||
$feed_title = "";
|
$feed_title = "";
|
||||||
|
|
||||||
if ($search && $search_mode == "all_feeds") {
|
|
||||||
$feed_title = __("Search results")." ($search)";
|
|
||||||
} else if ($search && preg_match('/^-?[0-9][0-9]*$/', $feed) == false) {
|
|
||||||
$feed_title = __("Search results")." ($search, $feed)";
|
|
||||||
} else if (preg_match('/^-?[0-9][0-9]*$/', $feed) == false) {
|
|
||||||
$feed_title = $feed;
|
|
||||||
} else if (preg_match('/^-?[0-9][0-9]*$/', $feed) != false && $feed >= 0) {
|
|
||||||
|
|
||||||
if ($cat_view) {
|
|
||||||
|
|
||||||
if ($feed != 0) {
|
|
||||||
$result = db_query($link, "SELECT title FROM ttrss_feed_categories
|
|
||||||
WHERE id = '$feed' AND owner_uid = $owner_uid");
|
|
||||||
$feed_title = db_fetch_result($result, 0, "title");
|
|
||||||
} else {
|
|
||||||
$feed_title = __("Uncategorized");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($search) {
|
if ($search) {
|
||||||
$feed_title = __("Searched for")." $search ($feed_title)";
|
$feed_title = "Search results";
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
if ($cat_view) {
|
||||||
$result = db_query($link, "SELECT title,site_url,last_error FROM ttrss_feeds
|
$feed_title = getCategoryTitle($link, $feed);
|
||||||
WHERE id = '$feed' AND owner_uid = $owner_uid");
|
} else {
|
||||||
|
if ((int)$feed == $feed && $feed > 0) {
|
||||||
|
$result = db_query($link, "SELECT title,site_url,last_error
|
||||||
|
FROM ttrss_feeds WHERE id = '$feed' AND owner_uid = $owner_uid");
|
||||||
|
|
||||||
$feed_title = db_fetch_result($result, 0, "title");
|
$feed_title = db_fetch_result($result, 0, "title");
|
||||||
$feed_site_url = db_fetch_result($result, 0, "site_url");
|
$feed_site_url = db_fetch_result($result, 0, "site_url");
|
||||||
$last_error = db_fetch_result($result, 0, "last_error");
|
$last_error = db_fetch_result($result, 0, "last_error");
|
||||||
|
|
||||||
if ($search) {
|
|
||||||
$feed_title = __("Searched for") . " $search ($feed_title)";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if ($feed == -1) {
|
|
||||||
$feed_title = __("Starred articles");
|
|
||||||
if ($search) { $feed_title = __("Searched for") . " $search ($feed_title)"; }
|
|
||||||
} else if ($feed == -2) {
|
|
||||||
if (!$cat_view) {
|
|
||||||
$feed_title = __("Published articles");
|
|
||||||
if ($search) { $feed_title = __("Searched for") . " $search ($feed_title)"; }
|
|
||||||
} else {
|
} else {
|
||||||
$feed_title = __("Labels");
|
$feed_title = getFeedTitle($link, $feed);
|
||||||
}
|
}
|
||||||
} else if ($feed == -3) {
|
|
||||||
$feed_title = __("Fresh articles");
|
|
||||||
if ($search) { $feed_title = __("Searched for") . " $search ($feed_title)"; }
|
|
||||||
} else if ($feed == -4) {
|
|
||||||
$feed_title = __("All articles");
|
|
||||||
if ($search) { $feed_title = __("Searched for") . " $search ($feed_title)"; }
|
|
||||||
} else if ($feed < -10) {
|
|
||||||
$label_id = -$feed - 11;
|
|
||||||
$result = db_query($link, "SELECT caption FROM ttrss_labels2
|
|
||||||
WHERE id = '$label_id'");
|
|
||||||
$feed_title = db_fetch_result($result, 0, "caption");
|
|
||||||
|
|
||||||
if ($search) {
|
|
||||||
$feed_title = __("Searched for") . " $search ($feed_title)";
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$feed_title = "?";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$content_query_part = "content as content_preview,";
|
$content_query_part = "content as content_preview,";
|
||||||
|
@ -3484,16 +3434,6 @@
|
||||||
if (!$override_order) {
|
if (!$override_order) {
|
||||||
$order_by = "ttrss_feeds.title, $order_by";
|
$order_by = "ttrss_feeds.title, $order_by";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special output for Fresh feed
|
|
||||||
|
|
||||||
/* if ($feed == -3) {
|
|
||||||
$group_limit_part = "(select count(*) from
|
|
||||||
ttrss_user_entries AS t1, ttrss_entries AS t2 where
|
|
||||||
t1.ref_id = t2.id and t1.owner_uid = 2 and
|
|
||||||
t1.feed_id = ttrss_user_entries.feed_id and
|
|
||||||
t2.updated > ttrss_entries.updated) <= 5 AND";
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($feed != "0") {
|
if ($feed != "0") {
|
||||||
|
@ -3562,8 +3502,6 @@
|
||||||
$limit_query_part");
|
$limit_query_part");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$feed_title) $feed_title = getFeedTitle($link, $feed_id);
|
|
||||||
|
|
||||||
return array($result, $feed_title, $feed_site_url, $last_error);
|
return array($result, $feed_title, $feed_site_url, $last_error);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4428,7 +4366,7 @@
|
||||||
$collapsed = get_pref($link, "_COLLAPSED_UNCAT");
|
$collapsed = get_pref($link, "_COLLAPSED_UNCAT");
|
||||||
}
|
}
|
||||||
|
|
||||||
$cat_id = sprintf("%d", $cat_id);
|
$cat_id = (int) $cat_id;
|
||||||
|
|
||||||
printCategoryHeader($link, $cat_id, $collapsed, true);
|
printCategoryHeader($link, $cat_id, $collapsed, true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue