feeds.php 38 KB

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