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