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