- $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 = "<span class=\"HLLCTR-$id\">";
- $labels_str .= Article::format_article_labels($labels);
- $labels_str .= "</span>";
-
- if (count($topmost_article_ids) < 3) {
- array_push($topmost_article_ids, $id);
- }
-
- $class = "";
-
- if ($line["unread"]) {
- $class .= " Unread";
- ++$num_unread;
- }
-
- if ($line["marked"]) {
- $marked_pic = "<img
- src=\"images/mark_set.png\"
- class=\"markedPic\" alt=\"Unstar article\"
- onclick='toggleMark($id)'>";
- $class .= " marked";
- } else {
- $marked_pic = "<img
- src=\"images/mark_unset.png\"
- class=\"markedPic\" alt=\"Star article\"
- onclick='toggleMark($id)'>";
- }
-
- if ($line["published"]) {
- $published_pic = "<img src=\"images/pub_set.png\"
- class=\"pubPic\"
- alt=\"Unpublish article\" onclick='togglePub($id)'>";
- $class .= " published";
- } else {
- $published_pic = "<img src=\"images/pub_unset.png\"
- class=\"pubPic\"
- alt=\"Publish article\" onclick='togglePub($id)'>";
- }
-
- $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 = "<img class='hlScorePic' score='$score' onclick='changeScore($id, this)' src=\"$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 (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;
+
+ $mouseover_attrs = "onmouseover='postMouseIn(event, $id)' onmouseout='postMouseOut($id)'";
+
+ 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 = "<span class=\"HLLCTR-$id\">";
+ $labels_str .= Article::format_article_labels($labels);
+ $labels_str .= "</span>";
+
+ if (count($topmost_article_ids) < 3) {
+ array_push($topmost_article_ids, $id);
+ }
+
+ $class = "";
+
+ if ($line["unread"]) {
+ $class .= " Unread";
+ ++$num_unread;
+ }
+
+ $marked_pic_src = $line["marked"] ? "mark_set.png" : "mark_unset.png";
+ $class .= $line["marked"] ? " marked" : "";
+ $marked_pic = "<img src=\"images/$marked_pic_src\" class=\"markedPic\" onclick='toggleMark($id)'>";
+
+ $published_pic_src = $line["published"] ? "pub_set.png" : "pub_unset.png";
+ $class .= $line["published"] ? " published" : "";
+ $published_pic = "<img src=\"images/$published_pic_src\" class=\"pubPic\" onclick='togglePub($id)'>";
+
+ $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 = "<img class='hlScorePic' score='$score' onclick='changeScore($id, this)' src=\"$score_pic\"