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