feeds.php 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. <?php
  2. require_once "colors.php";
  3. class Feeds extends Handler_Protected {
  4. function csrf_ignore($method) {
  5. $csrf_ignored = array("index", "feedbrowser", "quickaddfeed", "search");
  6. return array_search($method, $csrf_ignored) !== false;
  7. }
  8. private function format_headline_subtoolbar($feed_site_url, $feed_title,
  9. $feed_id, $is_cat, $search,
  10. $search_mode, $view_mode, $error, $feed_last_updated) {
  11. $catchup_sel_link = "catchupSelection()";
  12. $archive_sel_link = "archiveSelection()";
  13. $delete_sel_link = "deleteSelection()";
  14. $sel_all_link = "selectArticles('all')";
  15. $sel_unread_link = "selectArticles('unread')";
  16. $sel_none_link = "selectArticles('none')";
  17. $sel_inv_link = "selectArticles('invert')";
  18. $tog_unread_link = "selectionToggleUnread()";
  19. $tog_marked_link = "selectionToggleMarked()";
  20. $tog_published_link = "selectionTogglePublished()";
  21. $set_score_link = "setSelectionScore()";
  22. if ($is_cat) $cat_q = "&is_cat=$is_cat";
  23. if ($search) {
  24. $search_q = "&q=$search&smode=$search_mode";
  25. } else {
  26. $search_q = "";
  27. }
  28. $reply .= "<span class=\"holder\">";
  29. $rss_link = htmlspecialchars(get_self_url_prefix() .
  30. "/public.php?op=rss&id=$feed_id$cat_q$search_q");
  31. // right part
  32. $error_class = $error ? "error" : "";
  33. $reply .= "<span class='r'>
  34. <a href=\"#\"
  35. title=\"".__("View as RSS feed")."\"
  36. onclick=\"displayDlg('".__("View as RSS")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">
  37. <img class=\"noborder\" src=\"images/pub_set.png\"></a>";
  38. # $reply .= "<span>";
  39. $reply .= "<span id='feed_title' class='$error_class'>";
  40. if ($feed_site_url) {
  41. $last_updated = T_sprintf("Last updated: %s",
  42. $feed_last_updated);
  43. $target = "target=\"_blank\"";
  44. $reply .= "<a title=\"$last_updated\" $target href=\"$feed_site_url\">".
  45. truncate_string($feed_title, 30)."</a>";
  46. if ($error) {
  47. $error = htmlspecialchars($error);
  48. $reply .= "&nbsp;<img title=\"$error\" src='images/error.png' alt='error' class=\"noborder\">";
  49. }
  50. } else {
  51. $reply .= $feed_title;
  52. }
  53. $reply .= "</span>";
  54. $reply .= "</span>";
  55. # $reply .= "</span>";
  56. // left part
  57. $reply .= "<span class=\"main\">";
  58. $reply .= "<span id='selected_prompt'></span>";
  59. $reply .= "
  60. <a href=\"#\" onclick=\"$sel_all_link\">".__('All')."</a>,
  61. <a href=\"#\" onclick=\"$sel_unread_link\">".__('Unread')."</a>,
  62. <a href=\"#\" onclick=\"$sel_inv_link\">".__('Invert')."</a>,
  63. <a href=\"#\" onclick=\"$sel_none_link\">".__('None')."</a></li>";
  64. $reply .= " ";
  65. $reply .= "<select dojoType=\"dijit.form.Select\"
  66. onchange=\"headlineActionsChange(this)\">";
  67. $reply .= "<option value=\"false\">".__('More...')."</option>";
  68. $reply .= "<option value=\"0\" disabled=\"1\">".__('Selection toggle:')."</option>";
  69. $reply .= "<option value=\"$tog_unread_link\">".__('Unread')."</option>
  70. <option value=\"$tog_marked_link\">".__('Starred')."</option>
  71. <option value=\"$tog_published_link\">".__('Published')."</option>";
  72. $reply .= "<option value=\"0\" disabled=\"1\">".__('Selection:')."</option>";
  73. $reply .= "<option value=\"$catchup_sel_link\">".__('Mark as read')."</option>";
  74. $reply .= "<option value=\"$set_score_link\">".__('Set score')."</option>";
  75. if ($feed_id != "0") {
  76. $reply .= "<option value=\"$archive_sel_link\">".__('Archive')."</option>";
  77. } else {
  78. $reply .= "<option value=\"$archive_sel_link\">".__('Move back')."</option>";
  79. $reply .= "<option value=\"$delete_sel_link\">".__('Delete')."</option>";
  80. }
  81. if (PluginHost::getInstance()->get_plugin("mail")) {
  82. $reply .= "<option value=\"emailArticle(false)\">".__('Forward by email').
  83. "</option>";
  84. }
  85. if (PluginHost::getInstance()->get_plugin("mailto")) {
  86. $reply .= "<option value=\"mailtoArticle(false)\">".__('Forward by email').
  87. "</option>";
  88. }
  89. $reply .= "<option value=\"0\" disabled=\"1\">".__('Feed:')."</option>";
  90. //$reply .= "<option value=\"catchupPage()\">".__('Mark as read')."</option>";
  91. $reply .= "<option value=\"displayDlg('".__("View as RSS")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">".__('View as RSS')."</option>";
  92. $reply .= "</select>";
  93. //$reply .= "</h2";
  94. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HEADLINE_TOOLBAR_BUTTON) as $p) {
  95. echo $p->hook_headline_toolbar_button($feed_id, $is_cat);
  96. }
  97. $reply .= "</span></span>";
  98. return $reply;
  99. }
  100. private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view,
  101. $next_unread_feed, $offset, $vgr_last_feed = false,
  102. $override_order = false, $include_children = false) {
  103. if (isset($_REQUEST["DevForceUpdate"]))
  104. header("Content-Type: text/plain; charset=utf-8");
  105. $disable_cache = false;
  106. $reply = array();
  107. $rgba_cache = array();
  108. $timing_info = microtime(true);
  109. $topmost_article_ids = array();
  110. if (!$offset) $offset = 0;
  111. if ($method == "undefined") $method = "";
  112. $method_split = explode(":", $method);
  113. if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {
  114. // Update the feed if required with some basic flood control
  115. $result = $this->dbh->query(
  116. "SELECT cache_images,".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
  117. FROM ttrss_feeds WHERE id = '$feed'");
  118. if ($this->dbh->num_rows($result) != 0) {
  119. $last_updated = strtotime($this->dbh->fetch_result($result, 0, "last_updated"));
  120. $cache_images = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "cache_images"));
  121. if (!$cache_images && time() - $last_updated > 120 || isset($_REQUEST['DevForceUpdate'])) {
  122. include "rssfuncs.php";
  123. update_rss_feed($feed, true, true);
  124. } else {
  125. $this->dbh->query("UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
  126. WHERE id = '$feed'");
  127. }
  128. }
  129. }
  130. if ($method_split[0] == "MarkAllReadGR") {
  131. catchup_feed($method_split[1], false);
  132. }
  133. // FIXME: might break tag display?
  134. if (is_numeric($feed) && $feed > 0 && !$cat_view) {
  135. $result = $this->dbh->query(
  136. "SELECT id FROM ttrss_feeds WHERE id = '$feed' LIMIT 1");
  137. if ($this->dbh->num_rows($result) == 0) {
  138. $reply['content'] = "<div align='center'>".__('Feed not found.')."</div>";
  139. }
  140. }
  141. @$search = $this->dbh->escape_string($_REQUEST["query"]);
  142. if ($search) {
  143. $disable_cache = true;
  144. }
  145. @$search_mode = $this->dbh->escape_string($_REQUEST["search_mode"]);
  146. if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H0", $timing_info);
  147. // error_log("format_headlines_list: [" . $feed . "] method [" . $method . "]");
  148. if($search_mode == '' && $method != '' ){
  149. $search_mode = $method;
  150. }
  151. // error_log("search_mode: " . $search_mode);
  152. if (!$cat_view && is_numeric($feed) && $feed < PLUGIN_FEED_BASE_INDEX && $feed > LABEL_BASE_INDEX) {
  153. $handler = PluginHost::getInstance()->get_feed_handler(
  154. PluginHost::feed_to_pfeed_id($feed));
  155. // function queryFeedHeadlines($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) {
  156. if ($handler) {
  157. $options = array(
  158. "limit" => $limit,
  159. "view_mode" => $view_mode,
  160. "cat_view" => $cat_view,
  161. "search" => $search,
  162. "search_mode" => $search_mode,
  163. "override_order" => $override_order,
  164. "offset" => $offset,
  165. "owner_uid" => $_SESSION["uid"],
  166. "filter" => false,
  167. "since_id" => 0,
  168. "include_children" => $include_children);
  169. $qfh_ret = $handler->get_headlines(PluginHost::feed_to_pfeed_id($feed),
  170. $options);
  171. }
  172. } else {
  173. $qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $cat_view,
  174. $search, $search_mode, $override_order, $offset, 0,
  175. false, 0, $include_children);
  176. }
  177. $vfeed_group_enabled = get_pref("VFEED_GROUP_BY_FEED") && $feed != -6;
  178. if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H1", $timing_info);
  179. $result = $qfh_ret[0];
  180. $feed_title = $qfh_ret[1];
  181. $feed_site_url = $qfh_ret[2];
  182. $last_error = $qfh_ret[3];
  183. $last_updated = strpos($qfh_ret[4], '1970-') === FALSE ?
  184. make_local_datetime($qfh_ret[4], false) : __("Never");
  185. $highlight_words = $qfh_ret[5];
  186. $vgroup_last_feed = $vgr_last_feed;
  187. $reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url,
  188. $feed_title,
  189. $feed, $cat_view, $search, $search_mode, $view_mode,
  190. $last_error, $last_updated);
  191. $headlines_count = $this->dbh->num_rows($result);
  192. /* if (get_pref('COMBINED_DISPLAY_MODE')) {
  193. $button_plugins = array();
  194. foreach (explode(",", ARTICLE_BUTTON_PLUGINS) as $p) {
  195. $pclass = "button_" . trim($p);
  196. if (class_exists($pclass)) {
  197. $plugin = new $pclass();
  198. array_push($button_plugins, $plugin);
  199. }
  200. }
  201. } */
  202. if ($this->dbh->num_rows($result) > 0) {
  203. $lnum = $offset;
  204. $num_unread = 0;
  205. $cur_feed_title = '';
  206. if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info);
  207. $expand_cdm = get_pref('CDM_EXPANDED');
  208. while ($line = $this->dbh->fetch_assoc($result)) {
  209. $line["content_preview"] = "&mdash; " . truncate_string(strip_tags($line["content"]), 250);
  210. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
  211. $line = $p->hook_query_headlines($line, 250, false);
  212. }
  213. if (get_pref('SHOW_CONTENT_PREVIEW')) {
  214. $content_preview = $line["content_preview"];
  215. }
  216. $id = $line["id"];
  217. $feed_id = $line["feed_id"];
  218. $label_cache = $line["label_cache"];
  219. $labels = false;
  220. if ($label_cache) {
  221. $label_cache = json_decode($label_cache, true);
  222. if ($label_cache) {
  223. if ($label_cache["no-labels"] == 1)
  224. $labels = array();
  225. else
  226. $labels = $label_cache;
  227. }
  228. }
  229. if (!is_array($labels)) $labels = get_article_labels($id);
  230. $labels_str = "<span class=\"HLLCTR-$id\">";
  231. $labels_str .= format_article_labels($labels, $id);
  232. $labels_str .= "</span>";
  233. if (count($topmost_article_ids) < 3) {
  234. array_push($topmost_article_ids, $id);
  235. }
  236. $class = "";
  237. if (sql_bool_to_bool($line["unread"])) {
  238. $class .= " Unread";
  239. ++$num_unread;
  240. }
  241. if (sql_bool_to_bool($line["marked"])) {
  242. $marked_pic = "<img
  243. src=\"images/mark_set.png\"
  244. class=\"markedPic\" alt=\"Unstar article\"
  245. onclick='toggleMark($id)'>";
  246. $class .= " marked";
  247. } else {
  248. $marked_pic = "<img
  249. src=\"images/mark_unset.png\"
  250. class=\"markedPic\" alt=\"Star article\"
  251. onclick='toggleMark($id)'>";
  252. }
  253. if (sql_bool_to_bool($line["published"])) {
  254. $published_pic = "<img src=\"images/pub_set.png\"
  255. class=\"pubPic\"
  256. alt=\"Unpublish article\" onclick='togglePub($id)'>";
  257. $class .= " published";
  258. } else {
  259. $published_pic = "<img src=\"images/pub_unset.png\"
  260. class=\"pubPic\"
  261. alt=\"Publish article\" onclick='togglePub($id)'>";
  262. }
  263. # $content_link = "<a target=\"_blank\" href=\"".$line["link"]."\">" .
  264. # $line["title"] . "</a>";
  265. # $content_link = "<a
  266. # href=\"" . htmlspecialchars($line["link"]) . "\"
  267. # onclick=\"view($id,$feed_id);\">" .
  268. # $line["title"] . "</a>";
  269. # $content_link = "<a href=\"javascript:viewContentUrl('".$line["link"]."');\">" .
  270. # $line["title"] . "</a>";
  271. $updated_fmt = make_local_datetime($line["updated"], false);
  272. $date_entered_fmt = T_sprintf("Imported at %s",
  273. make_local_datetime($line["date_entered"], false));
  274. $score = $line["score"];
  275. $score_pic = "images/" . get_score_pic($score);
  276. /* $score_title = __("(Click to change)");
  277. $score_pic = "<img class='hlScorePic' src=\"images/$score_pic\"
  278. onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">"; */
  279. $score_pic = "<img class='hlScorePic' score='$score' onclick='changeScore($id, this)' src=\"$score_pic\"
  280. title=\"$score\">";
  281. if ($score > 500) {
  282. $hlc_suffix = "high";
  283. } else if ($score < -100) {
  284. $hlc_suffix = "low";
  285. } else {
  286. $hlc_suffix = "";
  287. }
  288. $entry_author = $line["author"];
  289. if ($entry_author) {
  290. $entry_author = " &mdash; $entry_author";
  291. }
  292. $has_feed_icon = feed_has_icon($feed_id);
  293. if ($has_feed_icon) {
  294. $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";
  295. } else {
  296. $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/pub_set.png\" alt=\"\">";
  297. }
  298. $entry_site_url = $line["site_url"];
  299. //setting feed headline background color, needs to change text color based on dark/light
  300. $fav_color = $line['favicon_avg_color'];
  301. require_once "colors.php";
  302. if ($fav_color && $fav_color != 'fail') {
  303. if (!isset($rgba_cache[$feed_id])) {
  304. $rgba_cache[$feed_id] = join(",", _color_unpack($fav_color));
  305. }
  306. }
  307. if (!get_pref('COMBINED_DISPLAY_MODE')) {
  308. if ($vfeed_group_enabled) {
  309. if ($feed_id != $vgroup_last_feed && $line["feed_title"]) {
  310. $cur_feed_title = $line["feed_title"];
  311. $vgroup_last_feed = $feed_id;
  312. $cur_feed_title = htmlspecialchars($cur_feed_title);
  313. $vf_catchup_link = "<a class='catchup' onclick='catchupFeedInGroup($feed_id);' href='#'>".__('mark feed as read')."</a>";
  314. $reply['content'] .= "<div id='FTITLE-$feed_id' class='cdmFeedTitle'>".
  315. "<div style='float : right'>$feed_icon_img</div>".
  316. "<a class='title' href=\"#\" onclick=\"viewfeed($feed_id)\">". $line["feed_title"]."</a>
  317. $vf_catchup_link</div>";
  318. }
  319. }
  320. $mouseover_attrs = "onmouseover='postMouseIn(event, $id)'
  321. onmouseout='postMouseOut($id)'";
  322. $reply['content'] .= "<div class='hl $class' orig-feed-id='$feed_id' id='RROW-$id' $mouseover_attrs>";
  323. $reply['content'] .= "<div class='hlLeft'>";
  324. $reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\"
  325. type=\"checkbox\" onclick=\"toggleSelectRow2(this)\"
  326. class='rchk'>";
  327. $reply['content'] .= "$marked_pic";
  328. $reply['content'] .= "$published_pic";
  329. $reply['content'] .= "</div>";
  330. $reply['content'] .= "<div onclick='return hlClicked(event, $id)'
  331. class=\"hlTitle\"><span class='hlContent $hlc_suffix'>";
  332. $reply['content'] .= "<a id=\"RTITLE-$id\" class=\"title $hlc_suffix\"
  333. href=\"" . htmlspecialchars($line["link"]) . "\"
  334. onclick=\"\">" .
  335. truncate_string($line["title"], 200);
  336. if (get_pref('SHOW_CONTENT_PREVIEW')) {
  337. $reply['content'] .= "<span class=\"contentPreview\">" . $line["content_preview"] . "</span>";
  338. }
  339. $reply['content'] .= "</a></span>";
  340. $reply['content'] .= $labels_str;
  341. $reply['content'] .= "</div>";
  342. if (!$vfeed_group_enabled) {
  343. if (@$line["feed_title"]) {
  344. $rgba = @$rgba_cache[$feed_id];
  345. $reply['content'] .= "<span class=\"hlFeed\"><a style=\"background : rgba($rgba, 0.3)\" href=\"#\" onclick=\"viewfeed($feed_id)\">".
  346. truncate_string($line["feed_title"],30)."</a></span>";
  347. }
  348. }
  349. $reply['content'] .= "<span class=\"hlUpdated\">";
  350. $reply['content'] .= "<div title='$date_entered_fmt'>$updated_fmt</div>
  351. </span>";
  352. $reply['content'] .= "<div class=\"hlRight\">";
  353. $reply['content'] .= $score_pic;
  354. if ($line["feed_title"] && !$vfeed_group_enabled) {
  355. $reply['content'] .= "<span onclick=\"viewfeed($feed_id)\"
  356. style=\"cursor : pointer\"
  357. title=\"".htmlspecialchars($line['feed_title'])."\">
  358. $feed_icon_img</span>";
  359. }
  360. $reply['content'] .= "</div>";
  361. $reply['content'] .= "</div>";
  362. } else {
  363. if ($line["tag_cache"])
  364. $tags = explode(",", $line["tag_cache"]);
  365. else
  366. $tags = false;
  367. $line["content"] = sanitize($line["content"],
  368. sql_bool_to_bool($line['hide_images']), false, $entry_site_url, $highlight_words, $line["id"]);
  369. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) {
  370. $line = $p->hook_render_article_cdm($line);
  371. }
  372. if ($vfeed_group_enabled && $line["feed_title"]) {
  373. if ($feed_id != $vgroup_last_feed) {
  374. $cur_feed_title = $line["feed_title"];
  375. $vgroup_last_feed = $feed_id;
  376. $cur_feed_title = htmlspecialchars($cur_feed_title);
  377. $vf_catchup_link = "<a class='catchup' onclick='catchupFeedInGroup($feed_id);' href='#'>".__('mark feed as read')."</a>";
  378. $has_feed_icon = feed_has_icon($feed_id);
  379. if ($has_feed_icon) {
  380. $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";
  381. } else {
  382. //$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\" alt=\"\">";
  383. }
  384. $reply['content'] .= "<div id='FTITLE-$feed_id' class='cdmFeedTitle'>".
  385. "<div style=\"float : right\">$feed_icon_img</div>".
  386. "<a href=\"#\" class='title' onclick=\"viewfeed($feed_id)\">".
  387. $line["feed_title"]."</a> $vf_catchup_link</div>";
  388. }
  389. }
  390. $mouseover_attrs = "onmouseover='postMouseIn(event, $id)'
  391. onmouseout='postMouseOut($id)'";
  392. $expanded_class = $expand_cdm ? "expanded" : "expandable";
  393. $reply['content'] .= "<div class=\"cdm $hlc_suffix $expanded_class $class\"
  394. id=\"RROW-$id\" orig-feed-id='$feed_id' $mouseover_attrs>";
  395. $reply['content'] .= "<div class=\"cdmHeader\">";
  396. $reply['content'] .= "<div style=\"vertical-align : middle\">";
  397. $reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\"
  398. type=\"checkbox\" onclick=\"toggleSelectRow2(this, false, true)\"
  399. class='rchk'>";
  400. $reply['content'] .= "$marked_pic";
  401. $reply['content'] .= "$published_pic";
  402. $reply['content'] .= "</div>";
  403. if ($highlight_words && count($highlight_words > 0)) {
  404. foreach ($highlight_words as $word) {
  405. $line["title"] = preg_replace("/(\Q$word\E)/i",
  406. "<span class=\"highlight\">$1</span>", $line["title"]);
  407. }
  408. }
  409. $reply['content'] .= "<span id=\"RTITLE-$id\"
  410. onclick=\"return cdmClicked(event, $id);\"
  411. class=\"titleWrap $hlc_suffix\">
  412. <a class=\"title $hlc_suffix\"
  413. target=\"_blank\" href=\"".
  414. htmlspecialchars($line["link"])."\">".
  415. $line["title"] .
  416. "</a> <span class=\"author\">$entry_author</span>";
  417. $reply['content'] .= $labels_str;
  418. $reply['content'] .= "<span class='collapseBtn' style='display : none'>
  419. <img src=\"images/collapse.png\" onclick=\"cdmCollapseArticle(event, $id)\"
  420. title=\"".__("Collapse article")."\"/></span>";
  421. if (!$expand_cdm)
  422. $content_hidden = "style=\"display : none\"";
  423. else
  424. $excerpt_hidden = "style=\"display : none\"";
  425. $reply['content'] .= "<span $excerpt_hidden id=\"CEXC-$id\" class=\"cdmExcerpt\">" . $content_preview . "</span>";
  426. $reply['content'] .= "</span>";
  427. if (!$vfeed_group_enabled) {
  428. if (@$line["feed_title"]) {
  429. $rgba = @$rgba_cache[$feed_id];
  430. $reply['content'] .= "<div class=\"hlFeed\">
  431. <a href=\"#\" style=\"background-color: rgba($rgba,0.3)\"
  432. onclick=\"viewfeed($feed_id)\">".
  433. truncate_string($line["feed_title"],30)."</a>
  434. </div>";
  435. }
  436. }
  437. $reply['content'] .= "<span class='updated' title='$date_entered_fmt'>
  438. $updated_fmt</span>";
  439. $reply['content'] .= "<div class='scoreWrap' style=\"vertical-align : middle\">";
  440. $reply['content'] .= "$score_pic";
  441. if (!get_pref("VFEED_GROUP_BY_FEED") && $line["feed_title"]) {
  442. $reply['content'] .= "<span style=\"cursor : pointer\"
  443. title=\"".htmlspecialchars($line["feed_title"])."\"
  444. onclick=\"viewfeed($feed_id)\">$feed_icon_img</span>";
  445. }
  446. $reply['content'] .= "</div>";
  447. $reply['content'] .= "</div>";
  448. $reply['content'] .= "<div class=\"cdmContent\" $content_hidden
  449. onclick=\"return cdmClicked(event, $id);\"
  450. id=\"CICD-$id\">";
  451. $reply['content'] .= "<div id=\"POSTNOTE-$id\">";
  452. if ($line['note']) {
  453. $reply['content'] .= format_article_note($id, $line['note']);
  454. }
  455. $reply['content'] .= "</div>";
  456. if (!$line['lang']) $line['lang'] = 'en';
  457. $reply['content'] .= "<div class=\"cdmContentInner\" lang=\"".$line['lang']."\">";
  458. if ($line["orig_feed_id"]) {
  459. $tmp_result = $this->dbh->query("SELECT * FROM ttrss_archived_feeds
  460. WHERE id = ".$line["orig_feed_id"]);
  461. if ($this->dbh->num_rows($tmp_result) != 0) {
  462. $reply['content'] .= "<div clear='both'>";
  463. $reply['content'] .= __("Originally from:");
  464. $reply['content'] .= "&nbsp;";
  465. $tmp_line = $this->dbh->fetch_assoc($tmp_result);
  466. $reply['content'] .= "<a target='_blank'
  467. href=' " . htmlspecialchars($tmp_line['site_url']) . "'>" .
  468. $tmp_line['title'] . "</a>";
  469. $reply['content'] .= "&nbsp;";
  470. $reply['content'] .= "<a target='_blank' href='" . htmlspecialchars($tmp_line['feed_url']) . "'>";
  471. $reply['content'] .= "<img title='".__('Feed URL')."'class='tinyFeedIcon' src='images/pub_unset.png'></a>";
  472. $reply['content'] .= "</div>";
  473. }
  474. }
  475. $reply['content'] .= "<span id=\"CWRAP-$id\">";
  476. // if (!$expand_cdm) {
  477. $reply['content'] .= "<span id=\"CENCW-$id\" style=\"display : none\">";
  478. $reply['content'] .= htmlspecialchars($line["content"]);
  479. $reply['content'] .= "</span.";
  480. // } else {
  481. // $reply['content'] .= $line["content"];
  482. // }
  483. $reply['content'] .= "</span>";
  484. $always_display_enclosures = sql_bool_to_bool($line["always_display_enclosures"]);
  485. $reply['content'] .= format_article_enclosures($id, $always_display_enclosures, $line["content"], sql_bool_to_bool($line["hide_images"]));
  486. $reply['content'] .= "</div>";
  487. $reply['content'] .= "<div class=\"cdmFooter\">";
  488. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) {
  489. $reply['content'] .= $p->hook_article_left_button($line);
  490. }
  491. $tags_str = format_tags_string($tags, $id);
  492. $reply['content'] .= "<img src='images/tag.png' alt='Tags' title='Tags'>
  493. <span id=\"ATSTR-$id\">$tags_str</span>
  494. <a title=\"".__('Edit tags for this article')."\"
  495. href=\"#\" onclick=\"editArticleTags($id)\">(+)</a>";
  496. $num_comments = $line["num_comments"];
  497. $entry_comments = "";
  498. if ($num_comments > 0) {
  499. if ($line["comments"]) {
  500. $comments_url = htmlspecialchars($line["comments"]);
  501. } else {
  502. $comments_url = htmlspecialchars($line["link"]);
  503. }
  504. $entry_comments = "<a class=\"postComments\"
  505. target='_blank' href=\"$comments_url\">$num_comments ".
  506. _ngettext("comment", "comments", $num_comments)."</a>";
  507. } else {
  508. if ($line["comments"] && $line["link"] != $line["comments"]) {
  509. $entry_comments = "<a class=\"postComments\" target='_blank' href=\"".htmlspecialchars($line["comments"])."\">".__("comments")."</a>";
  510. }
  511. }
  512. if ($entry_comments) $reply['content'] .= "&nbsp;($entry_comments)";
  513. $reply['content'] .= "<div style=\"float : right\">";
  514. // $reply['content'] .= "$marked_pic";
  515. // $reply['content'] .= "$published_pic";
  516. foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) {
  517. $reply['content'] .= $p->hook_article_button($line);
  518. }
  519. $reply['content'] .= "</div>";
  520. $reply['content'] .= "</div>";
  521. $reply['content'] .= "</div>";
  522. $reply['content'] .= "</div>";
  523. }
  524. ++$lnum;
  525. }
  526. if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PE", $timing_info);
  527. } else {
  528. $message = "";
  529. switch ($view_mode) {
  530. case "unread":
  531. $message = __("No unread articles found to display.");
  532. break;
  533. case "updated":
  534. $message = __("No updated articles found to display.");
  535. break;
  536. case "marked":
  537. $message = __("No starred articles found to display.");
  538. break;
  539. default:
  540. if ($feed < LABEL_BASE_INDEX) {
  541. $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.");
  542. } else {
  543. $message = __("No articles found to display.");
  544. }
  545. }
  546. if (!$offset && $message) {
  547. $reply['content'] .= "<div class='whiteBox'>$message";
  548. $reply['content'] .= "<p><span class=\"insensitive\">";
  549. $result = $this->dbh->query("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds
  550. WHERE owner_uid = " . $_SESSION['uid']);
  551. $last_updated = $this->dbh->fetch_result($result, 0, "last_updated");
  552. $last_updated = make_local_datetime($last_updated, false);
  553. $reply['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated);
  554. $result = $this->dbh->query("SELECT COUNT(id) AS num_errors
  555. FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
  556. $num_errors = $this->dbh->fetch_result($result, 0, "num_errors");
  557. if ($num_errors > 0) {
  558. $reply['content'] .= "<br/>";
  559. $reply['content'] .= "<a class=\"insensitive\" href=\"#\" onclick=\"showFeedsWithErrors()\">".
  560. __('Some feeds have update errors (click for details)')."</a>";
  561. }
  562. $reply['content'] .= "</span></p></div>";
  563. }
  564. }
  565. if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H2", $timing_info);
  566. return array($topmost_article_ids, $headlines_count, $feed, $disable_cache,
  567. $vgroup_last_feed, $reply);
  568. }
  569. function catchupAll() {
  570. $this->dbh->query("UPDATE ttrss_user_entries SET
  571. last_read = NOW(), unread = false WHERE unread = true AND owner_uid = " . $_SESSION["uid"]);
  572. ccache_zero_all($_SESSION["uid"]);
  573. }
  574. function view() {
  575. $timing_info = microtime(true);
  576. $reply = array();
  577. if ($_REQUEST["debug"]) $timing_info = print_checkpoint("0", $timing_info);
  578. $feed = $this->dbh->escape_string($_REQUEST["feed"]);
  579. $method = $this->dbh->escape_string($_REQUEST["m"]);
  580. $view_mode = $this->dbh->escape_string($_REQUEST["view_mode"]);
  581. $limit = 30;
  582. @$cat_view = $_REQUEST["cat"] == "true";
  583. @$next_unread_feed = $this->dbh->escape_string($_REQUEST["nuf"]);
  584. @$offset = $this->dbh->escape_string($_REQUEST["skip"]);
  585. @$vgroup_last_feed = $this->dbh->escape_string($_REQUEST["vgrlf"]);
  586. $order_by = $this->dbh->escape_string($_REQUEST["order_by"]);
  587. if (is_numeric($feed)) $feed = (int) $feed;
  588. /* Feed -5 is a special case: it is used to display auxiliary information
  589. * when there's nothing to load - e.g. no stuff in fresh feed */
  590. if ($feed == -5) {
  591. print json_encode($this->generate_dashboard_feed());
  592. return;
  593. }
  594. $result = false;
  595. if ($feed < LABEL_BASE_INDEX) {
  596. $label_feed = feed_to_label_id($feed);
  597. $result = $this->dbh->query("SELECT id FROM ttrss_labels2 WHERE
  598. id = '$label_feed' AND owner_uid = " . $_SESSION['uid']);
  599. } else if (!$cat_view && is_numeric($feed) && $feed > 0) {
  600. $result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE
  601. id = '$feed' AND owner_uid = " . $_SESSION['uid']);
  602. } else if ($cat_view && is_numeric($feed) && $feed > 0) {
  603. $result = $this->dbh->query("SELECT id FROM ttrss_feed_categories WHERE
  604. id = '$feed' AND owner_uid = " . $_SESSION['uid']);
  605. }
  606. if ($result && $this->dbh->num_rows($result) == 0) {
  607. print json_encode($this->generate_error_feed(__("Feed not found.")));
  608. return;
  609. }
  610. /* Updating a label ccache means recalculating all of the caches
  611. * so for performance reasons we don't do that here */
  612. if ($feed >= 0) {
  613. ccache_update($feed, $_SESSION["uid"], $cat_view);
  614. }
  615. set_pref("_DEFAULT_VIEW_MODE", $view_mode);
  616. set_pref("_DEFAULT_VIEW_ORDER_BY", $order_by);
  617. /* bump login timestamp if needed */
  618. if (time() - $_SESSION["last_login_update"] > 3600) {
  619. $this->dbh->query("UPDATE ttrss_users SET last_login = NOW() WHERE id = " .
  620. $_SESSION["uid"]);
  621. $_SESSION["last_login_update"] = time();
  622. }
  623. if (!$cat_view && is_numeric($feed) && $feed > 0) {
  624. $this->dbh->query("UPDATE ttrss_feeds SET last_viewed = NOW()
  625. WHERE id = '$feed' AND owner_uid = ".$_SESSION["uid"]);
  626. }
  627. $reply['headlines'] = array();
  628. if (!$next_unread_feed)
  629. $reply['headlines']['id'] = $feed;
  630. else
  631. $reply['headlines']['id'] = $next_unread_feed;
  632. $reply['headlines']['is_cat'] = (bool) $cat_view;
  633. $override_order = false;
  634. switch ($order_by) {
  635. case "title":
  636. $override_order = "ttrss_entries.title";
  637. break;
  638. case "date_reverse":
  639. $override_order = "score DESC, date_entered, updated";
  640. break;
  641. case "feed_dates":
  642. $override_order = "updated DESC";
  643. break;
  644. }
  645. if ($_REQUEST["debug"]) $timing_info = print_checkpoint("04", $timing_info);
  646. $ret = $this->format_headlines_list($feed, $method,
  647. $view_mode, $limit, $cat_view, $next_unread_feed, $offset,
  648. $vgroup_last_feed, $override_order, true);
  649. //$topmost_article_ids = $ret[0];
  650. $headlines_count = $ret[1];
  651. /* $returned_feed = $ret[2]; */
  652. $disable_cache = $ret[3];
  653. $vgroup_last_feed = $ret[4];
  654. $reply['headlines']['content'] =& $ret[5]['content'];
  655. $reply['headlines']['toolbar'] =& $ret[5]['toolbar'];
  656. if ($_REQUEST["debug"]) $timing_info = print_checkpoint("05", $timing_info);
  657. $reply['headlines-info'] = array("count" => (int) $headlines_count,
  658. "vgroup_last_feed" => $vgroup_last_feed,
  659. "disable_cache" => (bool) $disable_cache);
  660. if ($_REQUEST["debug"]) $timing_info = print_checkpoint("30", $timing_info);
  661. $reply['runtime-info'] = make_runtime_info();
  662. print json_encode($reply);
  663. }
  664. private function generate_dashboard_feed() {
  665. $reply = array();
  666. $reply['headlines']['id'] = -5;
  667. $reply['headlines']['is_cat'] = false;
  668. $reply['headlines']['toolbar'] = '';
  669. $reply['headlines']['content'] = "<div class='whiteBox'>".__('No feed selected.');
  670. $reply['headlines']['content'] .= "<p><span class=\"insensitive\">";
  671. $result = $this->dbh->query("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds
  672. WHERE owner_uid = " . $_SESSION['uid']);
  673. $last_updated = $this->dbh->fetch_result($result, 0, "last_updated");
  674. $last_updated = make_local_datetime($last_updated, false);
  675. $reply['headlines']['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated);
  676. $result = $this->dbh->query("SELECT COUNT(id) AS num_errors
  677. FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
  678. $num_errors = $this->dbh->fetch_result($result, 0, "num_errors");
  679. if ($num_errors > 0) {
  680. $reply['headlines']['content'] .= "<br/>";
  681. $reply['headlines']['content'] .= "<a class=\"insensitive\" href=\"#\" onclick=\"showFeedsWithErrors()\">".
  682. __('Some feeds have update errors (click for details)')."</a>";
  683. }
  684. $reply['headlines']['content'] .= "</span></p>";
  685. $reply['headlines-info'] = array("count" => 0,
  686. "vgroup_last_feed" => '',
  687. "unread" => 0,
  688. "disable_cache" => true);
  689. return $reply;
  690. }
  691. private function generate_error_feed($error) {
  692. $reply = array();
  693. $reply['headlines']['id'] = -6;
  694. $reply['headlines']['is_cat'] = false;
  695. $reply['headlines']['toolbar'] = '';
  696. $reply['headlines']['content'] = "<div class='whiteBox'>". $error . "</div>";
  697. $reply['headlines-info'] = array("count" => 0,
  698. "vgroup_last_feed" => '',
  699. "unread" => 0,
  700. "disable_cache" => true);
  701. return $reply;
  702. }
  703. function quickAddFeed() {
  704. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
  705. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"addfeed\">";
  706. print "<div id='fadd_multiple_notify' style='display : none'>";
  707. print_notice("Provided URL is a HTML page referencing multiple feeds, please select required feed from the dropdown menu below.");
  708. print "<p></div>";
  709. print "<div class=\"dlgSec\">".__("Feed or site URL")."</div>";
  710. print "<div class=\"dlgSecCont\">";
  711. print "<div style='float : right'>
  712. <img style='display : none'
  713. id='feed_add_spinner' src='images/indicator_white.gif'></div>";
  714. print "<input style=\"font-size : 16px; width : 20em;\"
  715. placeHolder=\"".__("Feed or site URL")."\"
  716. dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"feed\" id=\"feedDlg_feedUrl\">";
  717. print "<hr/>";
  718. if (get_pref('ENABLE_FEED_CATS')) {
  719. print __('Place in category:') . " ";
  720. print_feed_cat_select("cat", false, 'dojoType="dijit.form.Select"');
  721. }
  722. print "</div>";
  723. print '<div id="feedDlg_feedsContainer" style="display : none">
  724. <div class="dlgSec">' . __('Available feeds') . '</div>
  725. <div class="dlgSecCont">'.
  726. '<select id="feedDlg_feedContainerSelect"
  727. dojoType="dijit.form.Select" size="3">
  728. <script type="dojo/method" event="onChange" args="value">
  729. dijit.byId("feedDlg_feedUrl").attr("value", value);
  730. </script>
  731. </select>'.
  732. '</div></div>';
  733. print "<div id='feedDlg_loginContainer' style='display : none'>
  734. <div class=\"dlgSec\">".__("Authentication")."</div>
  735. <div class=\"dlgSecCont\">".
  736. " <input dojoType=\"dijit.form.TextBox\" name='login'\"
  737. placeHolder=\"".__("Login")."\"
  738. style=\"width : 10em;\"> ".
  739. " <input
  740. placeHolder=\"".__("Password")."\"
  741. dojoType=\"dijit.form.TextBox\" type='password'
  742. style=\"width : 10em;\" name='pass'\">
  743. </div></div>";
  744. print "<div style=\"clear : both\">
  745. <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"
  746. onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>
  747. <label for=\"feedDlg_loginCheck\">".
  748. __('This feed requires authentication.')."</div>";
  749. print "</form>";
  750. print "<div class=\"dlgButtons\">
  751. <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button>";
  752. if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) {
  753. print "<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">".__('More feeds')."</button>";
  754. }
  755. print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">".__('Cancel')."</button>
  756. </div>";
  757. //return;
  758. }
  759. function feedBrowser() {
  760. if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return;
  761. $browser_search = $this->dbh->escape_string($_REQUEST["search"]);
  762. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
  763. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"updateFeedBrowser\">";
  764. print "<div dojoType=\"dijit.Toolbar\">
  765. <div style='float : right'>
  766. <img style='display : none'
  767. id='feed_browser_spinner' src='images/indicator_white.gif'>
  768. <input name=\"search\" dojoType=\"dijit.form.TextBox\" size=\"20\" type=\"search\"
  769. onchange=\"dijit.byId('feedBrowserDlg').update()\" value=\"$browser_search\">
  770. <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').update()\">".__('Search')."</button>
  771. </div>";
  772. print " <select name=\"mode\" dojoType=\"dijit.form.Select\" onchange=\"dijit.byId('feedBrowserDlg').update()\">
  773. <option value='1'>" . __('Popular feeds') . "</option>
  774. <option value='2'>" . __('Feed archive') . "</option>
  775. </select> ";
  776. print __("limit:");
  777. print " <select dojoType=\"dijit.form.Select\" name=\"limit\" onchange=\"dijit.byId('feedBrowserDlg').update()\">";
  778. foreach (array(25, 50, 100, 200) as $l) {
  779. //$issel = ($l == $limit) ? "selected=\"1\"" : "";
  780. print "<option value=\"$l\">$l</option>";
  781. }
  782. print "</select> ";
  783. print "</div>";
  784. require_once "feedbrowser.php";
  785. print "<ul class='browseFeedList' id='browseFeedList'>";
  786. print make_feed_browser("", 25);
  787. print "</ul>";
  788. print "<div align='center'>
  789. <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').execute()\">".__('Subscribe')."</button>
  790. <button dojoType=\"dijit.form.Button\" style='display : none' id='feed_archive_remove' onclick=\"dijit.byId('feedBrowserDlg').removeFromArchive()\">".__('Remove')."</button>
  791. <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').hide()\" >".__('Cancel')."</button></div>";
  792. }
  793. function search() {
  794. $this->params = explode(":", $this->dbh->escape_string($_REQUEST["param"]), 2);
  795. $active_feed_id = sprintf("%d", $this->params[0]);
  796. $is_cat = $this->params[1] != "false";
  797. print "<div class=\"dlgSec\">".__('Look for')."</div>";
  798. print "<div class=\"dlgSecCont\">";
  799. print "<input dojoType=\"dijit.form.ValidationTextBox\"
  800. style=\"font-size : 16px; width : 20em;\"
  801. required=\"1\" name=\"query\" type=\"search\" value=''>";
  802. print "<hr/>".__('Limit search to:')." ";
  803. print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\">
  804. <option value=\"all_feeds\">".__('All feeds')."</option>";
  805. $feed_title = getFeedTitle($active_feed_id);
  806. if (!$is_cat) {
  807. $feed_cat_title = getFeedCatTitle($active_feed_id);
  808. } else {
  809. $feed_cat_title = getCategoryTitle($active_feed_id);
  810. }
  811. if ($active_feed_id && !$is_cat) {
  812. print "<option selected=\"1\" value=\"this_feed\">$feed_title</option>";
  813. } else {
  814. print "<option disabled=\"1\" value=\"false\">".__('This feed')."</option>";
  815. }
  816. if ($is_cat) {
  817. $cat_preselected = "selected=\"1\"";
  818. }
  819. if (get_pref('ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) {
  820. print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
  821. } else {
  822. //print "<option disabled>".__('This category')."</option>";
  823. }
  824. print "</select>";
  825. print "</div>";
  826. print "<div class=\"dlgButtons\">";
  827. if (count(PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH)) == 0) {
  828. print "<div style=\"float : left\">
  829. <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/wiki/SearchSyntax\">".__("Search syntax")."</a>
  830. </div>";
  831. }
  832. print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button>
  833. <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">".__('Cancel')."</button>
  834. </div>";
  835. }
  836. }
  837. ?>