X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=classes%2Ffeeds.php;h=cf9ca64c596c4d748167988604326a005d4e0810;hb=c10a43069ec1e71b6608574a81fb29c76919e132;hp=f2244ae89a0404f5dedc6fd8a7c4ef3533ce418e;hpb=aee3f0e6d95f58e89bef305c9c2e3fcbc91fe17d;p=tt-rss.git
diff --git a/classes/feeds.php b/classes/feeds.php
index f2244ae8..cf9ca64c 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -64,7 +64,7 @@ class Feeds extends Handler_Protected {
$target = "target=\"_blank\"";
$reply .= "".
- truncate_string($feed_title, 30)."";
+ truncate_string(strip_tags($feed_title), 30)."";
if ($error) {
$error = htmlspecialchars($error);
@@ -72,7 +72,7 @@ class Feeds extends Handler_Protected {
}
} else {
- $reply .= $feed_title;
+ $reply .= strip_tags($feed_title);
}
$reply .= "";
@@ -173,49 +173,10 @@ class Feeds extends Handler_Protected {
$method_split = explode(":", $method);
if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {
- // Update the feed if required with some basic flood control
-
- $any_needs_curl = false;
-
- if (ini_get("open_basedir")) {
- $pluginhost = PluginHost::getInstance();
- foreach ($pluginhost->get_plugins() as $plugin) {
- $flags = $plugin->flags();
-
- if (isset($flags["needs_curl"]) && $flags["needs_curl"]) {
- $any_needs_curl = true;
- break;
- }
- }
- }
-
- //if ($_REQUEST["debug"]) print "";
-
- if (!$any_needs_curl) {
-
- $sth = $this->pdo->prepare("SELECT cache_images," . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated
- FROM ttrss_feeds WHERE id = ?");
- $sth->execute([$feed]);
-
- if ($row = $sth->fetch()) {
- $last_updated = strtotime($row["last_updated"]);
- $cache_images = sql_bool_to_bool($row["cache_images"]);
-
- if (!$cache_images && time() - $last_updated > 120) {
- RSSUtils::update_rss_feed($feed, true);
- } else {
- $sth = $this->pdo->prepare("UPDATE ttrss_feeds
- SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
- WHERE id = ?");
- $sth->execute([$feed]);
- }
- }
- } else {
- $sth = $this->pdo->prepare("UPDATE ttrss_feeds
- SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
- WHERE id = ?");
- $sth->execute([$feed]);
- }
+ $sth = $this->pdo->prepare("UPDATE ttrss_feeds
+ SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
+ WHERE id = ?");
+ $sth->execute([$feed]);
}
if ($method_split[0] == "MarkAllReadGR") {
@@ -286,7 +247,7 @@ class Feeds extends Handler_Protected {
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H1", $timing_info);
- $result = $qfh_ret[0];
+ $result = $qfh_ret[0]; // this could be either a PDO query result or a -1 if first id changed
$feed_title = $qfh_ret[1];
$feed_site_url = $qfh_ret[2];
$last_error = $qfh_ret[3];
@@ -318,440 +279,417 @@ class Feeds extends Handler_Protected {
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info);
$expand_cdm = get_pref('CDM_EXPANDED');
- while ($line = $result->fetch()) {
-
- ++$headlines_count;
-
- $line["content_preview"] = "— " . truncate_string(strip_tags($line["content"]), 250);
-
- foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
- $line = $p->hook_query_headlines($line, 250, false);
- }
-
- if (get_pref('SHOW_CONTENT_PREVIEW')) {
- $content_preview = $line["content_preview"];
- }
-
- $id = $line["id"];
- $feed_id = $line["feed_id"];
- $label_cache = $line["label_cache"];
- $labels = false;
-
- if ($label_cache) {
- $label_cache = json_decode($label_cache, true);
-
- if ($label_cache) {
- if ($label_cache["no-labels"] == 1)
- $labels = array();
- else
- $labels = $label_cache;
- }
- }
-
- if (!is_array($labels)) $labels = Article::get_article_labels($id);
-
- $labels_str = "";
- $labels_str .= Article::format_article_labels($labels);
- $labels_str .= "";
-
- if (count($topmost_article_ids) < 3) {
- array_push($topmost_article_ids, $id);
- }
-
- $class = "";
-
- if (sql_bool_to_bool($line["unread"])) {
- $class .= " Unread";
- ++$num_unread;
- }
-
- if (sql_bool_to_bool($line["marked"])) {
- $marked_pic = "";
- $class .= " marked";
- } else {
- $marked_pic = "
";
- }
-
- if (sql_bool_to_bool($line["published"])) {
- $published_pic = "
";
- $class .= " published";
- } else {
- $published_pic = "
";
- }
-
- $updated_fmt = make_local_datetime($line["updated"], false, false, false, true);
- $date_entered_fmt = T_sprintf("Imported at %s",
- make_local_datetime($line["date_entered"], false));
-
- $score = $line["score"];
-
- $score_pic = "images/" . get_score_pic($score);
-
- $score_pic = "
";
+ if (is_object($result)) {
+
+ while ($line = $result->fetch()) {
+
+ ++$headlines_count;
+
+ $line["content_preview"] = "— " . truncate_string(strip_tags($line["content"]), 250);
+
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
+ $line = $p->hook_query_headlines($line, 250, false);
+ }
- if ($score > 500) {
- $hlc_suffix = "high";
- } else if ($score < -100) {
- $hlc_suffix = "low";
- } else {
- $hlc_suffix = "";
- }
+ if (get_pref('SHOW_CONTENT_PREVIEW')) {
+ $content_preview = $line["content_preview"];
+ }
- $entry_author = $line["author"];
+ $id = $line["id"];
+ $feed_id = $line["feed_id"];
+ $label_cache = $line["label_cache"];
+ $labels = false;
- if ($entry_author) {
- $entry_author = " — $entry_author";
- }
+ $mouseover_attrs = "onmouseover='postMouseIn(event, $id)' onmouseout='postMouseOut($id)'";
- $has_feed_icon = feed_has_icon($feed_id);
+ if ($label_cache) {
+ $label_cache = json_decode($label_cache, true);
- if ($has_feed_icon) {
- $feed_icon_img = "
";
- } else {
- $feed_icon_img = "
";
- }
+ if ($label_cache) {
+ if ($label_cache["no-labels"] == 1)
+ $labels = array();
+ else
+ $labels = $label_cache;
+ }
+ }
- $entry_site_url = $line["site_url"];
+ if (!is_array($labels)) $labels = Article::get_article_labels($id);
- //setting feed headline background color, needs to change text color based on dark/light
- $fav_color = $line['favicon_avg_color'];
+ $labels_str = "";
+ $labels_str .= Article::format_article_labels($labels);
+ $labels_str .= "";
- require_once "colors.php";
+ if (count($topmost_article_ids) < 3) {
+ array_push($topmost_article_ids, $id);
+ }
- if ($fav_color && $fav_color != 'fail') {
- if (!isset($rgba_cache[$feed_id])) {
- $rgba_cache[$feed_id] = join(",", _color_unpack($fav_color));
- }
- }
+ $class = "";
- if (!get_pref('COMBINED_DISPLAY_MODE')) {
+ if ($line["unread"]) {
+ $class .= " Unread";
+ ++$num_unread;
+ }
- if ($vfeed_group_enabled) {
- if ($feed_id != $vgroup_last_feed && $line["feed_title"]) {
+ $marked_pic_src = $line["marked"] ? "mark_set.png" : "mark_unset.png";
+ $class .= $line["marked"] ? " marked" : "";
+ $marked_pic = "
";
- $cur_feed_title = $line["feed_title"];
- $vgroup_last_feed = $feed_id;
+ $published_pic_src = $line["published"] ? "pub_set.png" : "pub_unset.png";
+ $class .= $line["published"] ? " published" : "";
+ $published_pic = "
";
- $cur_feed_title = htmlspecialchars($cur_feed_title);
+ $updated_fmt = make_local_datetime($line["updated"], false, false, false, true);
+ $date_entered_fmt = T_sprintf("Imported at %s",
+ make_local_datetime($line["date_entered"], false));
- $vf_catchup_link = "".__('mark feed as read')."";
+ $score = $line["score"];
- $reply['content'] .= "