|
|
@ -303,8 +303,6 @@ class Feeds extends Handler_Protected {
|
|
|
|
$feed, $cat_view, $search,
|
|
|
|
$feed, $cat_view, $search,
|
|
|
|
$last_error, $last_updated);
|
|
|
|
$last_error, $last_updated);
|
|
|
|
|
|
|
|
|
|
|
|
$headlines_count = is_numeric($result) ? 0 : db_num_rows($result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($offset == 0) {
|
|
|
|
if ($offset == 0) {
|
|
|
|
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HEADLINES_BEFORE) as $p) {
|
|
|
|
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HEADLINES_BEFORE) as $p) {
|
|
|
|
$reply['content'] .= $p->hook_headlines_before($feed, $cat_view, $qfh_ret);
|
|
|
|
$reply['content'] .= $p->hook_headlines_before($feed, $cat_view, $qfh_ret);
|
|
|
@ -313,17 +311,16 @@ class Feeds extends Handler_Protected {
|
|
|
|
|
|
|
|
|
|
|
|
$reply['content'] = '';
|
|
|
|
$reply['content'] = '';
|
|
|
|
|
|
|
|
|
|
|
|
if ($headlines_count > 0) {
|
|
|
|
$headlines_count = 0;
|
|
|
|
|
|
|
|
|
|
|
|
$lnum = $offset;
|
|
|
|
$lnum = $offset;
|
|
|
|
|
|
|
|
|
|
|
|
$num_unread = 0;
|
|
|
|
$num_unread = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info);
|
|
|
|
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info);
|
|
|
|
|
|
|
|
|
|
|
|
$expand_cdm = get_pref('CDM_EXPANDED');
|
|
|
|
$expand_cdm = get_pref('CDM_EXPANDED');
|
|
|
|
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
|
|
|
while ($line = $result->fetch()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
++$headlines_count;
|
|
|
|
|
|
|
|
|
|
|
|
$line["content_preview"] = "— " . truncate_string(strip_tags($line["content"]), 250);
|
|
|
|
$line["content_preview"] = "— " . truncate_string(strip_tags($line["content"]), 250);
|
|
|
|
|
|
|
|
|
|
|
@ -392,17 +389,6 @@ class Feeds extends Handler_Protected {
|
|
|
|
alt=\"Publish article\" onclick='togglePub($id)'>";
|
|
|
|
alt=\"Publish article\" onclick='togglePub($id)'>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# $content_link = "<a target=\"_blank\" rel=\"noopener noreferrer\" href=\"".$line["link"]."\">" .
|
|
|
|
|
|
|
|
# $line["title"] . "</a>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# $content_link = "<a
|
|
|
|
|
|
|
|
# href=\"" . htmlspecialchars($line["link"]) . "\"
|
|
|
|
|
|
|
|
# onclick=\"view($id,$feed_id);\">" .
|
|
|
|
|
|
|
|
# $line["title"] . "</a>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# $content_link = "<a href=\"javascript:viewContentUrl('".$line["link"]."');\">" .
|
|
|
|
|
|
|
|
# $line["title"] . "</a>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$updated_fmt = make_local_datetime($line["updated"], false, false, false, true);
|
|
|
|
$updated_fmt = make_local_datetime($line["updated"], false, false, false, true);
|
|
|
|
$date_entered_fmt = T_sprintf("Imported at %s",
|
|
|
|
$date_entered_fmt = T_sprintf("Imported at %s",
|
|
|
|
make_local_datetime($line["date_entered"], false));
|
|
|
|
make_local_datetime($line["date_entered"], false));
|
|
|
@ -411,10 +397,6 @@ class Feeds extends Handler_Protected {
|
|
|
|
|
|
|
|
|
|
|
|
$score_pic = "images/" . get_score_pic($score);
|
|
|
|
$score_pic = "images/" . get_score_pic($score);
|
|
|
|
|
|
|
|
|
|
|
|
/* $score_title = __("(Click to change)");
|
|
|
|
|
|
|
|
$score_pic = "<img class='hlScorePic' src=\"images/$score_pic\"
|
|
|
|
|
|
|
|
onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">"; */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$score_pic = "<img class='hlScorePic' score='$score' onclick='changeScore($id, this)' src=\"$score_pic\"
|
|
|
|
$score_pic = "<img class='hlScorePic' score='$score' onclick='changeScore($id, this)' src=\"$score_pic\"
|
|
|
|
title=\"$score\">";
|
|
|
|
title=\"$score\">";
|
|
|
|
|
|
|
|
|
|
|
@ -752,9 +734,6 @@ class Feeds extends Handler_Protected {
|
|
|
|
$tmp_content .= "</span>";
|
|
|
|
$tmp_content .= "</span>";
|
|
|
|
$tmp_content .= "<div>";
|
|
|
|
$tmp_content .= "<div>";
|
|
|
|
|
|
|
|
|
|
|
|
// $tmp_content .= "$marked_pic";
|
|
|
|
|
|
|
|
// $tmp_content .= "$published_pic";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) {
|
|
|
|
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) {
|
|
|
|
$tmp_content .= $p->hook_article_button($line);
|
|
|
|
$tmp_content .= $p->hook_article_button($line);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -777,8 +756,9 @@ class Feeds extends Handler_Protected {
|
|
|
|
|
|
|
|
|
|
|
|
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PE", $timing_info);
|
|
|
|
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PE", $timing_info);
|
|
|
|
|
|
|
|
|
|
|
|
} else if (!is_numeric($result)) {
|
|
|
|
if (!$headlines_count) {
|
|
|
|
$message = "";
|
|
|
|
|
|
|
|
|
|
|
|
if (!is_numeric($result)) {
|
|
|
|
|
|
|
|
|
|
|
|
switch ($view_mode) {
|
|
|
|
switch ($view_mode) {
|
|
|
|
case "unread":
|
|
|
|
case "unread":
|
|
|
@ -830,6 +810,7 @@ class Feeds extends Handler_Protected {
|
|
|
|
} else if (is_numeric($result) && $result == -1) {
|
|
|
|
} else if (is_numeric($result) && $result == -1) {
|
|
|
|
$reply['first_id_changed'] = true;
|
|
|
|
$reply['first_id_changed'] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H2", $timing_info);
|
|
|
|
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H2", $timing_info);
|
|
|
|
|
|
|
|
|
|
|
@ -2121,10 +2102,10 @@ class Feeds extends Handler_Protected {
|
|
|
|
print $query;
|
|
|
|
print $query;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$result = db_query($query);
|
|
|
|
$res = $pdo->query($query);
|
|
|
|
|
|
|
|
|
|
|
|
if ($result && db_num_rows($result) > 0) {
|
|
|
|
if ($row = $res->fetch()) {
|
|
|
|
$first_id = (int)db_fetch_result($result, 0, "id");
|
|
|
|
$first_id = (int)$row["id"];
|
|
|
|
|
|
|
|
|
|
|
|
if ($offset > 0 && $first_id && $check_first_id && $first_id != $check_first_id) {
|
|
|
|
if ($offset > 0 && $first_id && $check_first_id && $first_id != $check_first_id) {
|
|
|
|
return array(-1, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id);
|
|
|
|
return array(-1, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id);
|
|
|
@ -2167,7 +2148,7 @@ class Feeds extends Handler_Protected {
|
|
|
|
|
|
|
|
|
|
|
|
if ($_REQUEST["debug"]) print $query;
|
|
|
|
if ($_REQUEST["debug"]) print $query;
|
|
|
|
|
|
|
|
|
|
|
|
$result = db_query($query);
|
|
|
|
$res = $pdo->query($query);
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// browsing by tag
|
|
|
|
// browsing by tag
|
|
|
@ -2211,20 +2192,23 @@ class Feeds extends Handler_Protected {
|
|
|
|
|
|
|
|
|
|
|
|
if ($_REQUEST["debug"]) print $query;
|
|
|
|
if ($_REQUEST["debug"]) print $query;
|
|
|
|
|
|
|
|
|
|
|
|
$result = db_query($query);
|
|
|
|
$res = $pdo->query($query);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return array($result, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id);
|
|
|
|
return array($res, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static function getParentCategories($cat, $owner_uid) {
|
|
|
|
static function getParentCategories($cat, $owner_uid) {
|
|
|
|
$rv = array();
|
|
|
|
$rv = array();
|
|
|
|
|
|
|
|
|
|
|
|
$result = db_query("SELECT parent_cat FROM ttrss_feed_categories
|
|
|
|
$pdo = Db::pdo();
|
|
|
|
WHERE id = '$cat' AND parent_cat IS NOT NULL AND owner_uid = $owner_uid");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
|
|
|
$sth = $pdo->prepare("SELECT parent_cat FROM ttrss_feed_categories
|
|
|
|
|
|
|
|
WHERE id = ? AND parent_cat IS NOT NULL AND owner_uid = ?");
|
|
|
|
|
|
|
|
$sth->execute([$cat, $owner_uid]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while ($line = $sth->fetch()) {
|
|
|
|
array_push($rv, $line["parent_cat"]);
|
|
|
|
array_push($rv, $line["parent_cat"]);
|
|
|
|
$rv = array_merge($rv, Feeds::getParentCategories($line["parent_cat"], $owner_uid));
|
|
|
|
$rv = array_merge($rv, Feeds::getParentCategories($line["parent_cat"], $owner_uid));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2235,10 +2219,13 @@ class Feeds extends Handler_Protected {
|
|
|
|
static function getChildCategories($cat, $owner_uid) {
|
|
|
|
static function getChildCategories($cat, $owner_uid) {
|
|
|
|
$rv = array();
|
|
|
|
$rv = array();
|
|
|
|
|
|
|
|
|
|
|
|
$result = db_query("SELECT id FROM ttrss_feed_categories
|
|
|
|
$pdo = Db::pdo();
|
|
|
|
WHERE parent_cat = '$cat' AND owner_uid = $owner_uid");
|
|
|
|
|
|
|
|
|
|
|
|
$sth = $pdo->prepare("SELECT id FROM ttrss_feed_categories
|
|
|
|
|
|
|
|
WHERE parent_cat = ? AND owner_uid = ?");
|
|
|
|
|
|
|
|
$sth->execute([$cat, $owner_uid]);
|
|
|
|
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
|
|
|
while ($line = $sth->fetch()) {
|
|
|
|
array_push($rv, $line["id"]);
|
|
|
|
array_push($rv, $line["id"]);
|
|
|
|
$rv = array_merge($rv, Feeds::getChildCategories($line["id"], $owner_uid));
|
|
|
|
$rv = array_merge($rv, Feeds::getChildCategories($line["id"], $owner_uid));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2247,11 +2234,14 @@ class Feeds extends Handler_Protected {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static function getFeedCategory($feed) {
|
|
|
|
static function getFeedCategory($feed) {
|
|
|
|
$result = db_query("SELECT cat_id FROM ttrss_feeds
|
|
|
|
$pdo = Db::pdo();
|
|
|
|
WHERE id = '$feed'");
|
|
|
|
|
|
|
|
|
|
|
|
$sth = $pdo->prepare("SELECT cat_id FROM ttrss_feeds
|
|
|
|
|
|
|
|
WHERE id = ?");
|
|
|
|
|
|
|
|
$sth->execute([$feed]);
|
|
|
|
|
|
|
|
|
|
|
|
if (db_num_rows($result) > 0) {
|
|
|
|
if ($row = $sth->fetch()) {
|
|
|
|
return db_fetch_result($result, 0, "cat_id");
|
|
|
|
return $row["cat_id"];
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|