]> git.wh0rd.org - tt-rss.git/blame - classes/feeds.php
universal image caching and automatic cache directories maintenance
[tt-rss.git] / classes / feeds.php
CommitLineData
3f363052 1<?php\r
46da73c2
AD
2class Feeds extends Protected_Handler {\r
3\r
8484ce22
AD
4 function csrf_ignore($method) {\r
5 $csrf_ignored = array("index");\r
6\r
7 return array_search($method, $csrf_ignored) !== false;\r
8 }\r
9\r
79178062
AD
10 private function feedlist_init_cat($cat_id, $hidden = false) {\r
11 $obj = array();\r
12 $cat_id = (int) $cat_id;\r
13\r
14 if ($cat_id > 0) {\r
15 $cat_unread = ccache_find($this->link, $cat_id, $_SESSION["uid"], true);\r
16 } else if ($cat_id == 0 || $cat_id == -2) {\r
17 $cat_unread = getCategoryUnread($this->link, $cat_id);\r
18 }\r
19\r
20 $obj['id'] = 'CAT:' . $cat_id;\r
21 $obj['items'] = array();\r
22 $obj['name'] = getCategoryTitle($this->link, $cat_id);\r
23 $obj['type'] = 'feed';\r
24 $obj['unread'] = (int) $cat_unread;\r
25 $obj['hidden'] = $hidden;\r
26 $obj['bare_id'] = $cat_id;\r
27\r
28 return $obj;\r
29 }\r
30\r
31 private function feedlist_init_feed($feed_id, $title = false, $unread = false, $error = '', $updated = '') {\r
32 $obj = array();\r
33 $feed_id = (int) $feed_id;\r
34\r
35 if (!$title)\r
36 $title = getFeedTitle($this->link, $feed_id, false);\r
37\r
38 if ($unread === false)\r
39 $unread = getFeedUnread($this->link, $feed_id, false);\r
40\r
41 $obj['id'] = 'FEED:' . $feed_id;\r
42 $obj['name'] = $title;\r
43 $obj['unread'] = (int) $unread;\r
44 $obj['type'] = 'feed';\r
45 $obj['error'] = $error;\r
46 $obj['updated'] = $updated;\r
47 $obj['icon'] = getFeedIcon($feed_id);\r
48 $obj['bare_id'] = $feed_id;\r
49\r
50 return $obj;\r
51 }\r
52\r
53 private function format_headline_subtoolbar($feed_site_url, $feed_title,\r
54 $feed_id, $is_cat, $search, $match_on,\r
55 $search_mode, $view_mode, $error) {\r
56\r
57 $page_prev_link = "viewFeedGoPage(-1)";\r
58 $page_next_link = "viewFeedGoPage(1)";\r
59 $page_first_link = "viewFeedGoPage(0)";\r
60\r
61 $catchup_page_link = "catchupPage()";\r
62 $catchup_feed_link = "catchupCurrentFeed()";\r
63 $catchup_sel_link = "catchupSelection()";\r
64\r
65 $archive_sel_link = "archiveSelection()";\r
66 $delete_sel_link = "deleteSelection()";\r
67\r
68 $sel_all_link = "selectArticles('all')";\r
69 $sel_unread_link = "selectArticles('unread')";\r
70 $sel_none_link = "selectArticles('none')";\r
71 $sel_inv_link = "selectArticles('invert')";\r
72\r
73 $tog_unread_link = "selectionToggleUnread()";\r
74 $tog_marked_link = "selectionToggleMarked()";\r
75 $tog_published_link = "selectionTogglePublished()";\r
76\r
f1080825
AD
77 if ($is_cat) $cat_q = "&is_cat=$is_cat";\r
78\r
79 if ($search) {\r
80 $search_q = "&q=$search&m=$match_on&smode=$search_mode";\r
81 } else {\r
82 $search_q = "";\r
83 }\r
84\r
85 $rss_link = htmlspecialchars(get_self_url_prefix() .\r
86 "/public.php?op=rss&id=$feed_id$cat_q$search_q");\r
87\r
88 // right part\r
89\r
90 $reply .= "<span class='r'>";\r
91\r
92 if ($feed_site_url) {\r
93 $target = "target=\"_blank\"";\r
94 $reply .= "<a title=\"".__("Visit the website")."\" $target href=\"$feed_site_url\">".\r
95 truncate_string($feed_title,30)."</a>";\r
96\r
97 if ($error) {\r
98 $reply .= " (<span class=\"error\" title=\"$error\">Error</span>)";\r
99 }\r
100\r
101 } else {\r
102 $reply .= $feed_title;\r
103 }\r
104\r
105 $reply .= "\r
106 <a href=\"#\"\r
107 title=\"".__("View as RSS feed")."\"\r
108 onclick=\"displayDlg('generatedFeed', '$feed_id:$is_cat:$rss_link')\">\r
109 <img class=\"noborder\" style=\"vertical-align : middle\" src=\"images/feed-icon-12x12.png\"></a>";\r
110\r
111 $reply .= "</span>";\r
112\r
113 // left part\r
79178062
AD
114\r
115 $reply .= __('Select:')."\r
116 <a href=\"#\" onclick=\"$sel_all_link\">".__('All')."</a>,\r
117 <a href=\"#\" onclick=\"$sel_unread_link\">".__('Unread')."</a>,\r
118 <a href=\"#\" onclick=\"$sel_inv_link\">".__('Invert')."</a>,\r
119 <a href=\"#\" onclick=\"$sel_none_link\">".__('None')."</a></li>";\r
120\r
121 $reply .= " ";\r
122\r
123 $reply .= "<select dojoType=\"dijit.form.Select\"\r
124 onchange=\"headlineActionsChange(this)\">";\r
125 $reply .= "<option value=\"false\">".__('Actions...')."</option>";\r
126\r
127 $reply .= "<option value=\"0\" disabled=\"1\">".__('Selection toggle:')."</option>";\r
128\r
129 $reply .= "<option value=\"$tog_unread_link\">".__('Unread')."</option>\r
130 <option value=\"$tog_marked_link\">".__('Starred')."</option>\r
131 <option value=\"$tog_published_link\">".__('Published')."</option>";\r
132\r
133 $reply .= "<option value=\"0\" disabled=\"1\">".__('Selection:')."</option>";\r
134\r
135 $reply .= "<option value=\"$catchup_sel_link\">".__('Mark as read')."</option>";\r
136\r
137 if ($feed_id != "0") {\r
138 $reply .= "<option value=\"$archive_sel_link\">".__('Archive')."</option>";\r
139 } else {\r
140 $reply .= "<option value=\"$archive_sel_link\">".__('Move back')."</option>";\r
141 $reply .= "<option value=\"$delete_sel_link\">".__('Delete')."</option>";\r
142\r
143 }\r
144\r
145 $reply .= "<option value=\"emailArticle(false)\">".__('Forward by email').\r
146 "</option>";\r
147\r
79178062
AD
148 $reply .= "<option value=\"0\" disabled=\"1\">".__('Feed:')."</option>";\r
149\r
150 $reply .= "<option value=\"catchupPage()\">".__('Mark as read')."</option>";\r
151\r
152 $reply .= "<option value=\"displayDlg('generatedFeed', '$feed_id:$is_cat:$rss_link')\">".__('View as RSS')."</option>";\r
153\r
154 $reply .= "</select>";\r
155\r
f1080825 156 //$reply .= "</div>";\r
79178062 157\r
f1080825 158 //$reply .= "</h2";\r
79178062
AD
159\r
160 return $reply;\r
161 }\r
162\r
163 private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view,\r
164 $next_unread_feed, $offset, $vgr_last_feed = false,\r
165 $override_order = false) {\r
166\r
167 $disable_cache = false;\r
168\r
169 $reply = array();\r
170\r
171 $timing_info = getmicrotime();\r
172\r
173 $topmost_article_ids = array();\r
174\r
175 if (!$offset) $offset = 0;\r
176 if ($method == "undefined") $method = "";\r
177\r
178 $method_split = explode(":", $method);\r
179\r
180/* if ($method == "CatchupSelected") {\r
181 $ids = explode(",", db_escape_string($_REQUEST["ids"]));\r
182 $cmode = sprintf("%d", $_REQUEST["cmode"]);\r
183\r
184 catchupArticlesById($this->link, $ids, $cmode);\r
185 } */\r
186\r
3c696512
AD
187 if ($method == "ForceUpdate" && $feed && is_numeric($feed) > 0) {\r
188 include "rssfuncs.php";\r
189 update_rss_feed($this->link, $feed, true);\r
190 }\r
79178062
AD
191\r
192 if ($method == "MarkAllRead") {\r
193 catchup_feed($this->link, $feed, $cat_view);\r
194\r
195 if (get_pref($this->link, 'ON_CATCHUP_SHOW_NEXT_FEED')) {\r
196 if ($next_unread_feed) {\r
197 $feed = $next_unread_feed;\r
198 }\r
199 }\r
200 }\r
201\r
202 if ($method_split[0] == "MarkAllReadGR") {\r
203 catchup_feed($this->link, $method_split[1], false);\r
204 }\r
205\r
206 // FIXME: might break tag display?\r
207\r
208 if (is_numeric($feed) && $feed > 0 && !$cat_view) {\r
209 $result = db_query($this->link,\r
210 "SELECT id FROM ttrss_feeds WHERE id = '$feed' LIMIT 1");\r
211\r
212 if (db_num_rows($result) == 0) {\r
213 $reply['content'] = "<div align='center'>".__('Feed not found.')."</div>";\r
214 }\r
215 }\r
216\r
217 if (preg_match("/^-?[0-9][0-9]*$/", $feed) != false) {\r
218\r
219 $result = db_query($this->link, "SELECT rtl_content FROM ttrss_feeds\r
220 WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]);\r
221\r
222 if (db_num_rows($result) == 1) {\r
223 $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));\r
224 } else {\r
225 $rtl_content = false;\r
226 }\r
227\r
228 if ($rtl_content) {\r
229 $rtl_tag = "dir=\"RTL\"";\r
230 } else {\r
231 $rtl_tag = "";\r
232 }\r
233 } else {\r
234 $rtl_tag = "";\r
235 $rtl_content = false;\r
236 }\r
237\r
238 @$search = db_escape_string($_REQUEST["query"]);\r
239\r
240 if ($search) {\r
241 $disable_cache = true;\r
242 }\r
243\r
244 @$search_mode = db_escape_string($_REQUEST["search_mode"]);\r
245 @$match_on = db_escape_string($_REQUEST["match_on"]);\r
246\r
247 if (!$match_on) {\r
248 $match_on = "both";\r
249 }\r
250\r
251 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H0", $timing_info);\r
252\r
253// error_log("format_headlines_list: [" . $feed . "] method [" . $method . "]");\r
254 if( $search_mode == '' && $method != '' ){\r
255 $search_mode = $method;\r
256 }\r
257// error_log("search_mode: " . $search_mode);\r
258 $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $cat_view,\r
259 $search, $search_mode, $match_on, $override_order, $offset);\r
260\r
261 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H1", $timing_info);\r
262\r
263 $result = $qfh_ret[0];\r
264 $feed_title = $qfh_ret[1];\r
265 $feed_site_url = $qfh_ret[2];\r
266 $last_error = $qfh_ret[3];\r
267\r
268 $vgroup_last_feed = $vgr_last_feed;\r
269\r
270// if (!$offset) {\r
271\r
272 if (db_num_rows($result) > 0) {\r
273 $reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url,\r
274 $feed_title,\r
275 $feed, $cat_view, $search, $match_on, $search_mode, $view_mode,\r
276 $last_error);\r
277 }\r
278// }\r
279\r
280 $headlines_count = db_num_rows($result);\r
281\r
1baac280
AD
282 if (get_pref($this->link, 'COMBINED_DISPLAY_MODE')) {\r
283 $button_plugins = array();\r
284 foreach (explode(",", ARTICLE_BUTTON_PLUGINS) as $p) {\r
285 $pclass = trim("${p}_button");\r
286\r
287 if (class_exists($pclass)) {\r
288 $plugin = new $pclass($link);\r
289 array_push($button_plugins, $plugin);\r
290 }\r
291 }\r
292 }\r
293\r
79178062
AD
294 if (db_num_rows($result) > 0) {\r
295\r
296 $lnum = $offset;\r
297\r
298 $num_unread = 0;\r
299 $cur_feed_title = '';\r
300\r
301 $fresh_intl = get_pref($this->link, "FRESH_ARTICLE_MAX_AGE") * 60 * 60;\r
302\r
303 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info);\r
304\r
305 while ($line = db_fetch_assoc($result)) {\r
306\r
307 $class = ($lnum % 2) ? "even" : "odd";\r
308\r
309 $id = $line["id"];\r
310 $feed_id = $line["feed_id"];\r
311 $label_cache = $line["label_cache"];\r
312 $labels = false;\r
313\r
314 if ($label_cache) {\r
315 $label_cache = json_decode($label_cache, true);\r
316\r
317 if ($label_cache) {\r
318 if ($label_cache["no-labels"] == 1)\r
319 $labels = array();\r
320 else\r
321 $labels = $label_cache;\r
322 }\r
323 }\r
324\r
325 if (!is_array($labels)) $labels = get_article_labels($this->link, $id);\r
326\r
327 $labels_str = "<span id=\"HLLCTR-$id\">";\r
328 $labels_str .= format_article_labels($labels, $id);\r
329 $labels_str .= "</span>";\r
330\r
331 if (count($topmost_article_ids) < 3) {\r
332 array_push($topmost_article_ids, $id);\r
333 }\r
334\r
335 if ($line["last_read"] == "" && !sql_bool_to_bool($line["unread"])) {\r
336\r
337 $update_pic = "<img id='FUPDPIC-$id' src=\"".\r
338 theme_image($this->link, 'images/updated.png')."\"\r
339 alt=\"Updated\">";\r
340 } else {\r
341 $update_pic = "<img id='FUPDPIC-$id' src=\"images/blank_icon.gif\"\r
342 alt=\"Updated\">";\r
343 }\r
344\r
345 if (sql_bool_to_bool($line["unread"]) &&\r
346 time() - strtotime($line["updated_noms"]) < $fresh_intl) {\r
347\r
348 $update_pic = "<img id='FUPDPIC-$id' src=\"".\r
349 theme_image($this->link, 'images/fresh_sign.png')."\" alt=\"Fresh\">";\r
350 }\r
351\r
352 if ($line["unread"] == "t" || $line["unread"] == "1") {\r
353 $class .= " Unread";\r
354 ++$num_unread;\r
355 $is_unread = true;\r
356 } else {\r
357 $is_unread = false;\r
358 }\r
359\r
360 if ($line["marked"] == "t" || $line["marked"] == "1") {\r
361 $marked_pic = "<img id=\"FMPIC-$id\"\r
362 src=\"".theme_image($this->link, 'images/mark_set.png')."\"\r
363 class=\"markedPic\" alt=\"Unstar article\"\r
364 onclick='javascript:toggleMark($id)'>";\r
365 } else {\r
366 $marked_pic = "<img id=\"FMPIC-$id\"\r
367 src=\"".theme_image($this->link, 'images/mark_unset.png')."\"\r
368 class=\"markedPic\" alt=\"Star article\"\r
369 onclick='javascript:toggleMark($id)'>";\r
370 }\r
371\r
372 if ($line["published"] == "t" || $line["published"] == "1") {\r
373 $published_pic = "<img id=\"FPPIC-$id\" src=\"".theme_image($this->link,\r
374 'images/pub_set.png')."\"\r
375 class=\"markedPic\"\r
376 alt=\"Unpublish article\" onclick='javascript:togglePub($id)'>";\r
377 } else {\r
378 $published_pic = "<img id=\"FPPIC-$id\" src=\"".theme_image($this->link,\r
379 'images/pub_unset.png')."\"\r
380 class=\"markedPic\"\r
381 alt=\"Publish article\" onclick='javascript:togglePub($id)'>";\r
382 }\r
383\r
384# $content_link = "<a target=\"_blank\" href=\"".$line["link"]."\">" .\r
385# $line["title"] . "</a>";\r
386\r
387# $content_link = "<a\r
388# href=\"" . htmlspecialchars($line["link"]) . "\"\r
389# onclick=\"view($id,$feed_id);\">" .\r
390# $line["title"] . "</a>";\r
391\r
392# $content_link = "<a href=\"javascript:viewContentUrl('".$line["link"]."');\">" .\r
393# $line["title"] . "</a>";\r
394\r
395 $updated_fmt = make_local_datetime($this->link, $line["updated_noms"], false);\r
396\r
397 if (get_pref($this->link, 'SHOW_CONTENT_PREVIEW')) {\r
398 $content_preview = truncate_string(strip_tags($line["content_preview"]),\r
399 100);\r
400 }\r
401\r
402 $score = $line["score"];\r
403\r
404 $score_pic = theme_image($this->link,\r
405 "images/" . get_score_pic($score));\r
406\r
407/* $score_title = __("(Click to change)");\r
408 $score_pic = "<img class='hlScorePic' src=\"images/$score_pic\"\r
409 onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">"; */\r
410\r
411 $score_pic = "<img class='hlScorePic' src=\"$score_pic\"\r
412 title=\"$score\">";\r
413\r
414 if ($score > 500) {\r
415 $hlc_suffix = "H";\r
416 } else if ($score < -100) {\r
417 $hlc_suffix = "L";\r
418 } else {\r
419 $hlc_suffix = "";\r
420 }\r
421\r
422 $entry_author = $line["author"];\r
423\r
424 if ($entry_author) {\r
425 $entry_author = " - $entry_author";\r
426 }\r
427\r
428 $has_feed_icon = feed_has_icon($feed_id);\r
429\r
430 if ($has_feed_icon) {\r
431 $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";\r
432 } else {\r
433 $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/feed-icon-12x12.png\" alt=\"\">";\r
434 }\r
435\r
436 if (!get_pref($this->link, 'COMBINED_DISPLAY_MODE')) {\r
437\r
438 if (get_pref($this->link, 'VFEED_GROUP_BY_FEED')) {\r
439 if ($feed_id != $vgroup_last_feed && $line["feed_title"]) {\r
440\r
441 $cur_feed_title = $line["feed_title"];\r
442 $vgroup_last_feed = $feed_id;\r
443\r
444 $cur_feed_title = htmlspecialchars($cur_feed_title);\r
445\r
446 $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id);' href='#'>".__('mark as read')."</a>)";\r
447\r
448 $reply['content'] .= "<div class='cdmFeedTitle'>".\r
449 "<div style=\"float : right\">$feed_icon_img</div>".\r
450 "<a href=\"#\" onclick=\"viewfeed($feed_id)\">".\r
451 $line["feed_title"]."</a> $vf_catchup_link</div>";\r
452\r
453 }\r
454 }\r
455\r
456 $mouseover_attrs = "onmouseover='postMouseIn($id)'\r
457 onmouseout='postMouseOut($id)'";\r
458\r
459 $reply['content'] .= "<div class='$class' id='RROW-$id' $mouseover_attrs>";\r
460\r
461 $reply['content'] .= "<div class='hlUpdPic'>$update_pic</div>";\r
462\r
463 $reply['content'] .= "<div class='hlLeft'>";\r
464\r
465 $reply['content'] .= "<input type=\"checkbox\" onclick=\"tSR(this)\"\r
466 id=\"RCHK-$id\">";\r
467\r
468 $reply['content'] .= "$marked_pic";\r
469 $reply['content'] .= "$published_pic";\r
470\r
471 $reply['content'] .= "</div>";\r
472\r
473 $reply['content'] .= "<div onclick='return hlClicked(event, $id)'\r
474 class=\"hlTitle\"><span class='hlContent$hlc_suffix'>";\r
475 $reply['content'] .= "<a id=\"RTITLE-$id\"\r
476 href=\"" . htmlspecialchars($line["link"]) . "\"\r
477 onclick=\"\">" .\r
478 truncate_string($line["title"], 200);\r
479\r
480 if (get_pref($this->link, 'SHOW_CONTENT_PREVIEW')) {\r
481 if ($content_preview) {\r
482 $reply['content'] .= "<span class=\"contentPreview\"> - $content_preview</span>";\r
483 }\r
484 }\r
485\r
486 $reply['content'] .= "</a></span>";\r
487\r
488 $reply['content'] .= $labels_str;\r
489\r
490 if (!get_pref($this->link, 'VFEED_GROUP_BY_FEED') &&\r
491 defined('_SHOW_FEED_TITLE_IN_VFEEDS')) {\r
492 if (@$line["feed_title"]) {\r
493 $reply['content'] .= "<span class=\"hlFeed\">\r
494 (<a href=\"#\" onclick=\"viewfeed($feed_id)\">".\r
495 $line["feed_title"]."</a>)\r
496 </span>";\r
497 }\r
498 }\r
499\r
500 $reply['content'] .= "</div>";\r
501\r
502 $reply['content'] .= "<span class=\"hlUpdated\">$updated_fmt</span>";\r
503 $reply['content'] .= "<div class=\"hlRight\">";\r
504\r
505 $reply['content'] .= $score_pic;\r
506\r
507 if ($line["feed_title"] && !get_pref($this->link, 'VFEED_GROUP_BY_FEED')) {\r
508\r
509 $reply['content'] .= "<span onclick=\"viewfeed($feed_id)\"\r
510 style=\"cursor : pointer\"\r
511 title=\"".htmlspecialchars($line['feed_title'])."\">\r
512 $feed_icon_img<span>";\r
513 }\r
514\r
515 $reply['content'] .= "</div>";\r
516 $reply['content'] .= "</div>";\r
517\r
518 } else {\r
519\r
520 if (get_pref($this->link, 'VFEED_GROUP_BY_FEED') && $line["feed_title"]) {\r
521 if ($feed_id != $vgroup_last_feed) {\r
522\r
523 $cur_feed_title = $line["feed_title"];\r
524 $vgroup_last_feed = $feed_id;\r
525\r
526 $cur_feed_title = htmlspecialchars($cur_feed_title);\r
527\r
528 $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id);' href='#'>".__('mark as read')."</a>)";\r
529\r
530 $has_feed_icon = feed_has_icon($feed_id);\r
531\r
532 if ($has_feed_icon) {\r
533 $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";\r
534 } else {\r
535 //$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\" alt=\"\">";\r
536 }\r
537\r
538 $reply['content'] .= "<div class='cdmFeedTitle'>".\r
539 "<div style=\"float : right\">$feed_icon_img</div>".\r
540 "<a href=\"#\" onclick=\"viewfeed($feed_id)\">".\r
541 $line["feed_title"]."</a> $vf_catchup_link</div>";\r
542 }\r
543 }\r
544\r
545 $expand_cdm = get_pref($this->link, 'CDM_EXPANDED');\r
546\r
547 $mouseover_attrs = "onmouseover='postMouseIn($id)'\r
548 onmouseout='postMouseOut($id)'";\r
549\r
550 $reply['content'] .= "<div class=\"$class\"\r
551 id=\"RROW-$id\" $mouseover_attrs'>";\r
552\r
553 $reply['content'] .= "<div class=\"cdmHeader\">";\r
554\r
555 $reply['content'] .= "<div>";\r
556\r
557 $reply['content'] .= "<input type=\"checkbox\" onclick=\"toggleSelectRowById(this,\r
558 'RROW-$id')\" id=\"RCHK-$id\"/>";\r
559\r
560 $reply['content'] .= "$marked_pic";\r
561 $reply['content'] .= "$published_pic";\r
562\r
563 $reply['content'] .= "</div>";\r
564\r
565 $reply['content'] .= "<span id=\"RTITLE-$id\"\r
566 onclick=\"return cdmClicked(event, $id);\"\r
567 class=\"titleWrap$hlc_suffix\">\r
568 <a class=\"title\"\r
569 title=\"".htmlspecialchars($line['title'])."\"\r
570 target=\"_blank\" href=\"".\r
571 htmlspecialchars($line["link"])."\">".\r
572 truncate_string($line["title"], 100) .\r
573 " $entry_author</a>";\r
574\r
575 $reply['content'] .= $labels_str;\r
576\r
577 if (!get_pref($this->link, 'VFEED_GROUP_BY_FEED') &&\r
578 defined('_SHOW_FEED_TITLE_IN_VFEEDS')) {\r
579 if (@$line["feed_title"]) {\r
580 $reply['content'] .= "<span class=\"hlFeed\">\r
581 (<a href=\"#\" onclick=\"viewfeed($feed_id)\">".\r
582 $line["feed_title"]."</a>)\r
583 </span>";\r
584 }\r
585 }\r
586\r
587 if (!$expand_cdm)\r
588 $content_hidden = "style=\"display : none\"";\r
589 else\r
590 $excerpt_hidden = "style=\"display : none\"";\r
591\r
592 $reply['content'] .= "<span $excerpt_hidden\r
593 id=\"CEXC-$id\" class=\"cdmExcerpt\"> - $content_preview</span>";\r
594\r
595 $reply['content'] .= "</span>";\r
596\r
597 $reply['content'] .= "<div>";\r
598 $reply['content'] .= "<span class='updated'>$updated_fmt</span>";\r
599 $reply['content'] .= "$score_pic";\r
600\r
601 if (!get_pref($this->link, "VFEED_GROUP_BY_FEED") && $line["feed_title"]) {\r
602 $reply['content'] .= "<span style=\"cursor : pointer\"\r
603 title=\"".htmlspecialchars($line["feed_title"])."\"\r
604 onclick=\"viewfeed($feed_id)\">$feed_icon_img</span>";\r
605 }\r
606 $reply['content'] .= "<div class=\"updPic\">$update_pic</div>";\r
607 $reply['content'] .= "</div>";\r
608\r
609 $reply['content'] .= "</div>";\r
610\r
611 $reply['content'] .= "<div class=\"cdmContent\" $content_hidden\r
612 onclick=\"return cdmClicked(event, $id);\"\r
613 id=\"CICD-$id\">";\r
614\r
615 $reply['content'] .= "<div class=\"cdmContentInner\">";\r
616\r
617 if ($line["orig_feed_id"]) {\r
618\r
619 $tmp_result = db_query($this->link, "SELECT * FROM ttrss_archived_feeds\r
620 WHERE id = ".$line["orig_feed_id"]);\r
621\r
622 if (db_num_rows($tmp_result) != 0) {\r
623\r
624 $reply['content'] .= "<div clear='both'>";\r
625 $reply['content'] .= __("Originally from:");\r
626\r
627 $reply['content'] .= "&nbsp;";\r
628\r
629 $tmp_line = db_fetch_assoc($tmp_result);\r
630\r
631 $reply['content'] .= "<a target='_blank'\r
632 href=' " . htmlspecialchars($tmp_line['site_url']) . "'>" .\r
633 $tmp_line['title'] . "</a>";\r
634\r
635 $reply['content'] .= "&nbsp;";\r
636\r
637 $reply['content'] .= "<a target='_blank' href='" . htmlspecialchars($tmp_line['feed_url']) . "'>";\r
638 $reply['content'] .= "<img title='".__('Feed URL')."'class='tinyFeedIcon' src='images/pub_set.gif'></a>";\r
639\r
640 $reply['content'] .= "</div>";\r
641 }\r
642 }\r
643\r
644 $feed_site_url = $line["site_url"];\r
645\r
646 $article_content = sanitize($this->link, $line["content_preview"],\r
647 false, false, $feed_site_url);\r
648\r
649 $reply['content'] .= "<div id=\"POSTNOTE-$id\">";\r
650 if ($line['note']) {\r
651 $reply['content'] .= format_article_note($id, $line['note']);\r
652 }\r
653 $reply['content'] .= "</div>";\r
654\r
655 $reply['content'] .= "<span id=\"CWRAP-$id\">";\r
656 $reply['content'] .= $expand_cdm ? $article_content : '';\r
657 $reply['content'] .= "</span>";\r
658\r
659/* $tmp_result = db_query($this->link, "SELECT always_display_enclosures FROM\r
660 ttrss_feeds WHERE id = ".\r
661 (($line['feed_id'] == null) ? $line['orig_feed_id'] :\r
662 $line['feed_id'])." AND owner_uid = ".$_SESSION["uid"]);\r
663\r
664 $always_display_enclosures = sql_bool_to_bool(db_fetch_result($tmp_result,\r
665 0, "always_display_enclosures")); */\r
666\r
667 $always_display_enclosures = sql_bool_to_bool($line["always_display_enclosures"]);\r
668\r
669 $reply['content'] .= format_article_enclosures($this->link, $id, $always_display_enclosures,\r
670 $article_content);\r
671\r
672 $reply['content'] .= "</div>";\r
673\r
674 $reply['content'] .= "<div class=\"cdmFooter\">";\r
675\r
676 $tag_cache = $line["tag_cache"];\r
677\r
678 $tags_str = format_tags_string(\r
679 get_article_tags($this->link, $id, $_SESSION["uid"], $tag_cache),\r
680 $id);\r
681\r
682 $reply['content'] .= "<img src='".theme_image($this->link,\r
683 'images/tag.png')."' alt='Tags' title='Tags'>\r
684 <span id=\"ATSTR-$id\">$tags_str</span>\r
685 <a title=\"".__('Edit tags for this article')."\"\r
686 href=\"#\" onclick=\"editArticleTags($id, $feed_id, true)\">(+)</a>";\r
687\r
688 $num_comments = $line["num_comments"];\r
689 $entry_comments = "";\r
690\r
691 if ($num_comments > 0) {\r
692 if ($line["comments"]) {\r
693 $comments_url = $line["comments"];\r
694 } else {\r
695 $comments_url = $line["link"];\r
696 }\r
697 $entry_comments = "<a target='_blank' href=\"$comments_url\">$num_comments comments</a>";\r
698 } else {\r
699 if ($line["comments"] && $line["link"] != $line["comments"]) {\r
700 $entry_comments = "<a target='_blank' href=\"".$line["comments"]."\">comments</a>";\r
701 }\r
702 }\r
703\r
704 if ($entry_comments) $reply['content'] .= "&nbsp;($entry_comments)";\r
705\r
706 $reply['content'] .= "<div style=\"float : right\">";\r
707\r
708 $reply['content'] .= "<img src=\"images/art-zoom.png\"\r
709 onclick=\"zoomToArticle(event, $id)\"\r
710 style=\"cursor : pointer\"\r
711 alt='Zoom'\r
712 title='".__('Open article in new tab')."'>";\r
713\r
714 //$note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);\r
715\r
f9ac31d6 716 foreach ($button_plugins as $p) {\r
1baac280 717 $reply['content'] .= $p->render($id, $line);\r
79178062
AD
718 }\r
719\r
79178062
AD
720 $reply['content'] .= "<img src=\"images/digest_checkbox.png\"\r
721 style=\"cursor : pointer\" style=\"cursor : pointer\"\r
722 onclick=\"dismissArticle($id)\"\r
638e27c8 723 title='".__('Close article')."'>";\r
79178062
AD
724\r
725 $reply['content'] .= "</div>";\r
726 $reply['content'] .= "</div>";\r
727\r
728 $reply['content'] .= "</div>";\r
729\r
730 $reply['content'] .= "</div>";\r
731\r
732 }\r
733\r
734 ++$lnum;\r
735 }\r
736\r
737 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PE", $timing_info);\r
738\r
739 } else {\r
740 $message = "";\r
741\r
742 switch ($view_mode) {\r
743 case "unread":\r
744 $message = __("No unread articles found to display.");\r
745 break;\r
746 case "updated":\r
747 $message = __("No updated articles found to display.");\r
748 break;\r
749 case "marked":\r
750 $message = __("No starred articles found to display.");\r
751 break;\r
752 default:\r
753 if ($feed < -10) {\r
754 $message = __("No articles found to display. You can assign articles to labels manually (see the Actions menu above) or use a filter.");\r
755 } else {\r
756 $message = __("No articles found to display.");\r
757 }\r
758 }\r
759\r
760 if (!$offset && $message) {\r
761 $reply['content'] .= "<div class='whiteBox'>$message";\r
762\r
763 $reply['content'] .= "<p class=\"small\"><span class=\"insensitive\">";\r
764\r
765 $result = db_query($this->link, "SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds\r
766 WHERE owner_uid = " . $_SESSION['uid']);\r
767\r
768 $last_updated = db_fetch_result($result, 0, "last_updated");\r
769 $last_updated = make_local_datetime($this->link, $last_updated, false);\r
770\r
771 $reply['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated);\r
772\r
773 $result = db_query($this->link, "SELECT COUNT(id) AS num_errors\r
774 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);\r
775\r
776 $num_errors = db_fetch_result($result, 0, "num_errors");\r
777\r
778 if ($num_errors > 0) {\r
779 $reply['content'] .= "<br/>";\r
780 $reply['content'] .= "<a class=\"insensitive\" href=\"#\" onclick=\"showFeedsWithErrors()\">".\r
781 __('Some feeds have update errors (click for details)')."</a>";\r
782 }\r
783 $reply['content'] .= "</span></p></div>";\r
784 }\r
785 }\r
786\r
787 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H2", $timing_info);\r
788\r
789 return array($topmost_article_ids, $headlines_count, $feed, $disable_cache,\r
790 $vgroup_last_feed, $reply);\r
791 }\r
792\r
793 private function outputFeedList($special = true) {\r
794\r
795 $feedlist = array();\r
796\r
797 $enable_cats = get_pref($this->link, 'ENABLE_FEED_CATS');\r
798\r
799 $feedlist['identifier'] = 'id';\r
800 $feedlist['label'] = 'name';\r
801 $feedlist['items'] = array();\r
802\r
803 $owner_uid = $_SESSION["uid"];\r
804\r
805 /* virtual feeds */\r
806\r
807 if ($special) {\r
808\r
809 if ($enable_cats) {\r
810 $cat_hidden = get_pref($this->link, "_COLLAPSED_SPECIAL");\r
811 $cat = $this->feedlist_init_cat(-1, $cat_hidden);\r
812 } else {\r
813 $cat['items'] = array();\r
814 }\r
815\r
816 foreach (array(-4, -3, -1, -2, 0) as $i) {\r
817 array_push($cat['items'], $this->feedlist_init_feed($i));\r
818 }\r
819\r
820 if ($enable_cats) {\r
821 array_push($feedlist['items'], $cat);\r
822 } else {\r
823 $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);\r
824 }\r
825\r
826 $result = db_query($this->link, "SELECT * FROM\r
827 ttrss_labels2 WHERE owner_uid = '$owner_uid' ORDER by caption");\r
828\r
829 if (db_num_rows($result) > 0) {\r
830\r
831 if (get_pref($this->link, 'ENABLE_FEED_CATS')) {\r
832 $cat_hidden = get_pref($this->link, "_COLLAPSED_LABELS");\r
833 $cat = $this->feedlist_init_cat(-2, $cat_hidden);\r
834 } else {\r
835 $cat['items'] = array();\r
836 }\r
837\r
838 while ($line = db_fetch_assoc($result)) {\r
839\r
840 $label_id = -$line['id'] - 11;\r
841 $count = getFeedUnread($this->link, $label_id);\r
842\r
843 $feed = $this->feedlist_init_feed($label_id, false, $count);\r
844\r
845 $feed['fg_color'] = $line['fg_color'];\r
846 $feed['bg_color'] = $line['bg_color'];\r
847\r
848 array_push($cat['items'], $feed);\r
849 }\r
850\r
851 if ($enable_cats) {\r
852 array_push($feedlist['items'], $cat);\r
853 } else {\r
854 $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);\r
855 }\r
856 }\r
857 }\r
858\r
859/* if (get_pref($this->link, 'ENABLE_FEED_CATS')) {\r
860 if (get_pref($this->link, "FEEDS_SORT_BY_UNREAD")) {\r
861 $order_by_qpart = "order_id,category,unread DESC,title";\r
862 } else {\r
863 $order_by_qpart = "order_id,category,title";\r
864 }\r
865 } else {\r
866 if (get_pref($this->link, "FEEDS_SORT_BY_UNREAD")) {\r
867 $order_by_qpart = "unread DESC,title";\r
868 } else {\r
869 $order_by_qpart = "title";\r
870 }\r
871 } */\r
872\r
873 /* real feeds */\r
874\r
875 if ($enable_cats)\r
876 $order_by_qpart = "ttrss_feed_categories.order_id,category,\r
877 ttrss_feeds.order_id,title";\r
878 else\r
879 $order_by_qpart = "title";\r
880\r
881 $age_qpart = getMaxAgeSubquery();\r
882\r
883 $query = "SELECT ttrss_feeds.id, ttrss_feeds.title,\r
884 ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated_noms,\r
885 cat_id,last_error,\r
886 ttrss_feed_categories.title AS category,\r
887 ttrss_feed_categories.collapsed,\r
888 value AS unread\r
889 FROM ttrss_feeds LEFT JOIN ttrss_feed_categories\r
890 ON (ttrss_feed_categories.id = cat_id)\r
891 LEFT JOIN ttrss_counters_cache\r
892 ON\r
893 (ttrss_feeds.id = feed_id)\r
894 WHERE\r
895 ttrss_feeds.owner_uid = '$owner_uid'\r
896 ORDER BY $order_by_qpart";\r
897\r
898 $result = db_query($this->link, $query);\r
899\r
900 $actid = $_REQUEST["actid"];\r
901\r
902 if (db_num_rows($result) > 0) {\r
903\r
904 $category = "";\r
905\r
906 if (!$enable_cats)\r
907 $cat['items'] = array();\r
908 else\r
909 $cat = false;\r
910\r
911 while ($line = db_fetch_assoc($result)) {\r
912\r
913 $feed = htmlspecialchars(trim($line["title"]));\r
914\r
915 if (!$feed) $feed = "[Untitled]";\r
916\r
917 $feed_id = $line["id"];\r
918 $unread = $line["unread"];\r
919\r
920 $cat_id = $line["cat_id"];\r
921 $tmp_category = $line["category"];\r
922 if (!$tmp_category) $tmp_category = __("Uncategorized");\r
923\r
924 if ($category != $tmp_category && $enable_cats) {\r
925\r
926 $category = $tmp_category;\r
927\r
928 $collapsed = sql_bool_to_bool($line["collapsed"]);\r
929\r
930 // workaround for NULL category\r
931 if ($category == __("Uncategorized")) {\r
932 $collapsed = get_pref($this->link, "_COLLAPSED_UNCAT");\r
933 }\r
934\r
935 if ($cat) array_push($feedlist['items'], $cat);\r
936\r
937 $cat = $this->feedlist_init_cat($cat_id, $collapsed);\r
938 }\r
939\r
940 $updated = make_local_datetime($this->link, $line["updated_noms"], false);\r
941\r
942 array_push($cat['items'], $this->feedlist_init_feed($feed_id,\r
943 $feed, $unread, $line['last_error'], $updated));\r
944 }\r
945\r
946 if ($enable_cats) {\r
947 array_push($feedlist['items'], $cat);\r
948 } else {\r
949 $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);\r
950 }\r
951\r
952 }\r
953\r
954 return $feedlist;\r
955 }\r
956\r
957\r
3f363052
AD
958 function catchupAll() {\r
959 db_query($this->link, "UPDATE ttrss_user_entries SET\r
960 last_read = NOW(),unread = false WHERE owner_uid = " . $_SESSION["uid"]);\r
961 ccache_zero_all($this->link, $_SESSION["uid"]);\r
46da73c2 962 }\r
3f363052
AD
963\r
964 function collapse() {\r
965 $cat_id = db_escape_string($_REQUEST["cid"]);\r
966 $mode = (int) db_escape_string($_REQUEST['mode']);\r
967 toggle_collapse_cat($this->link, $cat_id, $mode);\r
968 }\r
969\r
970 function index() {\r
971 $root = (bool)$_REQUEST["root"];\r
46da73c2 972\r
3f363052 973 if (!$root) {\r
79178062 974 print json_encode($this->outputFeedList($this->link));\r
3f363052 975 } else {\r
46da73c2 976\r
79178062 977 $feeds = $this->outputFeedList($this->link, false);\r
46da73c2 978\r
3f363052
AD
979 $root = array();\r
980 $root['id'] = 'root';\r
981 $root['name'] = __('Feeds');\r
982 $root['items'] = $feeds['items'];\r
46da73c2 983\r
3f363052
AD
984 $fl = array();\r
985 $fl['identifier'] = 'id';\r
986 $fl['label'] = 'name';\r
987 $fl['items'] = array($root);\r
46da73c2 988\r
3f363052
AD
989 print json_encode($fl);\r
990 }\r
46da73c2
AD
991 }\r
992\r
3f363052
AD
993 function view() {\r
994 $timing_info = getmicrotime();\r
46da73c2 995\r
3f363052 996 $reply = array();\r
46da73c2 997\r
3f363052 998 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("0", $timing_info);\r
46da73c2 999\r
3f363052 1000 $omode = db_escape_string($_REQUEST["omode"]);\r
46da73c2 1001\r
3f363052
AD
1002 $feed = db_escape_string($_REQUEST["feed"]);\r
1003 $method = db_escape_string($_REQUEST["m"]);\r
1004 $view_mode = db_escape_string($_REQUEST["view_mode"]);\r
1005 $limit = (int) get_pref($this->link, "DEFAULT_ARTICLE_LIMIT");\r
1006 @$cat_view = db_escape_string($_REQUEST["cat"]) == "true";\r
1007 @$next_unread_feed = db_escape_string($_REQUEST["nuf"]);\r
1008 @$offset = db_escape_string($_REQUEST["skip"]);\r
1009 @$vgroup_last_feed = db_escape_string($_REQUEST["vgrlf"]);\r
1010 $order_by = db_escape_string($_REQUEST["order_by"]);\r
46da73c2 1011\r
3f363052 1012 if (is_numeric($feed)) $feed = (int) $feed;\r
46da73c2 1013\r
3f363052
AD
1014 /* Feed -5 is a special case: it is used to display auxiliary information\r
1015 * when there's nothing to load - e.g. no stuff in fresh feed */\r
46da73c2 1016\r
3f363052
AD
1017 if ($feed == -5) {\r
1018 print json_encode(generate_dashboard_feed($this->link));\r
1019 return;\r
1020 }\r
46da73c2 1021\r
3f363052 1022 $result = false;\r
46da73c2 1023\r
3f363052
AD
1024 if ($feed < -10) {\r
1025 $label_feed = -11-$feed;\r
1026 $result = db_query($this->link, "SELECT id FROM ttrss_labels2 WHERE\r
1027 id = '$label_feed' AND owner_uid = " . $_SESSION['uid']);\r
1028 } else if (!$cat_view && is_numeric($feed) && $feed > 0) {\r
1029 $result = db_query($this->link, "SELECT id FROM ttrss_feeds WHERE\r
1030 id = '$feed' AND owner_uid = " . $_SESSION['uid']);\r
1031 } else if ($cat_view && is_numeric($feed) && $feed > 0) {\r
1032 $result = db_query($this->link, "SELECT id FROM ttrss_feed_categories WHERE\r
1033 id = '$feed' AND owner_uid = " . $_SESSION['uid']);\r
1034 }\r
46da73c2 1035\r
3f363052
AD
1036 if ($result && db_num_rows($result) == 0) {\r
1037 print json_encode(generate_error_feed($this->link, __("Feed not found.")));\r
1038 return;\r
1039 }\r
46da73c2 1040\r
3f363052
AD
1041 /* Updating a label ccache means recalculating all of the caches\r
1042 * so for performance reasons we don't do that here */\r
46da73c2 1043\r
3f363052
AD
1044 if ($feed >= 0) {\r
1045 ccache_update($this->link, $feed, $_SESSION["uid"], $cat_view);\r
1046 }\r
46da73c2 1047\r
3f363052
AD
1048 set_pref($this->link, "_DEFAULT_VIEW_MODE", $view_mode);\r
1049 set_pref($this->link, "_DEFAULT_VIEW_LIMIT", $limit);\r
1050 set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);\r
46da73c2 1051\r
3f363052
AD
1052 if (!$cat_view && preg_match("/^[0-9][0-9]*$/", $feed)) {\r
1053 db_query($this->link, "UPDATE ttrss_feeds SET last_viewed = NOW()\r
1054 WHERE id = '$feed' AND owner_uid = ".$_SESSION["uid"]);\r
1055 }\r
46da73c2 1056\r
3f363052 1057 $reply['headlines'] = array();\r
46da73c2 1058\r
3f363052
AD
1059 if (!$next_unread_feed)\r
1060 $reply['headlines']['id'] = $feed;\r
1061 else\r
1062 $reply['headlines']['id'] = $next_unread_feed;\r
46da73c2 1063\r
3f363052 1064 $reply['headlines']['is_cat'] = (bool) $cat_view;\r
46da73c2 1065\r
3f363052 1066 $override_order = false;\r
46da73c2 1067\r
3f363052
AD
1068 if (get_pref($this->link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) {\r
1069 $date_sort_field = "updated";\r
1070 } else {\r
1071 $date_sort_field = "date_entered";\r
1072 }\r
46da73c2 1073\r
3f363052
AD
1074 switch ($order_by) {\r
1075 case "date":\r
1076 if (get_pref($this->link, 'REVERSE_HEADLINES', $owner_uid)) {\r
1077 $override_order = "$date_sort_field";\r
1078 } else {\r
1079 $override_order = "$date_sort_field DESC";\r
1080 }\r
1081 break;\r
46da73c2 1082\r
3f363052
AD
1083 case "title":\r
1084 if (get_pref($this->link, 'REVERSE_HEADLINES', $owner_uid)) {\r
1085 $override_order = "title DESC, $date_sort_field";\r
1086 } else {\r
1087 $override_order = "title, $date_sort_field DESC";\r
1088 }\r
1089 break;\r
46da73c2 1090\r
3f363052
AD
1091 case "score":\r
1092 if (get_pref($this->link, 'REVERSE_HEADLINES', $owner_uid)) {\r
1093 $override_order = "score, $date_sort_field";\r
1094 } else {\r
1095 $override_order = "score DESC, $date_sort_field DESC";\r
1096 }\r
1097 break;\r
1098 }\r
46da73c2 1099\r
3f363052 1100 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("04", $timing_info);\r
46da73c2 1101\r
79178062 1102 $ret = $this->format_headlines_list($feed, $method,\r
3f363052
AD
1103 $view_mode, $limit, $cat_view, $next_unread_feed, $offset,\r
1104 $vgroup_last_feed, $override_order);\r
46da73c2 1105\r
3f363052
AD
1106 $topmost_article_ids = $ret[0];\r
1107 $headlines_count = $ret[1];\r
1108 $returned_feed = $ret[2];\r
1109 $disable_cache = $ret[3];\r
1110 $vgroup_last_feed = $ret[4];\r
46da73c2 1111\r
3f363052
AD
1112 $reply['headlines']['content'] =& $ret[5]['content'];\r
1113 $reply['headlines']['toolbar'] =& $ret[5]['toolbar'];\r
46da73c2 1114\r
3f363052 1115 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("05", $timing_info);\r
46da73c2 1116\r
3f363052
AD
1117 $reply['headlines-info'] = array("count" => (int) $headlines_count,\r
1118 "vgroup_last_feed" => $vgroup_last_feed,\r
1119 "disable_cache" => (bool) $disable_cache);\r
46da73c2 1120\r
3f363052 1121 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("20", $timing_info);\r
46da73c2 1122\r
3f363052
AD
1123 if (is_array($topmost_article_ids) && !get_pref($this->link, 'COMBINED_DISPLAY_MODE') && !$_SESSION["bw_limit"]) {\r
1124 $articles = array();\r
46da73c2 1125\r
3f363052
AD
1126 foreach ($topmost_article_ids as $id) {\r
1127 array_push($articles, format_article($this->link, $id, false));\r
1128 }\r
46da73c2 1129\r
3f363052
AD
1130 $reply['articles'] = $articles;\r
1131 }\r
46da73c2 1132\r
3f363052 1133 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("30", $timing_info);\r
46da73c2 1134\r
3f363052 1135 $reply['runtime-info'] = make_runtime_info($this->link);\r
46da73c2 1136\r
3f363052 1137 print json_encode($reply);\r
46da73c2 1138\r
3f363052
AD
1139 }\r
1140}\r
46da73c2 1141?>\r