feeds.php 37 KB

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