]> git.wh0rd.org - tt-rss.git/blame - classes/feeds.php
tweak headlines-toolbar appearance
[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
275 if (db_num_rows($result) > 0) {\r
276\r
277 $lnum = $offset;\r
278\r
279 $num_unread = 0;\r
280 $cur_feed_title = '';\r
281\r
282 $fresh_intl = get_pref($this->link, "FRESH_ARTICLE_MAX_AGE") * 60 * 60;\r
283\r
284 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info);\r
285\r
286 while ($line = db_fetch_assoc($result)) {\r
287\r
288 $class = ($lnum % 2) ? "even" : "odd";\r
289\r
290 $id = $line["id"];\r
291 $feed_id = $line["feed_id"];\r
292 $label_cache = $line["label_cache"];\r
293 $labels = false;\r
294\r
295 if ($label_cache) {\r
296 $label_cache = json_decode($label_cache, true);\r
297\r
298 if ($label_cache) {\r
299 if ($label_cache["no-labels"] == 1)\r
300 $labels = array();\r
301 else\r
302 $labels = $label_cache;\r
303 }\r
304 }\r
305\r
306 if (!is_array($labels)) $labels = get_article_labels($this->link, $id);\r
307\r
308 $labels_str = "<span id=\"HLLCTR-$id\">";\r
309 $labels_str .= format_article_labels($labels, $id);\r
310 $labels_str .= "</span>";\r
311\r
312 if (count($topmost_article_ids) < 3) {\r
313 array_push($topmost_article_ids, $id);\r
314 }\r
315\r
316 if ($line["last_read"] == "" && !sql_bool_to_bool($line["unread"])) {\r
317\r
318 $update_pic = "<img id='FUPDPIC-$id' src=\"".\r
319 theme_image($this->link, 'images/updated.png')."\"\r
320 alt=\"Updated\">";\r
321 } else {\r
322 $update_pic = "<img id='FUPDPIC-$id' src=\"images/blank_icon.gif\"\r
323 alt=\"Updated\">";\r
324 }\r
325\r
326 if (sql_bool_to_bool($line["unread"]) &&\r
327 time() - strtotime($line["updated_noms"]) < $fresh_intl) {\r
328\r
329 $update_pic = "<img id='FUPDPIC-$id' src=\"".\r
330 theme_image($this->link, 'images/fresh_sign.png')."\" alt=\"Fresh\">";\r
331 }\r
332\r
333 if ($line["unread"] == "t" || $line["unread"] == "1") {\r
334 $class .= " Unread";\r
335 ++$num_unread;\r
336 $is_unread = true;\r
337 } else {\r
338 $is_unread = false;\r
339 }\r
340\r
341 if ($line["marked"] == "t" || $line["marked"] == "1") {\r
342 $marked_pic = "<img id=\"FMPIC-$id\"\r
343 src=\"".theme_image($this->link, 'images/mark_set.png')."\"\r
344 class=\"markedPic\" alt=\"Unstar article\"\r
345 onclick='javascript:toggleMark($id)'>";\r
346 } else {\r
347 $marked_pic = "<img id=\"FMPIC-$id\"\r
348 src=\"".theme_image($this->link, 'images/mark_unset.png')."\"\r
349 class=\"markedPic\" alt=\"Star article\"\r
350 onclick='javascript:toggleMark($id)'>";\r
351 }\r
352\r
353 if ($line["published"] == "t" || $line["published"] == "1") {\r
354 $published_pic = "<img id=\"FPPIC-$id\" src=\"".theme_image($this->link,\r
355 'images/pub_set.png')."\"\r
356 class=\"markedPic\"\r
357 alt=\"Unpublish article\" onclick='javascript:togglePub($id)'>";\r
358 } else {\r
359 $published_pic = "<img id=\"FPPIC-$id\" src=\"".theme_image($this->link,\r
360 'images/pub_unset.png')."\"\r
361 class=\"markedPic\"\r
362 alt=\"Publish article\" onclick='javascript:togglePub($id)'>";\r
363 }\r
364\r
365# $content_link = "<a target=\"_blank\" href=\"".$line["link"]."\">" .\r
366# $line["title"] . "</a>";\r
367\r
368# $content_link = "<a\r
369# href=\"" . htmlspecialchars($line["link"]) . "\"\r
370# onclick=\"view($id,$feed_id);\">" .\r
371# $line["title"] . "</a>";\r
372\r
373# $content_link = "<a href=\"javascript:viewContentUrl('".$line["link"]."');\">" .\r
374# $line["title"] . "</a>";\r
375\r
376 $updated_fmt = make_local_datetime($this->link, $line["updated_noms"], false);\r
377\r
378 if (get_pref($this->link, 'SHOW_CONTENT_PREVIEW')) {\r
379 $content_preview = truncate_string(strip_tags($line["content_preview"]),\r
380 100);\r
381 }\r
382\r
383 $score = $line["score"];\r
384\r
385 $score_pic = theme_image($this->link,\r
386 "images/" . get_score_pic($score));\r
387\r
388/* $score_title = __("(Click to change)");\r
389 $score_pic = "<img class='hlScorePic' src=\"images/$score_pic\"\r
390 onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">"; */\r
391\r
392 $score_pic = "<img class='hlScorePic' src=\"$score_pic\"\r
393 title=\"$score\">";\r
394\r
395 if ($score > 500) {\r
396 $hlc_suffix = "H";\r
397 } else if ($score < -100) {\r
398 $hlc_suffix = "L";\r
399 } else {\r
400 $hlc_suffix = "";\r
401 }\r
402\r
403 $entry_author = $line["author"];\r
404\r
405 if ($entry_author) {\r
406 $entry_author = " - $entry_author";\r
407 }\r
408\r
409 $has_feed_icon = feed_has_icon($feed_id);\r
410\r
411 if ($has_feed_icon) {\r
412 $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";\r
413 } else {\r
414 $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/feed-icon-12x12.png\" alt=\"\">";\r
415 }\r
416\r
417 if (!get_pref($this->link, 'COMBINED_DISPLAY_MODE')) {\r
418\r
419 if (get_pref($this->link, 'VFEED_GROUP_BY_FEED')) {\r
420 if ($feed_id != $vgroup_last_feed && $line["feed_title"]) {\r
421\r
422 $cur_feed_title = $line["feed_title"];\r
423 $vgroup_last_feed = $feed_id;\r
424\r
425 $cur_feed_title = htmlspecialchars($cur_feed_title);\r
426\r
427 $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id);' href='#'>".__('mark as read')."</a>)";\r
428\r
429 $reply['content'] .= "<div class='cdmFeedTitle'>".\r
430 "<div style=\"float : right\">$feed_icon_img</div>".\r
431 "<a href=\"#\" onclick=\"viewfeed($feed_id)\">".\r
432 $line["feed_title"]."</a> $vf_catchup_link</div>";\r
433\r
434 }\r
435 }\r
436\r
437 $mouseover_attrs = "onmouseover='postMouseIn($id)'\r
438 onmouseout='postMouseOut($id)'";\r
439\r
440 $reply['content'] .= "<div class='$class' id='RROW-$id' $mouseover_attrs>";\r
441\r
442 $reply['content'] .= "<div class='hlUpdPic'>$update_pic</div>";\r
443\r
444 $reply['content'] .= "<div class='hlLeft'>";\r
445\r
446 $reply['content'] .= "<input type=\"checkbox\" onclick=\"tSR(this)\"\r
447 id=\"RCHK-$id\">";\r
448\r
449 $reply['content'] .= "$marked_pic";\r
450 $reply['content'] .= "$published_pic";\r
451\r
452 $reply['content'] .= "</div>";\r
453\r
454 $reply['content'] .= "<div onclick='return hlClicked(event, $id)'\r
455 class=\"hlTitle\"><span class='hlContent$hlc_suffix'>";\r
456 $reply['content'] .= "<a id=\"RTITLE-$id\"\r
457 href=\"" . htmlspecialchars($line["link"]) . "\"\r
458 onclick=\"\">" .\r
459 truncate_string($line["title"], 200);\r
460\r
461 if (get_pref($this->link, 'SHOW_CONTENT_PREVIEW')) {\r
462 if ($content_preview) {\r
463 $reply['content'] .= "<span class=\"contentPreview\"> - $content_preview</span>";\r
464 }\r
465 }\r
466\r
467 $reply['content'] .= "</a></span>";\r
468\r
469 $reply['content'] .= $labels_str;\r
470\r
471 if (!get_pref($this->link, 'VFEED_GROUP_BY_FEED') &&\r
472 defined('_SHOW_FEED_TITLE_IN_VFEEDS')) {\r
473 if (@$line["feed_title"]) {\r
474 $reply['content'] .= "<span class=\"hlFeed\">\r
475 (<a href=\"#\" onclick=\"viewfeed($feed_id)\">".\r
476 $line["feed_title"]."</a>)\r
477 </span>";\r
478 }\r
479 }\r
480\r
481 $reply['content'] .= "</div>";\r
482\r
483 $reply['content'] .= "<span class=\"hlUpdated\">$updated_fmt</span>";\r
484 $reply['content'] .= "<div class=\"hlRight\">";\r
485\r
486 $reply['content'] .= $score_pic;\r
487\r
488 if ($line["feed_title"] && !get_pref($this->link, 'VFEED_GROUP_BY_FEED')) {\r
489\r
490 $reply['content'] .= "<span onclick=\"viewfeed($feed_id)\"\r
491 style=\"cursor : pointer\"\r
492 title=\"".htmlspecialchars($line['feed_title'])."\">\r
493 $feed_icon_img<span>";\r
494 }\r
495\r
496 $reply['content'] .= "</div>";\r
497 $reply['content'] .= "</div>";\r
498\r
499 } else {\r
500\r
501 if (get_pref($this->link, 'VFEED_GROUP_BY_FEED') && $line["feed_title"]) {\r
502 if ($feed_id != $vgroup_last_feed) {\r
503\r
504 $cur_feed_title = $line["feed_title"];\r
505 $vgroup_last_feed = $feed_id;\r
506\r
507 $cur_feed_title = htmlspecialchars($cur_feed_title);\r
508\r
509 $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id);' href='#'>".__('mark as read')."</a>)";\r
510\r
511 $has_feed_icon = feed_has_icon($feed_id);\r
512\r
513 if ($has_feed_icon) {\r
514 $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";\r
515 } else {\r
516 //$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\" alt=\"\">";\r
517 }\r
518\r
519 $reply['content'] .= "<div class='cdmFeedTitle'>".\r
520 "<div style=\"float : right\">$feed_icon_img</div>".\r
521 "<a href=\"#\" onclick=\"viewfeed($feed_id)\">".\r
522 $line["feed_title"]."</a> $vf_catchup_link</div>";\r
523 }\r
524 }\r
525\r
526 $expand_cdm = get_pref($this->link, 'CDM_EXPANDED');\r
527\r
528 $mouseover_attrs = "onmouseover='postMouseIn($id)'\r
529 onmouseout='postMouseOut($id)'";\r
530\r
531 $reply['content'] .= "<div class=\"$class\"\r
532 id=\"RROW-$id\" $mouseover_attrs'>";\r
533\r
534 $reply['content'] .= "<div class=\"cdmHeader\">";\r
535\r
536 $reply['content'] .= "<div>";\r
537\r
538 $reply['content'] .= "<input type=\"checkbox\" onclick=\"toggleSelectRowById(this,\r
539 'RROW-$id')\" id=\"RCHK-$id\"/>";\r
540\r
541 $reply['content'] .= "$marked_pic";\r
542 $reply['content'] .= "$published_pic";\r
543\r
544 $reply['content'] .= "</div>";\r
545\r
546 $reply['content'] .= "<span id=\"RTITLE-$id\"\r
547 onclick=\"return cdmClicked(event, $id);\"\r
548 class=\"titleWrap$hlc_suffix\">\r
549 <a class=\"title\"\r
550 title=\"".htmlspecialchars($line['title'])."\"\r
551 target=\"_blank\" href=\"".\r
552 htmlspecialchars($line["link"])."\">".\r
553 truncate_string($line["title"], 100) .\r
554 " $entry_author</a>";\r
555\r
556 $reply['content'] .= $labels_str;\r
557\r
558 if (!get_pref($this->link, 'VFEED_GROUP_BY_FEED') &&\r
559 defined('_SHOW_FEED_TITLE_IN_VFEEDS')) {\r
560 if (@$line["feed_title"]) {\r
561 $reply['content'] .= "<span class=\"hlFeed\">\r
562 (<a href=\"#\" onclick=\"viewfeed($feed_id)\">".\r
563 $line["feed_title"]."</a>)\r
564 </span>";\r
565 }\r
566 }\r
567\r
568 if (!$expand_cdm)\r
569 $content_hidden = "style=\"display : none\"";\r
570 else\r
571 $excerpt_hidden = "style=\"display : none\"";\r
572\r
573 $reply['content'] .= "<span $excerpt_hidden\r
574 id=\"CEXC-$id\" class=\"cdmExcerpt\"> - $content_preview</span>";\r
575\r
576 $reply['content'] .= "</span>";\r
577\r
578 $reply['content'] .= "<div>";\r
579 $reply['content'] .= "<span class='updated'>$updated_fmt</span>";\r
580 $reply['content'] .= "$score_pic";\r
581\r
582 if (!get_pref($this->link, "VFEED_GROUP_BY_FEED") && $line["feed_title"]) {\r
583 $reply['content'] .= "<span style=\"cursor : pointer\"\r
584 title=\"".htmlspecialchars($line["feed_title"])."\"\r
585 onclick=\"viewfeed($feed_id)\">$feed_icon_img</span>";\r
586 }\r
587 $reply['content'] .= "<div class=\"updPic\">$update_pic</div>";\r
588 $reply['content'] .= "</div>";\r
589\r
590 $reply['content'] .= "</div>";\r
591\r
592 $reply['content'] .= "<div class=\"cdmContent\" $content_hidden\r
593 onclick=\"return cdmClicked(event, $id);\"\r
594 id=\"CICD-$id\">";\r
595\r
596 $reply['content'] .= "<div class=\"cdmContentInner\">";\r
597\r
598 if ($line["orig_feed_id"]) {\r
599\r
600 $tmp_result = db_query($this->link, "SELECT * FROM ttrss_archived_feeds\r
601 WHERE id = ".$line["orig_feed_id"]);\r
602\r
603 if (db_num_rows($tmp_result) != 0) {\r
604\r
605 $reply['content'] .= "<div clear='both'>";\r
606 $reply['content'] .= __("Originally from:");\r
607\r
608 $reply['content'] .= "&nbsp;";\r
609\r
610 $tmp_line = db_fetch_assoc($tmp_result);\r
611\r
612 $reply['content'] .= "<a target='_blank'\r
613 href=' " . htmlspecialchars($tmp_line['site_url']) . "'>" .\r
614 $tmp_line['title'] . "</a>";\r
615\r
616 $reply['content'] .= "&nbsp;";\r
617\r
618 $reply['content'] .= "<a target='_blank' href='" . htmlspecialchars($tmp_line['feed_url']) . "'>";\r
619 $reply['content'] .= "<img title='".__('Feed URL')."'class='tinyFeedIcon' src='images/pub_set.gif'></a>";\r
620\r
621 $reply['content'] .= "</div>";\r
622 }\r
623 }\r
624\r
625 $feed_site_url = $line["site_url"];\r
626\r
627 $article_content = sanitize($this->link, $line["content_preview"],\r
628 false, false, $feed_site_url);\r
629\r
630 $reply['content'] .= "<div id=\"POSTNOTE-$id\">";\r
631 if ($line['note']) {\r
632 $reply['content'] .= format_article_note($id, $line['note']);\r
633 }\r
634 $reply['content'] .= "</div>";\r
635\r
636 $reply['content'] .= "<span id=\"CWRAP-$id\">";\r
637 $reply['content'] .= $expand_cdm ? $article_content : '';\r
638 $reply['content'] .= "</span>";\r
639\r
640/* $tmp_result = db_query($this->link, "SELECT always_display_enclosures FROM\r
641 ttrss_feeds WHERE id = ".\r
642 (($line['feed_id'] == null) ? $line['orig_feed_id'] :\r
643 $line['feed_id'])." AND owner_uid = ".$_SESSION["uid"]);\r
644\r
645 $always_display_enclosures = sql_bool_to_bool(db_fetch_result($tmp_result,\r
646 0, "always_display_enclosures")); */\r
647\r
648 $always_display_enclosures = sql_bool_to_bool($line["always_display_enclosures"]);\r
649\r
650 $reply['content'] .= format_article_enclosures($this->link, $id, $always_display_enclosures,\r
651 $article_content);\r
652\r
653 $reply['content'] .= "</div>";\r
654\r
655 $reply['content'] .= "<div class=\"cdmFooter\">";\r
656\r
657 $tag_cache = $line["tag_cache"];\r
658\r
659 $tags_str = format_tags_string(\r
660 get_article_tags($this->link, $id, $_SESSION["uid"], $tag_cache),\r
661 $id);\r
662\r
663 $reply['content'] .= "<img src='".theme_image($this->link,\r
664 'images/tag.png')."' alt='Tags' title='Tags'>\r
665 <span id=\"ATSTR-$id\">$tags_str</span>\r
666 <a title=\"".__('Edit tags for this article')."\"\r
667 href=\"#\" onclick=\"editArticleTags($id, $feed_id, true)\">(+)</a>";\r
668\r
669 $num_comments = $line["num_comments"];\r
670 $entry_comments = "";\r
671\r
672 if ($num_comments > 0) {\r
673 if ($line["comments"]) {\r
674 $comments_url = $line["comments"];\r
675 } else {\r
676 $comments_url = $line["link"];\r
677 }\r
678 $entry_comments = "<a target='_blank' href=\"$comments_url\">$num_comments comments</a>";\r
679 } else {\r
680 if ($line["comments"] && $line["link"] != $line["comments"]) {\r
681 $entry_comments = "<a target='_blank' href=\"".$line["comments"]."\">comments</a>";\r
682 }\r
683 }\r
684\r
685 if ($entry_comments) $reply['content'] .= "&nbsp;($entry_comments)";\r
686\r
687 $reply['content'] .= "<div style=\"float : right\">";\r
688\r
689 $reply['content'] .= "<img src=\"images/art-zoom.png\"\r
690 onclick=\"zoomToArticle(event, $id)\"\r
691 style=\"cursor : pointer\"\r
692 alt='Zoom'\r
693 title='".__('Open article in new tab')."'>";\r
694\r
695 //$note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);\r
696\r
697 $reply['content'] .= "<img src=\"images/art-pub-note.png\"\r
698 style=\"cursor : pointer\" style=\"cursor : pointer\"\r
699 onclick=\"editArticleNote($id)\"\r
700 alt='PubNote' title='".__('Edit article note')."'>";\r
701\r
09e8bdfd
AD
702 $reply['content'] .= "<img src=\"".theme_image($this->link, 'images/art-email.png')."\"\r
703 style=\"cursor : pointer\"\r
704 onclick=\"emailArticle($id)\"\r
705 alt='Zoom' title='".__('Forward by email')."'>";\r
79178062
AD
706\r
707 if (ENABLE_TWEET_BUTTON) {\r
708 $reply['content'] .= "<img src=\"".theme_image($this->link, 'images/art-tweet.png')."\"\r
709 class='tagsPic' style=\"cursor : pointer\"\r
710 onclick=\"tweetArticle($id)\"\r
711 alt='Zoom' title='".__('Share on Twitter')."'>";\r
712 }\r
713\r
714 $reply['content'] .= "<img src=\"".theme_image($this->link, 'images/art-share.png')."\"\r
715 class='tagsPic' style=\"cursor : pointer\"\r
716 onclick=\"shareArticle(".$line['int_id'].")\"\r
717 alt='Zoom' title='".__('Share by URL')."'>";\r
718\r
719 $reply['content'] .= "<img src=\"images/digest_checkbox.png\"\r
720 style=\"cursor : pointer\" style=\"cursor : pointer\"\r
721 onclick=\"dismissArticle($id)\"\r
722 alt='Dismiss' title='".__('Dismiss article')."'>";\r
723\r
724 $reply['content'] .= "</div>";\r
725 $reply['content'] .= "</div>";\r
726\r
727 $reply['content'] .= "</div>";\r
728\r
729 $reply['content'] .= "</div>";\r
730\r
731 }\r
732\r
733 ++$lnum;\r
734 }\r
735\r
736 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PE", $timing_info);\r
737\r
738 } else {\r
739 $message = "";\r
740\r
741 switch ($view_mode) {\r
742 case "unread":\r
743 $message = __("No unread articles found to display.");\r
744 break;\r
745 case "updated":\r
746 $message = __("No updated articles found to display.");\r
747 break;\r
748 case "marked":\r
749 $message = __("No starred articles found to display.");\r
750 break;\r
751 default:\r
752 if ($feed < -10) {\r
753 $message = __("No articles found to display. You can assign articles to labels manually (see the Actions menu above) or use a filter.");\r
754 } else {\r
755 $message = __("No articles found to display.");\r
756 }\r
757 }\r
758\r
759 if (!$offset && $message) {\r
760 $reply['content'] .= "<div class='whiteBox'>$message";\r
761\r
762 $reply['content'] .= "<p class=\"small\"><span class=\"insensitive\">";\r
763\r
764 $result = db_query($this->link, "SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds\r
765 WHERE owner_uid = " . $_SESSION['uid']);\r
766\r
767 $last_updated = db_fetch_result($result, 0, "last_updated");\r
768 $last_updated = make_local_datetime($this->link, $last_updated, false);\r
769\r
770 $reply['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated);\r
771\r
772 $result = db_query($this->link, "SELECT COUNT(id) AS num_errors\r
773 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);\r
774\r
775 $num_errors = db_fetch_result($result, 0, "num_errors");\r
776\r
777 if ($num_errors > 0) {\r
778 $reply['content'] .= "<br/>";\r
779 $reply['content'] .= "<a class=\"insensitive\" href=\"#\" onclick=\"showFeedsWithErrors()\">".\r
780 __('Some feeds have update errors (click for details)')."</a>";\r
781 }\r
782 $reply['content'] .= "</span></p></div>";\r
783 }\r
784 }\r
785\r
786 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H2", $timing_info);\r
787\r
788 return array($topmost_article_ids, $headlines_count, $feed, $disable_cache,\r
789 $vgroup_last_feed, $reply);\r
790 }\r
791\r
792 private function outputFeedList($special = true) {\r
793\r
794 $feedlist = array();\r
795\r
796 $enable_cats = get_pref($this->link, 'ENABLE_FEED_CATS');\r
797\r
798 $feedlist['identifier'] = 'id';\r
799 $feedlist['label'] = 'name';\r
800 $feedlist['items'] = array();\r
801\r
802 $owner_uid = $_SESSION["uid"];\r
803\r
804 /* virtual feeds */\r
805\r
806 if ($special) {\r
807\r
808 if ($enable_cats) {\r
809 $cat_hidden = get_pref($this->link, "_COLLAPSED_SPECIAL");\r
810 $cat = $this->feedlist_init_cat(-1, $cat_hidden);\r
811 } else {\r
812 $cat['items'] = array();\r
813 }\r
814\r
815 foreach (array(-4, -3, -1, -2, 0) as $i) {\r
816 array_push($cat['items'], $this->feedlist_init_feed($i));\r
817 }\r
818\r
819 if ($enable_cats) {\r
820 array_push($feedlist['items'], $cat);\r
821 } else {\r
822 $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);\r
823 }\r
824\r
825 $result = db_query($this->link, "SELECT * FROM\r
826 ttrss_labels2 WHERE owner_uid = '$owner_uid' ORDER by caption");\r
827\r
828 if (db_num_rows($result) > 0) {\r
829\r
830 if (get_pref($this->link, 'ENABLE_FEED_CATS')) {\r
831 $cat_hidden = get_pref($this->link, "_COLLAPSED_LABELS");\r
832 $cat = $this->feedlist_init_cat(-2, $cat_hidden);\r
833 } else {\r
834 $cat['items'] = array();\r
835 }\r
836\r
837 while ($line = db_fetch_assoc($result)) {\r
838\r
839 $label_id = -$line['id'] - 11;\r
840 $count = getFeedUnread($this->link, $label_id);\r
841\r
842 $feed = $this->feedlist_init_feed($label_id, false, $count);\r
843\r
844 $feed['fg_color'] = $line['fg_color'];\r
845 $feed['bg_color'] = $line['bg_color'];\r
846\r
847 array_push($cat['items'], $feed);\r
848 }\r
849\r
850 if ($enable_cats) {\r
851 array_push($feedlist['items'], $cat);\r
852 } else {\r
853 $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);\r
854 }\r
855 }\r
856 }\r
857\r
858/* if (get_pref($this->link, 'ENABLE_FEED_CATS')) {\r
859 if (get_pref($this->link, "FEEDS_SORT_BY_UNREAD")) {\r
860 $order_by_qpart = "order_id,category,unread DESC,title";\r
861 } else {\r
862 $order_by_qpart = "order_id,category,title";\r
863 }\r
864 } else {\r
865 if (get_pref($this->link, "FEEDS_SORT_BY_UNREAD")) {\r
866 $order_by_qpart = "unread DESC,title";\r
867 } else {\r
868 $order_by_qpart = "title";\r
869 }\r
870 } */\r
871\r
872 /* real feeds */\r
873\r
874 if ($enable_cats)\r
875 $order_by_qpart = "ttrss_feed_categories.order_id,category,\r
876 ttrss_feeds.order_id,title";\r
877 else\r
878 $order_by_qpart = "title";\r
879\r
880 $age_qpart = getMaxAgeSubquery();\r
881\r
882 $query = "SELECT ttrss_feeds.id, ttrss_feeds.title,\r
883 ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated_noms,\r
884 cat_id,last_error,\r
885 ttrss_feed_categories.title AS category,\r
886 ttrss_feed_categories.collapsed,\r
887 value AS unread\r
888 FROM ttrss_feeds LEFT JOIN ttrss_feed_categories\r
889 ON (ttrss_feed_categories.id = cat_id)\r
890 LEFT JOIN ttrss_counters_cache\r
891 ON\r
892 (ttrss_feeds.id = feed_id)\r
893 WHERE\r
894 ttrss_feeds.owner_uid = '$owner_uid'\r
895 ORDER BY $order_by_qpart";\r
896\r
897 $result = db_query($this->link, $query);\r
898\r
899 $actid = $_REQUEST["actid"];\r
900\r
901 if (db_num_rows($result) > 0) {\r
902\r
903 $category = "";\r
904\r
905 if (!$enable_cats)\r
906 $cat['items'] = array();\r
907 else\r
908 $cat = false;\r
909\r
910 while ($line = db_fetch_assoc($result)) {\r
911\r
912 $feed = htmlspecialchars(trim($line["title"]));\r
913\r
914 if (!$feed) $feed = "[Untitled]";\r
915\r
916 $feed_id = $line["id"];\r
917 $unread = $line["unread"];\r
918\r
919 $cat_id = $line["cat_id"];\r
920 $tmp_category = $line["category"];\r
921 if (!$tmp_category) $tmp_category = __("Uncategorized");\r
922\r
923 if ($category != $tmp_category && $enable_cats) {\r
924\r
925 $category = $tmp_category;\r
926\r
927 $collapsed = sql_bool_to_bool($line["collapsed"]);\r
928\r
929 // workaround for NULL category\r
930 if ($category == __("Uncategorized")) {\r
931 $collapsed = get_pref($this->link, "_COLLAPSED_UNCAT");\r
932 }\r
933\r
934 if ($cat) array_push($feedlist['items'], $cat);\r
935\r
936 $cat = $this->feedlist_init_cat($cat_id, $collapsed);\r
937 }\r
938\r
939 $updated = make_local_datetime($this->link, $line["updated_noms"], false);\r
940\r
941 array_push($cat['items'], $this->feedlist_init_feed($feed_id,\r
942 $feed, $unread, $line['last_error'], $updated));\r
943 }\r
944\r
945 if ($enable_cats) {\r
946 array_push($feedlist['items'], $cat);\r
947 } else {\r
948 $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);\r
949 }\r
950\r
951 }\r
952\r
953 return $feedlist;\r
954 }\r
955\r
956\r
3f363052
AD
957 function catchupAll() {\r
958 db_query($this->link, "UPDATE ttrss_user_entries SET\r
959 last_read = NOW(),unread = false WHERE owner_uid = " . $_SESSION["uid"]);\r
960 ccache_zero_all($this->link, $_SESSION["uid"]);\r
46da73c2 961 }\r
3f363052
AD
962\r
963 function collapse() {\r
964 $cat_id = db_escape_string($_REQUEST["cid"]);\r
965 $mode = (int) db_escape_string($_REQUEST['mode']);\r
966 toggle_collapse_cat($this->link, $cat_id, $mode);\r
967 }\r
968\r
969 function index() {\r
970 $root = (bool)$_REQUEST["root"];\r
46da73c2 971\r
3f363052 972 if (!$root) {\r
79178062 973 print json_encode($this->outputFeedList($this->link));\r
3f363052 974 } else {\r
46da73c2 975\r
79178062 976 $feeds = $this->outputFeedList($this->link, false);\r
46da73c2 977\r
3f363052
AD
978 $root = array();\r
979 $root['id'] = 'root';\r
980 $root['name'] = __('Feeds');\r
981 $root['items'] = $feeds['items'];\r
46da73c2 982\r
3f363052
AD
983 $fl = array();\r
984 $fl['identifier'] = 'id';\r
985 $fl['label'] = 'name';\r
986 $fl['items'] = array($root);\r
46da73c2 987\r
3f363052
AD
988 print json_encode($fl);\r
989 }\r
46da73c2
AD
990 }\r
991\r
3f363052
AD
992 function view() {\r
993 $timing_info = getmicrotime();\r
46da73c2 994\r
3f363052 995 $reply = array();\r
46da73c2 996\r
3f363052 997 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("0", $timing_info);\r
46da73c2 998\r
3f363052 999 $omode = db_escape_string($_REQUEST["omode"]);\r
46da73c2 1000\r
3f363052
AD
1001 $feed = db_escape_string($_REQUEST["feed"]);\r
1002 $method = db_escape_string($_REQUEST["m"]);\r
1003 $view_mode = db_escape_string($_REQUEST["view_mode"]);\r
1004 $limit = (int) get_pref($this->link, "DEFAULT_ARTICLE_LIMIT");\r
1005 @$cat_view = db_escape_string($_REQUEST["cat"]) == "true";\r
1006 @$next_unread_feed = db_escape_string($_REQUEST["nuf"]);\r
1007 @$offset = db_escape_string($_REQUEST["skip"]);\r
1008 @$vgroup_last_feed = db_escape_string($_REQUEST["vgrlf"]);\r
1009 $order_by = db_escape_string($_REQUEST["order_by"]);\r
46da73c2 1010\r
3f363052 1011 if (is_numeric($feed)) $feed = (int) $feed;\r
46da73c2 1012\r
3f363052
AD
1013 /* Feed -5 is a special case: it is used to display auxiliary information\r
1014 * when there's nothing to load - e.g. no stuff in fresh feed */\r
46da73c2 1015\r
3f363052
AD
1016 if ($feed == -5) {\r
1017 print json_encode(generate_dashboard_feed($this->link));\r
1018 return;\r
1019 }\r
46da73c2 1020\r
3f363052 1021 $result = false;\r
46da73c2 1022\r
3f363052
AD
1023 if ($feed < -10) {\r
1024 $label_feed = -11-$feed;\r
1025 $result = db_query($this->link, "SELECT id FROM ttrss_labels2 WHERE\r
1026 id = '$label_feed' AND owner_uid = " . $_SESSION['uid']);\r
1027 } else if (!$cat_view && is_numeric($feed) && $feed > 0) {\r
1028 $result = db_query($this->link, "SELECT id FROM ttrss_feeds WHERE\r
1029 id = '$feed' AND owner_uid = " . $_SESSION['uid']);\r
1030 } else if ($cat_view && is_numeric($feed) && $feed > 0) {\r
1031 $result = db_query($this->link, "SELECT id FROM ttrss_feed_categories WHERE\r
1032 id = '$feed' AND owner_uid = " . $_SESSION['uid']);\r
1033 }\r
46da73c2 1034\r
3f363052
AD
1035 if ($result && db_num_rows($result) == 0) {\r
1036 print json_encode(generate_error_feed($this->link, __("Feed not found.")));\r
1037 return;\r
1038 }\r
46da73c2 1039\r
3f363052
AD
1040 /* Updating a label ccache means recalculating all of the caches\r
1041 * so for performance reasons we don't do that here */\r
46da73c2 1042\r
3f363052
AD
1043 if ($feed >= 0) {\r
1044 ccache_update($this->link, $feed, $_SESSION["uid"], $cat_view);\r
1045 }\r
46da73c2 1046\r
3f363052
AD
1047 set_pref($this->link, "_DEFAULT_VIEW_MODE", $view_mode);\r
1048 set_pref($this->link, "_DEFAULT_VIEW_LIMIT", $limit);\r
1049 set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);\r
46da73c2 1050\r
3f363052
AD
1051 if (!$cat_view && preg_match("/^[0-9][0-9]*$/", $feed)) {\r
1052 db_query($this->link, "UPDATE ttrss_feeds SET last_viewed = NOW()\r
1053 WHERE id = '$feed' AND owner_uid = ".$_SESSION["uid"]);\r
1054 }\r
46da73c2 1055\r
3f363052 1056 $reply['headlines'] = array();\r
46da73c2 1057\r
3f363052
AD
1058 if (!$next_unread_feed)\r
1059 $reply['headlines']['id'] = $feed;\r
1060 else\r
1061 $reply['headlines']['id'] = $next_unread_feed;\r
46da73c2 1062\r
3f363052 1063 $reply['headlines']['is_cat'] = (bool) $cat_view;\r
46da73c2 1064\r
3f363052 1065 $override_order = false;\r
46da73c2 1066\r
3f363052
AD
1067 if (get_pref($this->link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) {\r
1068 $date_sort_field = "updated";\r
1069 } else {\r
1070 $date_sort_field = "date_entered";\r
1071 }\r
46da73c2 1072\r
3f363052
AD
1073 switch ($order_by) {\r
1074 case "date":\r
1075 if (get_pref($this->link, 'REVERSE_HEADLINES', $owner_uid)) {\r
1076 $override_order = "$date_sort_field";\r
1077 } else {\r
1078 $override_order = "$date_sort_field DESC";\r
1079 }\r
1080 break;\r
46da73c2 1081\r
3f363052
AD
1082 case "title":\r
1083 if (get_pref($this->link, 'REVERSE_HEADLINES', $owner_uid)) {\r
1084 $override_order = "title DESC, $date_sort_field";\r
1085 } else {\r
1086 $override_order = "title, $date_sort_field DESC";\r
1087 }\r
1088 break;\r
46da73c2 1089\r
3f363052
AD
1090 case "score":\r
1091 if (get_pref($this->link, 'REVERSE_HEADLINES', $owner_uid)) {\r
1092 $override_order = "score, $date_sort_field";\r
1093 } else {\r
1094 $override_order = "score DESC, $date_sort_field DESC";\r
1095 }\r
1096 break;\r
1097 }\r
46da73c2 1098\r
3f363052 1099 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("04", $timing_info);\r
46da73c2 1100\r
79178062 1101 $ret = $this->format_headlines_list($feed, $method,\r
3f363052
AD
1102 $view_mode, $limit, $cat_view, $next_unread_feed, $offset,\r
1103 $vgroup_last_feed, $override_order);\r
46da73c2 1104\r
3f363052
AD
1105 $topmost_article_ids = $ret[0];\r
1106 $headlines_count = $ret[1];\r
1107 $returned_feed = $ret[2];\r
1108 $disable_cache = $ret[3];\r
1109 $vgroup_last_feed = $ret[4];\r
46da73c2 1110\r
3f363052
AD
1111 $reply['headlines']['content'] =& $ret[5]['content'];\r
1112 $reply['headlines']['toolbar'] =& $ret[5]['toolbar'];\r
46da73c2 1113\r
3f363052 1114 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("05", $timing_info);\r
46da73c2 1115\r
3f363052
AD
1116 $reply['headlines-info'] = array("count" => (int) $headlines_count,\r
1117 "vgroup_last_feed" => $vgroup_last_feed,\r
1118 "disable_cache" => (bool) $disable_cache);\r
46da73c2 1119\r
3f363052 1120 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("20", $timing_info);\r
46da73c2 1121\r
3f363052
AD
1122 if (is_array($topmost_article_ids) && !get_pref($this->link, 'COMBINED_DISPLAY_MODE') && !$_SESSION["bw_limit"]) {\r
1123 $articles = array();\r
46da73c2 1124\r
3f363052
AD
1125 foreach ($topmost_article_ids as $id) {\r
1126 array_push($articles, format_article($this->link, $id, false));\r
1127 }\r
46da73c2 1128\r
3f363052
AD
1129 $reply['articles'] = $articles;\r
1130 }\r
46da73c2 1131\r
3f363052 1132 if ($_REQUEST["debug"]) $timing_info = print_checkpoint("30", $timing_info);\r
46da73c2 1133\r
3f363052 1134 $reply['runtime-info'] = make_runtime_info($this->link);\r
46da73c2 1135\r
3f363052 1136 print json_encode($reply);\r
46da73c2 1137\r
3f363052
AD
1138 }\r
1139}\r
46da73c2 1140?>\r