]> git.wh0rd.org - tt-rss.git/blame - classes/pref/feeds.php
add and check plugin base class
[tt-rss.git] / classes / pref / feeds.php
CommitLineData
afcfe6ca 1<?php
369dbc19 2class Pref_Feeds extends Handler_Protected {
8484ce22
AD
3
4 function csrf_ignore($method) {
f6cd767b 5 $csrf_ignored = array("index", "getfeedtree", "add", "editcats", "editfeed",
bc6fa236 6 "savefeedorder", "uploadicon", "feedswitherrors", "inactivefeeds");
8484ce22
AD
7
8 return array_search($method, $csrf_ignored) !== false;
9 }
10
afcfe6ca
AD
11 function batch_edit_cbox($elem, $label = false) {
12 print "<input type=\"checkbox\" title=\"".__("Check to enable field")."\"
13 onchange=\"dijit.byId('feedEditDlg').toggleField(this, '$elem', '$label')\">";
14 }
15
16 function renamecat() {
17 $title = db_escape_string($_REQUEST['title']);
18 $id = db_escape_string($_REQUEST['id']);
19
20 if ($title) {
21 db_query($this->link, "UPDATE ttrss_feed_categories SET
22 title = '$title' WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]);
23 }
24 return;
25 }
26
2a060a94 27 private function get_category_items($cat_id) {
6e0ee833
AD
28
29 if ($_REQUEST['mode'] != 2)
30 $search = $_SESSION["prefs_feed_search"];
31 else
32 $search = "";
17c755f0
AD
33
34 if ($search) $search_qpart = " AND LOWER(title) LIKE LOWER('%$search%')";
35
f393dc6f 36 $show_empty_cats = $_REQUEST['mode'] != 2 && !$search &&
fbf85cf6 37 get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS');
2a060a94
AD
38
39 $items = array();
40
2ecd2df5 41 $result = db_query($this->link, "SELECT id, title, collapsed FROM ttrss_feed_categories
2a060a94
AD
42 WHERE owner_uid = " . $_SESSION["uid"] . " AND parent_cat = '$cat_id' ORDER BY order_id, title");
43
44 while ($line = db_fetch_assoc($result)) {
45
46 $cat = array();
47 $cat['id'] = 'CAT:' . $line['id'];
2ecd2df5 48 $cat['bare_id'] = (int)$line['id'];
2a060a94
AD
49 $cat['name'] = $line['title'];
50 $cat['items'] = array();
51 $cat['checkbox'] = false;
2ecd2df5 52 $cat['hidden'] = sql_bool_to_bool($line['collapsed']);
2a060a94 53 $cat['type'] = 'category';
2ecd2df5 54 $cat['unread'] = 0;
2c5f231e 55 $cat['child_unread'] = 0;
2a060a94
AD
56
57 $cat['items'] = $this->get_category_items($line['id']);
58
59 $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
60
61 if (count($cat['items']) > 0 || $show_empty_cats)
62 array_push($items, $cat);
63
64 }
65
66 $feed_result = db_query($this->link, "SELECT id, title, last_error,
67 ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
68 FROM ttrss_feeds
69 WHERE cat_id = '$cat_id' AND owner_uid = ".$_SESSION["uid"].
70 "$search_qpart ORDER BY order_id, title");
71
72 while ($feed_line = db_fetch_assoc($feed_result)) {
73 $feed = array();
74 $feed['id'] = 'FEED:' . $feed_line['id'];
2ecd2df5 75 $feed['bare_id'] = (int)$feed_line['id'];
2a060a94
AD
76 $feed['name'] = $feed_line['title'];
77 $feed['checkbox'] = false;
2ecd2df5 78 $feed['unread'] = 0;
2a060a94
AD
79 $feed['error'] = $feed_line['last_error'];
80 $feed['icon'] = getFeedIcon($feed_line['id']);
81 $feed['param'] = make_local_datetime($this->link,
82 $feed_line['last_updated'], true);
83
84 array_push($items, $feed);
85 }
86
87 return $items;
88 }
89
afcfe6ca
AD
90 function getfeedtree() {
91
6e0ee833
AD
92 if ($_REQUEST['mode'] != 2)
93 $search = $_SESSION["prefs_feed_search"];
94 else
95 $search = "";
afcfe6ca
AD
96
97 if ($search) $search_qpart = " AND LOWER(title) LIKE LOWER('%$search%')";
98
99 $root = array();
100 $root['id'] = 'root';
101 $root['name'] = __('Feeds');
102 $root['items'] = array();
103 $root['type'] = 'category';
104
2ecd2df5
AD
105 $enable_cats = get_pref($this->link, 'ENABLE_FEED_CATS');
106
107 if ($_REQUEST['mode'] == 2) {
108
109 if ($enable_cats) {
110 $cat_hidden = get_pref($this->link, "_COLLAPSED_SPECIAL");
111 $cat = $this->feedlist_init_cat(-1, $cat_hidden);
112 } else {
113 $cat['items'] = array();
114 }
115
5417fbd7 116 foreach (array(-4, -3, -1, -2, 0, -6) as $i) {
2ecd2df5
AD
117 array_push($cat['items'], $this->feedlist_init_feed($i));
118 }
119
120 if ($enable_cats) {
121 array_push($root['items'], $cat);
122 } else {
123 $root['items'] = array_merge($root['items'], $cat['items']);
124 }
afcfe6ca 125
2ecd2df5
AD
126 $result = db_query($this->link, "SELECT * FROM
127 ttrss_labels2 WHERE owner_uid = ".$_SESSION['uid']." ORDER by caption");
128
129 if (db_num_rows($result) > 0) {
130
131 if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
132 $cat_hidden = get_pref($this->link, "_COLLAPSED_LABELS");
133 $cat = $this->feedlist_init_cat(-2, $cat_hidden);
134 } else {
135 $cat['items'] = array();
136 }
137
138 while ($line = db_fetch_assoc($result)) {
139
140 $label_id = -$line['id'] - 11;
141 $count = getFeedUnread($this->link, $label_id);
142
143 $feed = $this->feedlist_init_feed($label_id, false, $count);
144
145 $feed['fg_color'] = $line['fg_color'];
146 $feed['bg_color'] = $line['bg_color'];
147
148 array_push($cat['items'], $feed);
149 }
150
151 if ($enable_cats) {
152 array_push($root['items'], $cat);
153 } else {
154 $root['items'] = array_merge($root['items'], $cat['items']);
155 }
156 }
157 }
158
159 if ($enable_cats) {
f393dc6f 160 $show_empty_cats = $_REQUEST['mode'] != 2 && !$search &&
2ecd2df5
AD
161 get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS');
162
163 $result = db_query($this->link, "SELECT id, title, collapsed FROM ttrss_feed_categories
2a060a94 164 WHERE owner_uid = " . $_SESSION["uid"] . " AND parent_cat IS NULL ORDER BY order_id, title");
afcfe6ca
AD
165
166 while ($line = db_fetch_assoc($result)) {
167 $cat = array();
168 $cat['id'] = 'CAT:' . $line['id'];
2ecd2df5 169 $cat['bare_id'] = (int)$line['id'];
afcfe6ca
AD
170 $cat['name'] = $line['title'];
171 $cat['items'] = array();
172 $cat['checkbox'] = false;
2ecd2df5 173 $cat['hidden'] = sql_bool_to_bool($line['collapsed']);
afcfe6ca 174 $cat['type'] = 'category';
2ecd2df5 175 $cat['unread'] = 0;
2c5f231e 176 $cat['child_unread'] = 0;
afcfe6ca 177
2a060a94 178 $cat['items'] = $this->get_category_items($line['id']);
afcfe6ca
AD
179
180 $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
181
5b7bd238 182 if (count($cat['items']) > 0 || $show_empty_cats)
afcfe6ca
AD
183 array_push($root['items'], $cat);
184
185 $root['param'] += count($cat['items']);
186 }
187
188 /* Uncategorized is a special case */
189
190 $cat = array();
191 $cat['id'] = 'CAT:0';
192 $cat['bare_id'] = 0;
193 $cat['name'] = __("Uncategorized");
194 $cat['items'] = array();
2ecd2df5 195 $cat['hidden'] = get_pref($this->link, "_COLLAPSED_UNCAT");
afcfe6ca
AD
196 $cat['type'] = 'category';
197 $cat['checkbox'] = false;
2ecd2df5 198 $cat['unread'] = 0;
2c5f231e 199 $cat['child_unread'] = 0;
afcfe6ca
AD
200
201 $feed_result = db_query($this->link, "SELECT id, title,last_error,
202 ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
203 FROM ttrss_feeds
204 WHERE cat_id IS NULL AND owner_uid = ".$_SESSION["uid"].
205 "$search_qpart ORDER BY order_id, title");
206
207 while ($feed_line = db_fetch_assoc($feed_result)) {
208 $feed = array();
209 $feed['id'] = 'FEED:' . $feed_line['id'];
2ecd2df5 210 $feed['bare_id'] = (int)$feed_line['id'];
afcfe6ca
AD
211 $feed['name'] = $feed_line['title'];
212 $feed['checkbox'] = false;
213 $feed['error'] = $feed_line['last_error'];
214 $feed['icon'] = getFeedIcon($feed_line['id']);
215 $feed['param'] = make_local_datetime($this->link,
216 $feed_line['last_updated'], true);
2ecd2df5
AD
217 $feed['unread'] = 0;
218 $feed['type'] = 'feed';
afcfe6ca
AD
219
220 array_push($cat['items'], $feed);
221 }
222
223 $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
224
5b7bd238 225 if (count($cat['items']) > 0 || $show_empty_cats)
afcfe6ca
AD
226 array_push($root['items'], $cat);
227
228 $root['param'] += count($cat['items']);
229 $root['param'] = T_sprintf('(%d feeds)', $root['param']);
230
231 } else {
232 $feed_result = db_query($this->link, "SELECT id, title, last_error,
233 ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
234 FROM ttrss_feeds
235 WHERE owner_uid = ".$_SESSION["uid"].
236 "$search_qpart ORDER BY order_id, title");
237
238 while ($feed_line = db_fetch_assoc($feed_result)) {
239 $feed = array();
240 $feed['id'] = 'FEED:' . $feed_line['id'];
2ecd2df5 241 $feed['bare_id'] = (int)$feed_line['id'];
afcfe6ca
AD
242 $feed['name'] = $feed_line['title'];
243 $feed['checkbox'] = false;
244 $feed['error'] = $feed_line['last_error'];
245 $feed['icon'] = getFeedIcon($feed_line['id']);
246 $feed['param'] = make_local_datetime($this->link,
247 $feed_line['last_updated'], true);
2ecd2df5
AD
248 $feed['unread'] = 0;
249 $feed['type'] = 'feed';
afcfe6ca
AD
250
251 array_push($root['items'], $feed);
252 }
253
254 $root['param'] = T_sprintf('(%d feeds)', count($root['items']));
afcfe6ca
AD
255 }
256
257 $fl = array();
258 $fl['identifier'] = 'id';
259 $fl['label'] = 'name';
2ecd2df5
AD
260
261 if ($_REQUEST['mode'] != 2) {
262 $fl['items'] = array($root);
263 } else {
264 $fl['items'] =& $root['items'];
265 }
afcfe6ca
AD
266
267 print json_encode($fl);
268 return;
269 }
270
271 function catsortreset() {
272 db_query($this->link, "UPDATE ttrss_feed_categories
273 SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]);
274 return;
275 }
276
277 function feedsortreset() {
278 db_query($this->link, "UPDATE ttrss_feeds
279 SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]);
280 return;
281 }
282
5b7bd238
AD
283 function togglehiddenfeedcats() {
284 set_pref($this->link, '_PREFS_SHOW_EMPTY_CATS',
285 (get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS') ? 'false' : 'true'));
286 }
287
95ee44b3
AD
288 private function process_category_order(&$data_map, $item_id, $parent_id = false, $nest_level = 0) {
289 $debug = isset($_REQUEST["debug"]);
290
291 $prefix = "";
292 for ($i = 0; $i < $nest_level; $i++)
293 $prefix .= " ";
294
295 if ($debug) _debug("$prefix C: $item_id P: $parent_id");
296
297 $bare_item_id = substr($item_id, strpos($item_id, ':')+1);
2a060a94
AD
298
299 if ($item_id != 'root') {
300 if ($parent_id && $parent_id != 'root') {
301 $parent_bare_id = substr($parent_id, strpos($parent_id, ':')+1);
302 $parent_qpart = db_escape_string($parent_bare_id);
303 } else {
304 $parent_qpart = 'NULL';
305 }
306
307 db_query($this->link, "UPDATE ttrss_feed_categories
95ee44b3 308 SET parent_cat = $parent_qpart WHERE id = '$bare_item_id' AND
2a060a94
AD
309 owner_uid = " . $_SESSION["uid"]);
310 }
311
312 $order_id = 0;
313
314 $cat = $data_map[$item_id];
315
316 if ($cat && is_array($cat)) {
317 foreach ($cat as $item) {
318 $id = $item['_reference'];
319 $bare_id = substr($id, strpos($id, ':')+1);
320
95ee44b3 321 if ($debug) _debug("$prefix [$order_id] $id/$bare_id");
2a060a94
AD
322
323 if ($item['_reference']) {
324
325 if (strpos($id, "FEED") === 0) {
326
95ee44b3
AD
327 $cat_id = ($item_id != "root") ?
328 db_escape_string($bare_item_id) : "NULL";
329
49b2401e
AD
330 $cat_qpart = ($cat_id != 0) ? "cat_id = '$cat_id'" :
331 "cat_id = NULL";
332
2a060a94 333 db_query($this->link, "UPDATE ttrss_feeds
49b2401e 334 SET order_id = $order_id, $cat_qpart
95ee44b3 335 WHERE id = '$bare_id' AND
2a060a94
AD
336 owner_uid = " . $_SESSION["uid"]);
337
338 } else if (strpos($id, "CAT:") === 0) {
95ee44b3
AD
339 $this->process_category_order($data_map, $item['_reference'], $item_id,
340 $nest_level+1);
2a060a94
AD
341
342 if ($item_id != 'root') {
343 $parent_qpart = db_escape_string($bare_id);
344 } else {
345 $parent_qpart = 'NULL';
346 }
347
348 db_query($this->link, "UPDATE ttrss_feed_categories
349 SET order_id = '$order_id' WHERE id = '$bare_id' AND
350 owner_uid = " . $_SESSION["uid"]);
351 }
352 }
353
354 ++$order_id;
355 }
356 }
357 }
358
afcfe6ca
AD
359 function savefeedorder() {
360 $data = json_decode($_POST['payload'], true);
361
2a060a94
AD
362 #file_put_contents("/tmp/saveorder.json", $_POST['payload']);
363 #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true);
a26f57e6 364
95ee44b3
AD
365 if (!is_array($data['items']))
366 $data['items'] = json_decode($data['items'], true);
367
368# print_r($data['items']);
2a060a94 369
afcfe6ca
AD
370 if (is_array($data) && is_array($data['items'])) {
371 $cat_order_id = 0;
372
373 $data_map = array();
2a060a94 374 $root_item = false;
afcfe6ca
AD
375
376 foreach ($data['items'] as $item) {
377
2a060a94 378# if ($item['id'] != 'root') {
afcfe6ca
AD
379 if (is_array($item['items'])) {
380 if (isset($item['items']['_reference'])) {
381 $data_map[$item['id']] = array($item['items']);
382 } else {
383 $data_map[$item['id']] =& $item['items'];
384 }
385 }
2a060a94
AD
386 if ($item['id'] == 'root') {
387 $root_item = $item['id'];
afcfe6ca
AD
388 }
389 }
390
d04f8c82 391 $this->process_category_order($data_map, $root_item);
2a060a94
AD
392
393 /* foreach ($data['items'][0]['items'] as $item) {
afcfe6ca
AD
394 $id = $item['_reference'];
395 $bare_id = substr($id, strpos($id, ':')+1);
396
397 ++$cat_order_id;
398
399 if ($bare_id > 0) {
400 db_query($this->link, "UPDATE ttrss_feed_categories
401 SET order_id = '$cat_order_id' WHERE id = '$bare_id' AND
402 owner_uid = " . $_SESSION["uid"]);
403 }
404
405 $feed_order_id = 0;
406
407 if (is_array($data_map[$id])) {
408 foreach ($data_map[$id] as $feed) {
409 $id = $feed['_reference'];
410 $feed_id = substr($id, strpos($id, ':')+1);
411
412 if ($bare_id != 0)
413 $cat_query = "cat_id = '$bare_id'";
414 else
415 $cat_query = "cat_id = NULL";
416
417 db_query($this->link, "UPDATE ttrss_feeds
418 SET order_id = '$feed_order_id',
419 $cat_query
420 WHERE id = '$feed_id' AND
421 owner_uid = " . $_SESSION["uid"]);
422
423 ++$feed_order_id;
424 }
425 }
2a060a94 426 } */
afcfe6ca
AD
427 }
428
429 return;
430 }
431
432 function removeicon() {
433 $feed_id = db_escape_string($_REQUEST["feed_id"]);
434
435 $result = db_query($this->link, "SELECT id FROM ttrss_feeds
436 WHERE id = '$feed_id' AND owner_uid = ". $_SESSION["uid"]);
437
438 if (db_num_rows($result) != 0) {
439 unlink(ICONS_DIR . "/$feed_id.ico");
440 }
441
442 return;
443 }
444
445 function uploadicon() {
446 $icon_file = $_FILES['icon_file']['tmp_name'];
447 $feed_id = db_escape_string($_REQUEST["feed_id"]);
448
449 if (is_file($icon_file) && $feed_id) {
450 if (filesize($icon_file) < 20000) {
451
452 $result = db_query($this->link, "SELECT id FROM ttrss_feeds
453 WHERE id = '$feed_id' AND owner_uid = ". $_SESSION["uid"]);
454
455 if (db_num_rows($result) != 0) {
456 unlink(ICONS_DIR . "/$feed_id.ico");
457 move_uploaded_file($icon_file, ICONS_DIR . "/$feed_id.ico");
458 $rc = 0;
459 } else {
460 $rc = 2;
461 }
462 } else {
463 $rc = 1;
464 }
465 } else {
466 $rc = 2;
467 }
468
469 print "<script type=\"text/javascript\">";
470 print "parent.uploadIconHandler($rc);";
471 print "</script>";
472 return;
473 }
474
475 function editfeed() {
476 global $purge_intervals;
477 global $update_intervals;
478 global $update_methods;
479
480 $feed_id = db_escape_string($_REQUEST["id"]);
481
482 $result = db_query($this->link,
483 "SELECT * FROM ttrss_feeds WHERE id = '$feed_id' AND
484 owner_uid = " . $_SESSION["uid"]);
485
486 $title = htmlspecialchars(db_fetch_result($result,
487 0, "title"));
488
489 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$feed_id\">";
490 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">";
491 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">";
492
493 print "<div class=\"dlgSec\">".__("Feed")."</div>";
494 print "<div class=\"dlgSecCont\">";
495
496 /* Title */
497
498 print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
499 placeHolder=\"".__("Feed Title")."\"
500 style=\"font-size : 16px; width: 20em\" name=\"title\" value=\"$title\">";
501
502 /* Feed URL */
503
504 $feed_url = db_fetch_result($result, 0, "feed_url");
505 $feed_url = htmlspecialchars(db_fetch_result($result,
506 0, "feed_url"));
507
508 print "<hr/>";
509
510 print __('URL:') . " ";
511 print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
512 placeHolder=\"".__("Feed URL")."\"
513 regExp='^(http|https)://.*' style=\"width : 20em\"
514 name=\"feed_url\" value=\"$feed_url\">";
515
516 $last_error = db_fetch_result($result, 0, "last_error");
517
518 if ($last_error) {
519 print "&nbsp;<span title=\"".htmlspecialchars($last_error)."\"
520 class=\"feed_error\">(error)</span>";
521
522 }
523
524 /* Category */
525
526 if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
527
528 $cat_id = db_fetch_result($result, 0, "cat_id");
529
530 print "<hr/>";
531
532 print __('Place in category:') . " ";
533
534 print_feed_cat_select($this->link, "cat_id", $cat_id,
535 'dojoType="dijit.form.Select"');
536 }
537
538 print "</div>";
539
540 print "<div class=\"dlgSec\">".__("Update")."</div>";
541 print "<div class=\"dlgSecCont\">";
542
543 /* Update Interval */
544
545 $update_interval = db_fetch_result($result, 0, "update_interval");
546
547 print_select_hash("update_interval", $update_interval, $update_intervals,
548 'dojoType="dijit.form.Select"');
549
550 /* Update method */
551
552 $update_method = db_fetch_result($result, 0, "update_method",
553 'dojoType="dijit.form.Select"');
554
555 print " " . __('using') . " ";
556 print_select_hash("update_method", $update_method, $update_methods,
557 'dojoType="dijit.form.Select"');
558
559 $purge_interval = db_fetch_result($result, 0, "purge_interval");
560
561
562 /* Purge intl */
563
564 print "<hr/>";
565 print __('Article purging:') . " ";
566
567 print_select_hash("purge_interval", $purge_interval, $purge_intervals,
568 'dojoType="dijit.form.Select" ' .
569 ((FORCE_ARTICLE_PURGE == 0) ? "" : 'disabled="1"'));
570
571 print "</div>";
572 print "<div class=\"dlgSec\">".__("Authentication")."</div>";
573 print "<div class=\"dlgSecCont\">";
574
575 $auth_login = htmlspecialchars(db_fetch_result($result, 0, "auth_login"));
576
577 print "<input dojoType=\"dijit.form.TextBox\" id=\"feedEditDlg_login\"
578 placeHolder=\"".__("Login")."\"
579 name=\"auth_login\" value=\"$auth_login\"><hr/>";
580
581 $auth_pass = htmlspecialchars(db_fetch_result($result, 0, "auth_pass"));
582
583 print "<input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\"
584 placeHolder=\"".__("Password")."\"
585 value=\"$auth_pass\">";
586
587 print "<div dojoType=\"dijit.Tooltip\" connectId=\"feedEditDlg_login\" position=\"below\">
588 ".__('<b>Hint:</b> you need to fill in your login information if your feed requires authentication, except for Twitter feeds.')."
589 </div>";
590
591 print "</div>";
592 print "<div class=\"dlgSec\">".__("Options")."</div>";
593 print "<div class=\"dlgSecCont\">";
594
595 $private = sql_bool_to_bool(db_fetch_result($result, 0, "private"));
596
597 if ($private) {
598 $checked = "checked=\"1\"";
599 } else {
600 $checked = "";
601 }
602
603 print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"private\" id=\"private\"
604 $checked>&nbsp;<label for=\"private\">".__('Hide from Popular feeds')."</label>";
605
606 $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
607
608 if ($rtl_content) {
609 $checked = "checked=\"1\"";
610 } else {
611 $checked = "";
612 }
613
614 print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"
615 $checked>&nbsp;<label for=\"rtl_content\">".__('Right-to-left content')."</label>";
616
617 $include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest"));
618
619 if ($include_in_digest) {
620 $checked = "checked=\"1\"";
621 } else {
622 $checked = "";
623 }
624
625 print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"include_in_digest\"
626 name=\"include_in_digest\"
627 $checked>&nbsp;<label for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
628
629
630 $always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures"));
631
632 if ($always_display_enclosures) {
633 $checked = "checked";
634 } else {
635 $checked = "";
636 }
637
638 print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"always_display_enclosures\"
639 name=\"always_display_enclosures\"
640 $checked>&nbsp;<label for=\"always_display_enclosures\">".__('Always display image attachments')."</label>";
641
642
643 $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
644
645 if ($cache_images) {
646 $checked = "checked=\"1\"";
647 } else {
648 $checked = "";
649 }
650
3c696512
AD
651 print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"cache_images\"
652 name=\"cache_images\"
afcfe6ca 653 $checked>&nbsp;<label for=\"cache_images\">".
3c696512 654 __('Cache images locally')."</label>";
afcfe6ca 655
87764a50
AD
656 $cache_content = sql_bool_to_bool(db_fetch_result($result, 0, "cache_content"));
657
658 if ($cache_content) {
659 $checked = "checked=\"1\"";
660 } else {
661 $checked = "";
662 }
663
664 print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"cache_content\"
665 name=\"cache_content\"
666 $checked>&nbsp;<label for=\"cache_content\">".
667 __('Cache content locally')."</label>";
668
afcfe6ca
AD
669 $mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update"));
670
671 if ($mark_unread_on_update) {
672 $checked = "checked";
673 } else {
674 $checked = "";
675 }
676
677 print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"mark_unread_on_update\"
678 name=\"mark_unread_on_update\"
679 $checked>&nbsp;<label for=\"mark_unread_on_update\">".__('Mark updated articles as unread')."</label>";
680
681 $update_on_checksum_change = sql_bool_to_bool(db_fetch_result($result, 0, "update_on_checksum_change"));
682
683 if ($update_on_checksum_change) {
684 $checked = "checked";
685 } else {
686 $checked = "";
687 }
688
689 print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"update_on_checksum_change\"
690 name=\"update_on_checksum_change\"
691 $checked>&nbsp;<label for=\"update_on_checksum_change\">".__('Mark posts as updated on content change')."</label>";
692
693 print "</div>";
694
695 /* Icon */
696
697 print "<div class=\"dlgSec\">".__("Icon")."</div>";
698 print "<div class=\"dlgSecCont\">";
699
700 print "<iframe name=\"icon_upload_iframe\"
701 style=\"width: 400px; height: 100px; display: none;\"></iframe>";
702
703 print "<form style='display : block' target=\"icon_upload_iframe\"
704 enctype=\"multipart/form-data\" method=\"POST\"
705 action=\"backend.php\">
706 <input id=\"icon_file\" size=\"10\" name=\"icon_file\" type=\"file\">
707 <input type=\"hidden\" name=\"op\" value=\"pref-feeds\">
708 <input type=\"hidden\" name=\"feed_id\" value=\"$feed_id\">
709 <input type=\"hidden\" name=\"method\" value=\"uploadicon\">
710 <button dojoType=\"dijit.form.Button\" onclick=\"return uploadFeedIcon();\"
711 type=\"submit\">".__('Replace')."</button>
712 <button dojoType=\"dijit.form.Button\" onclick=\"return removeFeedIcon($feed_id);\"
713 type=\"submit\">".__('Remove')."</button>
714 </form>";
715
716 print "</div>";
717
718 $title = htmlspecialchars($title, ENT_QUOTES);
719
720 print "<div class='dlgButtons'>
721 <div style=\"float : left\">
722 <button dojoType=\"dijit.form.Button\" onclick='return unsubscribeFeed($feed_id, \"$title\")'>".
723 __('Unsubscribe')."</button>";
724
725 if (PUBSUBHUBBUB_ENABLED) {
726 $pubsub_state = db_fetch_result($result, 0, "pubsub_state");
727 $pubsub_btn_disabled = ($pubsub_state == 2) ? "" : "disabled=\"1\"";
728
729 print "<button dojoType=\"dijit.form.Button\" id=\"pubsubReset_Btn\" $pubsub_btn_disabled
730 onclick='return resetPubSub($feed_id, \"$title\")'>".__('Resubscribe to push updates').
731 "</button>";
732 }
733
734 print "</div>";
735
736 print "<div dojoType=\"dijit.Tooltip\" connectId=\"pubsubReset_Btn\" position=\"below\">".
737 __('Resets PubSubHubbub subscription status for push-enabled feeds.')."</div>";
738
739 print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedEditDlg').execute()\">".__('Save')."</button>
740 <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedEditDlg').hide()\">".__('Cancel')."</button>
741 </div>";
742
743 return;
744 }
745
746 function editfeeds() {
747 global $purge_intervals;
748 global $update_intervals;
749 global $update_methods;
46da73c2 750
afcfe6ca
AD
751 $feed_ids = db_escape_string($_REQUEST["ids"]);
752
ca6a0741
AD
753 print "<div class=\"dialogNotice\">" . __("Enable the options you wish to apply using checkboxes on the right:") . "</div>";
754
afcfe6ca
AD
755 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"ids\" value=\"$feed_ids\">";
756 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">";
757 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchEditSave\">";
758
759 print "<div class=\"dlgSec\">".__("Feed")."</div>";
760 print "<div class=\"dlgSecCont\">";
761
762 /* Title */
763
764 print "<input dojoType=\"dijit.form.ValidationTextBox\"
765 disabled=\"1\" style=\"font-size : 16px; width : 20em;\" required=\"1\"
766 name=\"title\" value=\"$title\">";
767
768 $this->batch_edit_cbox("title");
769
770 /* Feed URL */
771
772 print "<br/>";
773
774 print __('URL:') . " ";
775 print "<input dojoType=\"dijit.form.ValidationTextBox\" disabled=\"1\"
776 required=\"1\" regExp='^(http|https)://.*' style=\"width : 20em\"
777 name=\"feed_url\" value=\"$feed_url\">";
778
779 $this->batch_edit_cbox("feed_url");
780
781 /* Category */
782
783 if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
784
785 print "<br/>";
786
787 print __('Place in category:') . " ";
788
789 print_feed_cat_select($this->link, "cat_id", $cat_id,
790 'disabled="1" dojoType="dijit.form.Select"');
791
792 $this->batch_edit_cbox("cat_id");
793
794 }
795
796 print "</div>";
797
798 print "<div class=\"dlgSec\">".__("Update")."</div>";
799 print "<div class=\"dlgSecCont\">";
800
801 /* Update Interval */
802
803 print_select_hash("update_interval", $update_interval, $update_intervals,
804 'disabled="1" dojoType="dijit.form.Select"');
805
806 $this->batch_edit_cbox("update_interval");
807
808 /* Update method */
809
810 print " " . __('using') . " ";
811 print_select_hash("update_method", $update_method, $update_methods,
812 'disabled="1" dojoType="dijit.form.Select"');
813 $this->batch_edit_cbox("update_method");
814
815 /* Purge intl */
816
817 if (FORCE_ARTICLE_PURGE == 0) {
818
819 print "<br/>";
820
821 print __('Article purging:') . " ";
822
823 print_select_hash("purge_interval", $purge_interval, $purge_intervals,
824 'disabled="1" dojoType="dijit.form.Select"');
825
826 $this->batch_edit_cbox("purge_interval");
827 }
828
829 print "</div>";
830 print "<div class=\"dlgSec\">".__("Authentication")."</div>";
831 print "<div class=\"dlgSecCont\">";
832
833 print "<input dojoType=\"dijit.form.TextBox\"
834 placeHolder=\"".__("Login")."\" disabled=\"1\"
835 name=\"auth_login\" value=\"$auth_login\">";
836
837 $this->batch_edit_cbox("auth_login");
838
839 print "<br/><input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\"
840 placeHolder=\"".__("Password")."\" disabled=\"1\"
841 value=\"$auth_pass\">";
842
843 $this->batch_edit_cbox("auth_pass");
844
845 print "</div>";
846 print "<div class=\"dlgSec\">".__("Options")."</div>";
847 print "<div class=\"dlgSecCont\">";
848
849 print "<input disabled=\"1\" type=\"checkbox\" name=\"private\" id=\"private\"
850 dojoType=\"dijit.form.CheckBox\">&nbsp;<label id=\"private_l\" class='insensitive' for=\"private\">".__('Hide from Popular feeds')."</label>";
851
852 print "&nbsp;"; $this->batch_edit_cbox("private", "private_l");
853
854 print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"
855 dojoType=\"dijit.form.CheckBox\">&nbsp;<label class='insensitive' id=\"rtl_content_l\" for=\"rtl_content\">".__('Right-to-left content')."</label>";
856
857 print "&nbsp;"; $this->batch_edit_cbox("rtl_content", "rtl_content_l");
858
859 print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"include_in_digest\"
860 name=\"include_in_digest\"
861 dojoType=\"dijit.form.CheckBox\">&nbsp;<label id=\"include_in_digest_l\" class='insensitive' for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
862
863 print "&nbsp;"; $this->batch_edit_cbox("include_in_digest", "include_in_digest_l");
864
865 print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"always_display_enclosures\"
866 name=\"always_display_enclosures\"
867 dojoType=\"dijit.form.CheckBox\">&nbsp;<label id=\"always_display_enclosures_l\" class='insensitive' for=\"always_display_enclosures\">".__('Always display image attachments')."</label>";
868
869 print "&nbsp;"; $this->batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l");
870
3c696512
AD
871 print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"cache_images\"
872 name=\"cache_images\"
873 dojoType=\"dijit.form.CheckBox\">&nbsp;<label class='insensitive' id=\"cache_images_l\"
874 for=\"cache_images\">".
875 __('Cache images locally')."</label>";
afcfe6ca 876
3c696512 877 print "&nbsp;"; $this->batch_edit_cbox("cache_images", "cache_images_l");
afcfe6ca
AD
878
879 print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"mark_unread_on_update\"
880 name=\"mark_unread_on_update\"
881 dojoType=\"dijit.form.CheckBox\">&nbsp;<label id=\"mark_unread_on_update_l\" class='insensitive' for=\"mark_unread_on_update\">".__('Mark updated articles as unread')."</label>";
882
883 print "&nbsp;"; $this->batch_edit_cbox("mark_unread_on_update", "mark_unread_on_update_l");
884
885 print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"update_on_checksum_change\"
886 name=\"update_on_checksum_change\"
887 dojoType=\"dijit.form.CheckBox\">&nbsp;<label id=\"update_on_checksum_change_l\" class='insensitive' for=\"update_on_checksum_change\">".__('Mark posts as updated on content change')."</label>";
888
889 print "&nbsp;"; $this->batch_edit_cbox("update_on_checksum_change", "update_on_checksum_change_l");
890
891 print "</div>";
892
893 print "<div class='dlgButtons'>
894 <button dojoType=\"dijit.form.Button\"
895 onclick=\"return dijit.byId('feedEditDlg').execute()\">".
896 __('Save')."</button>
897 <button dojoType=\"dijit.form.Button\"
898 onclick=\"return dijit.byId('feedEditDlg').hide()\">".
899 __('Cancel')."</button>
900 </div>";
901
902 return;
903 }
904
905 function batchEditSave() {
3a76e2a2 906 return $this->editsaveops(true);
afcfe6ca 907 }
46da73c2 908
afcfe6ca 909 function editSave() {
3a76e2a2 910 return $this->editsaveops(false);
afcfe6ca 911 }
46da73c2
AD
912
913 function editsaveops($batch) {
914
afcfe6ca
AD
915 $feed_title = db_escape_string(trim($_POST["title"]));
916 $feed_link = db_escape_string(trim($_POST["feed_url"]));
917 $upd_intl = (int) db_escape_string($_POST["update_interval"]);
918 $purge_intl = (int) db_escape_string($_POST["purge_interval"]);
919 $feed_id = (int) db_escape_string($_POST["id"]); /* editSave */
920 $feed_ids = db_escape_string($_POST["ids"]); /* batchEditSave */
921 $cat_id = (int) db_escape_string($_POST["cat_id"]);
922 $auth_login = db_escape_string(trim($_POST["auth_login"]));
923 $auth_pass = db_escape_string(trim($_POST["auth_pass"]));
924 $private = checkbox_to_sql_bool(db_escape_string($_POST["private"]));
925 $rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"]));
926 $include_in_digest = checkbox_to_sql_bool(
927 db_escape_string($_POST["include_in_digest"]));
928 $cache_images = checkbox_to_sql_bool(
929 db_escape_string($_POST["cache_images"]));
87764a50
AD
930 $cache_content = checkbox_to_sql_bool(
931 db_escape_string($_POST["cache_content"]));
afcfe6ca
AD
932 $update_method = (int) db_escape_string($_POST["update_method"]);
933
934 $always_display_enclosures = checkbox_to_sql_bool(
935 db_escape_string($_POST["always_display_enclosures"]));
936
937 $mark_unread_on_update = checkbox_to_sql_bool(
938 db_escape_string($_POST["mark_unread_on_update"]));
939
940 $update_on_checksum_change = checkbox_to_sql_bool(
941 db_escape_string($_POST["update_on_checksum_change"]));
942
943 if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
944 if ($cat_id && $cat_id != 0) {
945 $category_qpart = "cat_id = '$cat_id',";
946 $category_qpart_nocomma = "cat_id = '$cat_id'";
947 } else {
948 $category_qpart = 'cat_id = NULL,';
949 $category_qpart_nocomma = 'cat_id = NULL';
950 }
951 } else {
952 $category_qpart = "";
953 $category_qpart_nocomma = "";
954 }
955
3a76e2a2 956 if (!$batch) {
afcfe6ca
AD
957
958 $result = db_query($this->link, "UPDATE ttrss_feeds SET
959 $category_qpart
960 title = '$feed_title', feed_url = '$feed_link',
961 update_interval = '$upd_intl',
962 purge_interval = '$purge_intl',
963 auth_login = '$auth_login',
964 auth_pass = '$auth_pass',
965 private = $private,
966 rtl_content = $rtl_content,
87764a50
AD
967 cache_images = $cache_images,
968 cache_content = $cache_content,
afcfe6ca
AD
969 include_in_digest = $include_in_digest,
970 always_display_enclosures = $always_display_enclosures,
971 mark_unread_on_update = $mark_unread_on_update,
972 update_on_checksum_change = $update_on_checksum_change,
973 update_method = '$update_method'
974 WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
975
3a76e2a2 976 } else {
afcfe6ca
AD
977 $feed_data = array();
978
979 foreach (array_keys($_POST) as $k) {
980 if ($k != "op" && $k != "method" && $k != "ids") {
981 $feed_data[$k] = $_POST[$k];
982 }
983 }
984
985 db_query($this->link, "BEGIN");
986
987 foreach (array_keys($feed_data) as $k) {
988
989 $qpart = "";
990
991 switch ($k) {
992 case "title":
993 $qpart = "title = '$feed_title'";
994 break;
995
996 case "feed_url":
997 $qpart = "feed_url = '$feed_link'";
998 break;
999
1000 case "update_interval":
1001 $qpart = "update_interval = '$upd_intl'";
1002 break;
1003
1004 case "purge_interval":
1005 $qpart = "purge_interval = '$purge_intl'";
1006 break;
1007
1008 case "auth_login":
1009 $qpart = "auth_login = '$auth_login'";
1010 break;
1011
1012 case "auth_pass":
1013 $qpart = "auth_pass = '$auth_pass'";
1014 break;
1015
1016 case "private":
a498d18b 1017 $qpart = "private = $private";
afcfe6ca
AD
1018 break;
1019
1020 case "include_in_digest":
a498d18b 1021 $qpart = "include_in_digest = $include_in_digest";
afcfe6ca
AD
1022 break;
1023
1024 case "always_display_enclosures":
a498d18b 1025 $qpart = "always_display_enclosures = $always_display_enclosures";
afcfe6ca
AD
1026 break;
1027
1028 case "mark_unread_on_update":
a498d18b 1029 $qpart = "mark_unread_on_update = $mark_unread_on_update";
afcfe6ca
AD
1030 break;
1031
1032 case "update_on_checksum_change":
a498d18b 1033 $qpart = "update_on_checksum_change = $update_on_checksum_change";
afcfe6ca
AD
1034 break;
1035
1036 case "cache_images":
a498d18b 1037 $qpart = "cache_images = $cache_images";
afcfe6ca
AD
1038 break;
1039
87764a50
AD
1040 case "cache_content":
1041 $qpart = "cache_content = $cache_content";
1042 break;
1043
afcfe6ca 1044 case "rtl_content":
a498d18b 1045 $qpart = "rtl_content = $rtl_content";
afcfe6ca
AD
1046 break;
1047
1048 case "update_method":
1049 $qpart = "update_method = '$update_method'";
1050 break;
1051
1052 case "cat_id":
1053 $qpart = $category_qpart_nocomma;
1054 break;
1055
1056 }
1057
1058 if ($qpart) {
1059 db_query($this->link,
1060 "UPDATE ttrss_feeds SET $qpart WHERE id IN ($feed_ids)
1061 AND owner_uid = " . $_SESSION["uid"]);
1062 print "<br/>";
1063 }
1064 }
1065
1066 db_query($this->link, "COMMIT");
1067 }
1068 return;
1069 }
1070
1071 function resetPubSub() {
1072
1073 $ids = db_escape_string($_REQUEST["ids"]);
1074
1075 db_query($this->link, "UPDATE ttrss_feeds SET pubsub_state = 0 WHERE id IN ($ids)
1076 AND owner_uid = " . $_SESSION["uid"]);
1077
1078 return;
1079 }
1080
1081 function remove() {
1082
1083 $ids = split(",", db_escape_string($_REQUEST["ids"]));
1084
1085 foreach ($ids as $id) {
1086 remove_feed($this->link, $id, $_SESSION["uid"]);
1087 }
1088
1089 return;
1090 }
1091
1092 function clear() {
1093 $id = db_escape_string($_REQUEST["id"]);
1094 clear_feed_articles($this->link, $id);
1095 }
1096
1097 function rescore() {
92c14e9d
AD
1098 require_once "rssfuncs.php";
1099
afcfe6ca
AD
1100 $ids = split(",", db_escape_string($_REQUEST["ids"]));
1101
1102 foreach ($ids as $id) {
1103
1104 $filters = load_filters($this->link, $id, $_SESSION["uid"], 6);
1105
1106 $result = db_query($this->link, "SELECT
1107 title, content, link, ref_id, author,".
1108 SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated
1109 FROM
1110 ttrss_user_entries, ttrss_entries
1111 WHERE ref_id = id AND feed_id = '$id' AND
1112 owner_uid = " .$_SESSION['uid']."
1113 ");
1114
1115 $scores = array();
1116
1117 while ($line = db_fetch_assoc($result)) {
1118
1119 $tags = get_article_tags($this->link, $line["ref_id"]);
1120
1121 $article_filters = get_article_filters($filters, $line['title'],
1122 $line['content'], $line['link'], strtotime($line['updated']),
1123 $line['author'], $tags);
1124
1125 $new_score = calculate_article_score($article_filters);
1126
1127 if (!$scores[$new_score]) $scores[$new_score] = array();
1128
1129 array_push($scores[$new_score], $line['ref_id']);
1130 }
1131
1132 foreach (array_keys($scores) as $s) {
1133 if ($s > 1000) {
1134 db_query($this->link, "UPDATE ttrss_user_entries SET score = '$s',
1135 marked = true WHERE
1136 ref_id IN (" . join(',', $scores[$s]) . ")");
1137 } else if ($s < -500) {
1138 db_query($this->link, "UPDATE ttrss_user_entries SET score = '$s',
1139 unread = false WHERE
1140 ref_id IN (" . join(',', $scores[$s]) . ")");
1141 } else {
1142 db_query($this->link, "UPDATE ttrss_user_entries SET score = '$s' WHERE
1143 ref_id IN (" . join(',', $scores[$s]) . ")");
1144 }
1145 }
1146 }
1147
1148 print __("All done.");
1149
1150 }
1151
1152 function rescoreAll() {
1153
1154 $result = db_query($this->link,
1155 "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']);
1156
1157 while ($feed_line = db_fetch_assoc($result)) {
1158
1159 $id = $feed_line["id"];
1160
1161 $filters = load_filters($this->link, $id, $_SESSION["uid"], 6);
1162
1163 $tmp_result = db_query($this->link, "SELECT
1164 title, content, link, ref_id, author,".
1165 SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated
1166 FROM
1167 ttrss_user_entries, ttrss_entries
1168 WHERE ref_id = id AND feed_id = '$id' AND
1169 owner_uid = " .$_SESSION['uid']."
1170 ");
1171
1172 $scores = array();
1173
1174 while ($line = db_fetch_assoc($tmp_result)) {
1175
1176 $tags = get_article_tags($this->link, $line["ref_id"]);
1177
1178 $article_filters = get_article_filters($filters, $line['title'],
1179 $line['content'], $line['link'], strtotime($line['updated']),
1180 $line['author'], $tags);
1181
1182 $new_score = calculate_article_score($article_filters);
1183
1184 if (!$scores[$new_score]) $scores[$new_score] = array();
1185
1186 array_push($scores[$new_score], $line['ref_id']);
1187 }
1188
1189 foreach (array_keys($scores) as $s) {
1190 if ($s > 1000) {
1191 db_query($this->link, "UPDATE ttrss_user_entries SET score = '$s',
1192 marked = true WHERE
1193 ref_id IN (" . join(',', $scores[$s]) . ")");
1194 } else {
1195 db_query($this->link, "UPDATE ttrss_user_entries SET score = '$s' WHERE
1196 ref_id IN (" . join(',', $scores[$s]) . ")");
1197 }
1198 }
1199 }
1200
1201 print __("All done.");
1202
1203 }
1204
afcfe6ca
AD
1205 function categorize() {
1206 $ids = split(",", db_escape_string($_REQUEST["ids"]));
1207
1208 $cat_id = db_escape_string($_REQUEST["cat_id"]);
1209
1210 if ($cat_id == 0) {
1211 $cat_id_qpart = 'NULL';
1212 } else {
1213 $cat_id_qpart = "'$cat_id'";
1214 }
1215
1216 db_query($this->link, "BEGIN");
1217
1218 foreach ($ids as $id) {
1219
1220 db_query($this->link, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
1221 WHERE id = '$id'
1222 AND owner_uid = " . $_SESSION["uid"]);
1223
1224 }
1225
1226 db_query($this->link, "COMMIT");
1227 }
1228
28537341
AD
1229 function removeCat() {
1230 $ids = split(",", db_escape_string($_REQUEST["ids"]));
1231 foreach ($ids as $id) {
1232 remove_feed_category($this->link, $id, $_SESSION["uid"]);
1233 }
1234 }
1235
1236 function addCat() {
1237 $feed_cat = db_escape_string(trim($_REQUEST["cat"]));
1238
1239 add_feed_category($this->link, $feed_cat);
1240 }
1241
afcfe6ca
AD
1242 function index() {
1243
1244 print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
1245 print "<div id=\"pref-feeds-feeds\" dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Feeds')."\">";
1246
1247 $result = db_query($this->link, "SELECT COUNT(id) AS num_errors
1248 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
1249
1250 $num_errors = db_fetch_result($result, 0, "num_errors");
1251
1252 if ($num_errors > 0) {
1253
1254 $error_button = "<button dojoType=\"dijit.form.Button\"
1255 onclick=\"showFeedsWithErrors()\" id=\"errorButton\">" .
1256 __("Feeds with errors") . "</button>";
1257 }
1258
1259 if (DB_TYPE == "pgsql") {
1260 $interval_qpart = "NOW() - INTERVAL '3 months'";
1261 } else {
1262 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)";
1263 }
1264
1265 $result = db_query($this->link, "SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE
1266 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
1267 ttrss_entries.id = ref_id AND
1268 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart AND
1269 ttrss_feeds.owner_uid = ".$_SESSION["uid"]);
1270
1271 $num_inactive = db_fetch_result($result, 0, "num_inactive");
1272
1273 if ($num_inactive > 0) {
1274 $inactive_button = "<button dojoType=\"dijit.form.Button\"
1275 onclick=\"showInactiveFeeds()\">" .
1276 __("Inactive feeds") . "</button>";
1277 }
1278
1279 $feed_search = db_escape_string($_REQUEST["search"]);
1280
1281 if (array_key_exists("search", $_REQUEST)) {
1282 $_SESSION["prefs_feed_search"] = $feed_search;
1283 } else {
1284 $feed_search = $_SESSION["prefs_feed_search"];
1285 }
1286
1287 print '<div dojoType="dijit.layout.BorderContainer" gutters="false">';
1288
1289 print "<div region='top' dojoType=\"dijit.Toolbar\">"; #toolbar
1290
1291 print "<div style='float : right; padding-right : 4px;'>
1292 <input dojoType=\"dijit.form.TextBox\" id=\"feed_search\" size=\"20\" type=\"search\"
1293 value=\"$feed_search\">
1294 <button dojoType=\"dijit.form.Button\" onclick=\"updateFeedList()\">".
1295 __('Search')."</button>
1296 </div>";
1297
1298 print "<div dojoType=\"dijit.form.DropDownButton\">".
1299 "<span>" . __('Select')."</span>";
1300 print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
1301 print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(true)\"
1302 dojoType=\"dijit.MenuItem\">".__('All')."</div>";
1303 print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(false)\"
1304 dojoType=\"dijit.MenuItem\">".__('None')."</div>";
1305 print "</div></div>";
1306
1307 print "<div dojoType=\"dijit.form.DropDownButton\">".
1308 "<span>" . __('Feeds')."</span>";
1309 print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
1310 print "<div onclick=\"quickAddFeed()\"
1311 dojoType=\"dijit.MenuItem\">".__('Subscribe to feed')."</div>";
1312 print "<div onclick=\"editSelectedFeed()\"
1313 dojoType=\"dijit.MenuItem\">".__('Edit selected feeds')."</div>";
1314 print "<div onclick=\"resetFeedOrder()\"
1315 dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>";
33f0fdd0
AD
1316 print "<div onclick=\"batchSubscribe()\"
1317 dojoType=\"dijit.MenuItem\">".__('Batch subscribe')."</div>";
afcfe6ca
AD
1318 print "</div></div>";
1319
1320 if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
1321 print "<div dojoType=\"dijit.form.DropDownButton\">".
1322 "<span>" . __('Categories')."</span>";
1323 print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
5ef071e0
AD
1324 print "<div onclick=\"createCategory()\"
1325 dojoType=\"dijit.MenuItem\">".__('Add category')."</div>";
5b7bd238
AD
1326 print "<div onclick=\"toggleHiddenFeedCats()\"
1327 dojoType=\"dijit.MenuItem\">".__('(Un)hide empty categories')."</div>";
afcfe6ca
AD
1328 print "<div onclick=\"resetCatOrder()\"
1329 dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>";
fd26d5bf
AD
1330 print "<div onclick=\"removeSelectedCategories()\"
1331 dojoType=\"dijit.MenuItem\">".__('Remove selected')."</div>";
afcfe6ca
AD
1332 print "</div></div>";
1333
1334 }
1335
1336 print $error_button;
1337 print $inactive_button;
1338
1339 print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedFeeds()\">"
1340 .__('Unsubscribe')."</button dojoType=\"dijit.form.Button\"> ";
1341
1342 if (defined('_ENABLE_FEED_DEBUGGING')) {
1343
1344 print "<select id=\"feedActionChooser\" onchange=\"feedActionChange()\">
1345 <option value=\"facDefault\" selected>".__('More actions...')."</option>";
1346
1347 if (FORCE_ARTICLE_PURGE == 0) {
1348 print
1349 "<option value=\"facPurge\">".__('Manual purge')."</option>";
1350 }
1351
1352 print "
1353 <option value=\"facClear\">".__('Clear feed data')."</option>
1354 <option value=\"facRescore\">".__('Rescore articles')."</option>";
1355
1356 print "</select>";
1357
1358 }
1359
1360 print "</div>"; # toolbar
1361
1362 //print '</div>';
1363 print '<div dojoType="dijit.layout.ContentPane" region="center">';
1364
1365 print "<div id=\"feedlistLoading\">
1366 <img src='images/indicator_tiny.gif'>".
1367 __("Loading, please wait...")."</div>";
1368
1369 print "<div dojoType=\"fox.PrefFeedStore\" jsId=\"feedStore\"
1370 url=\"backend.php?op=pref-feeds&method=getfeedtree\">
1371 </div>
1372 <div dojoType=\"lib.CheckBoxStoreModel\" jsId=\"feedModel\" store=\"feedStore\"
1373 query=\"{id:'root'}\" rootId=\"root\" rootLabel=\"Feeds\"
1374 childrenAttrs=\"items\" checkboxStrict=\"false\" checkboxAll=\"false\">
1375 </div>
1376 <div dojoType=\"fox.PrefFeedTree\" id=\"feedTree\"
1377 dndController=\"dijit.tree.dndSource\"
1378 betweenThreshold=\"5\"
1379 model=\"feedModel\" openOnClick=\"false\">
1380 <script type=\"dojo/method\" event=\"onClick\" args=\"item\">
1381 var id = String(item.id);
1382 var bare_id = id.substr(id.indexOf(':')+1);
1383
1384 if (id.match('FEED:')) {
1385 editFeed(bare_id);
1386 } else if (id.match('CAT:')) {
1387 editCat(bare_id, item);
1388 }
1389 </script>
1390 <script type=\"dojo/method\" event=\"onLoad\" args=\"item\">
1391 Element.hide(\"feedlistLoading\");
1392 </script>
1393 </div>";
1394
ba5296a1
AD
1395# print "<div dojoType=\"dijit.Tooltip\" connectId=\"feedTree\" position=\"below\">
1396# ".__('<b>Hint:</b> you can drag feeds and categories around.')."
1397# </div>";
afcfe6ca
AD
1398
1399 print '</div>';
1400 print '</div>';
1401
1402 print "</div>"; # feeds pane
1403
566faa14 1404 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Import and export')."\">";
afcfe6ca 1405
a1159c01 1406 print "<h3>" . __("OPML") . "</h3>";
afcfe6ca 1407
566faa14 1408 print "<p>" . __("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") . " ";
afcfe6ca 1409
566faa14 1410 print __("Only main settings profile can be migrated using OPML.") . "</p>";
afcfe6ca 1411
55f34b81 1412 print "<iframe id=\"upload_iframe\"
afcfe6ca
AD
1413 name=\"upload_iframe\" onload=\"opmlImportComplete(this)\"
1414 style=\"width: 400px; height: 100px; display: none;\"></iframe>";
1415
1416 print "<form name=\"opml_form\" style='display : block' target=\"upload_iframe\"
1417 enctype=\"multipart/form-data\" method=\"POST\"
55f34b81 1418 action=\"backend.php\">
afcfe6ca
AD
1419 <input id=\"opml_file\" name=\"opml_file\" type=\"file\">&nbsp;
1420 <input type=\"hidden\" name=\"op\" value=\"dlg\">
c4c74732 1421 <input type=\"hidden\" name=\"method\" value=\"importOpml\">
afcfe6ca 1422 <button dojoType=\"dijit.form.Button\" onclick=\"return opmlImport();\" type=\"submit\">" .
a1159c01 1423 __('Import my OPML') . "</button>";
afcfe6ca 1424
a1159c01 1425 print "<hr>";
afcfe6ca
AD
1426
1427 print "<p>" . __('Filename:') .
1428 " <input type=\"text\" id=\"filename\" value=\"TinyTinyRSS.opml\" />&nbsp;" .
a1159c01 1429 __('Include settings') . "<input type=\"checkbox\" id=\"settings\" checked=\"1\"/>";
afcfe6ca 1430
a1159c01 1431 print "</p><button dojoType=\"dijit.form.Button\"
afcfe6ca 1432 onclick=\"gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked)\" >" .
a1159c01 1433 __('Export OPML') . "</button></p></form>";
afcfe6ca 1434
a1159c01 1435 print "<hr>";
afcfe6ca
AD
1436
1437 print "<p>".__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . " ";
1438
566faa14 1439 print __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") . "</p>";
afcfe6ca
AD
1440
1441 print "<button dojoType=\"dijit.form.Button\" onclick=\"return displayDlg('pubOPMLUrl')\">".
a1159c01 1442 __('Display published OPML URL')."</button> ";
afcfe6ca 1443
55f34b81 1444
a1159c01 1445 print "<h3>" . __("Article archive") . "</h3>";
566faa14 1446
a1159c01 1447 print "<p>" . __("You can export and import your Starred and Archived articles for safekeeping or when migrating between tt-rss instances.") . "</p>";
566faa14
AD
1448
1449 print "<button dojoType=\"dijit.form.Button\" onclick=\"return exportData()\">".
1450 __('Export my data')."</button> ";
1451
a1159c01 1452 print "<hr>";
55f34b81
AD
1453
1454 print "<iframe id=\"data_upload_iframe\"
1455 name=\"data_upload_iframe\" onload=\"dataImportComplete(this)\"
1456 style=\"width: 400px; height: 100px; display: none;\"></iframe>";
1457
41f68571 1458 print "<form name=\"import_form\" style='display : block' target=\"data_upload_iframe\"
55f34b81
AD
1459 enctype=\"multipart/form-data\" method=\"POST\"
1460 action=\"backend.php\">
1461 <input id=\"export_file\" name=\"export_file\" type=\"file\">&nbsp;
1462 <input type=\"hidden\" name=\"op\" value=\"dlg\">
1463 <input type=\"hidden\" name=\"method\" value=\"dataimport\">
1464 <button dojoType=\"dijit.form.Button\" onclick=\"return importData();\" type=\"submit\">" .
1465 __('Import') . "</button>";
1466
1467
afcfe6ca
AD
1468 print "</div>"; # pane
1469
1470 if (strpos($_SERVER['HTTP_USER_AGENT'], "Firefox") !== false) {
1471
1472 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Firefox integration')."\">";
1473
1474 print "<p>" . __('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.') . "</p>";
1475
1476 print "<p>";
1477
1478 print "<button onclick='window.navigator.registerContentHandler(" .
1479 "\"application/vnd.mozilla.maybe.feed\", " .
1480 "\"" . add_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" .
1481 __('Click here to register this site as a feed reader.') .
1482 "</button>";
1483
1484 print "</p>";
1485
1486 print "</div>"; # pane
1487 }
1488
8361e724 1489 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Bookmarklets')."\">";
afcfe6ca
AD
1490
1491 print "<p>" . __("Drag the link below to your browser toolbar, open the feed you're interested in in your browser and click on the link to subscribe to it.") . "</p>";
1492
1493 $bm_subscribe_url = str_replace('%s', '', add_feed_url());
1494
b1e592d3 1495 $confirm_str = str_replace("'", "\'", __('Subscribe to %s in Tiny Tiny RSS?'));
afcfe6ca
AD
1496
1497 $bm_url = htmlspecialchars("javascript:{if(confirm('$confirm_str'.replace('%s',window.location.href)))window.location.href='$bm_subscribe_url'+window.location.href}");
1498
1499 print "<a href=\"$bm_url\" class='bookmarklet'>" . __('Subscribe in Tiny Tiny RSS'). "</a>";
1500
8361e724
AD
1501 print "<p>" . __("Use this bookmarklet to publish arbitrary pages using Tiny Tiny RSS") . "</p>";
1502
1b4d1a6b 1503 $bm_url = htmlspecialchars("javascript:(function(){var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='".SELF_URL_PATH."/public.php?op=sharepopup',l=d.location,e=encodeURIComponent,g=f+'&title='+((e(s))?e(s):e(document.title))+'&url='+e(l.href);function a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=500,height=250')){l.href=g;}}a();})()");
8361e724
AD
1504
1505 print "<a href=\"$bm_url\" class='bookmarklet'>" . __('Share with Tiny Tiny RSS'). "</a>";
1506
afcfe6ca
AD
1507 print "</div>"; #pane
1508
e95e7819 1509 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Published & shared articles / Generated feeds')."\">";
afcfe6ca
AD
1510
1511 print "<h3>" . __("Published articles and generated feeds") . "</h3>";
1512
1513 print "<p>".__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.')."</p>";
1514
1515 $rss_url = '-2::' . htmlspecialchars(get_self_url_prefix() .
1516 "/public.php?op=rss&id=-2&view-mode=all_articles");;
1517
1518 print "<button dojoType=\"dijit.form.Button\" onclick=\"return displayDlg('generatedFeed', '$rss_url')\">".
1519 __('Display URL')."</button> ";
1520
1521 print "<button dojoType=\"dijit.form.Button\" onclick=\"return clearFeedAccessKeys()\">".
1522 __('Clear all generated URLs')."</button> ";
1523
1524 print "<h3>" . __("Articles shared by URL") . "</h3>";
1525
1526 print "<p>" . __("You can disable all articles shared by unique URLs here.") . "</p>";
1527
1528 print "<button dojoType=\"dijit.form.Button\" onclick=\"return clearArticleAccessKeys()\">".
1529 __('Unshare all articles')."</button> ";
1530
1531 print "</div>"; #pane
1532
afcfe6ca
AD
1533 print "</div>"; #container
1534
1535 }
2ecd2df5
AD
1536
1537 private function feedlist_init_cat($cat_id, $hidden = false) {
1538 $obj = array();
1539 $cat_id = (int) $cat_id;
1540
1541 if ($cat_id > 0) {
1542 $cat_unread = ccache_find($this->link, $cat_id, $_SESSION["uid"], true);
1543 } else if ($cat_id == 0 || $cat_id == -2) {
1544 $cat_unread = getCategoryUnread($this->link, $cat_id);
1545 }
1546
1547 $obj['id'] = 'CAT:' . $cat_id;
1548 $obj['items'] = array();
1549 $obj['name'] = getCategoryTitle($this->link, $cat_id);
1550 $obj['type'] = 'category';
1551 $obj['unread'] = (int) $cat_unread;
1552 $obj['hidden'] = $hidden;
1553 $obj['bare_id'] = $cat_id;
1554
1555 return $obj;
1556 }
1557
1558 private function feedlist_init_feed($feed_id, $title = false, $unread = false, $error = '', $updated = '') {
1559 $obj = array();
1560 $feed_id = (int) $feed_id;
1561
1562 if (!$title)
1563 $title = getFeedTitle($this->link, $feed_id, false);
1564
1565 if ($unread === false)
1566 $unread = getFeedUnread($this->link, $feed_id, false);
1567
1568 $obj['id'] = 'FEED:' . $feed_id;
1569 $obj['name'] = $title;
1570 $obj['unread'] = (int) $unread;
1571 $obj['type'] = 'feed';
1572 $obj['error'] = $error;
1573 $obj['updated'] = $updated;
1574 $obj['icon'] = getFeedIcon($feed_id);
1575 $obj['bare_id'] = $feed_id;
1576
1577 return $obj;
1578 }
1579
bc6fa236
AD
1580 function inactiveFeeds() {
1581
1582 if (DB_TYPE == "pgsql") {
1583 $interval_qpart = "NOW() - INTERVAL '3 months'";
1584 } else {
1585 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)";
1586 }
1587
1588 $result = db_query($this->link, "SELECT ttrss_feeds.title, ttrss_feeds.site_url,
1589 ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article
1590 FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE
1591 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
1592 ttrss_entries.id = ref_id AND
1593 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart
1594 AND ttrss_feeds.owner_uid = ".$_SESSION["uid"]." AND
1595 ttrss_user_entries.feed_id = ttrss_feeds.id AND
1596 ttrss_entries.id = ref_id
1597 GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url
1598 ORDER BY last_article");
1599
1600 print "<div class=\"dialogNotice\">" . __("These feeds have not been updated with new content for 3 months (oldest first):") . "</div>";
1601
1602 print "<div dojoType=\"dijit.Toolbar\">";
1603 print "<div dojoType=\"dijit.form.DropDownButton\">".
1604 "<span>" . __('Select')."</span>";
1605 print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
1606 print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'all')\"
1607 dojoType=\"dijit.MenuItem\">".__('All')."</div>";
1608 print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'none')\"
1609 dojoType=\"dijit.MenuItem\">".__('None')."</div>";
1610 print "</div></div>";
1611 print "</div>"; #toolbar
1612
1613 print "<div class=\"inactiveFeedHolder\">";
1614
1615 print "<table width=\"100%\" cellspacing=\"0\" id=\"prefInactiveFeedList\">";
1616
1617 $lnum = 1;
1618
1619 while ($line = db_fetch_assoc($result)) {
1620
1621 $class = ($lnum % 2) ? "even" : "odd";
1622 $feed_id = $line["id"];
1623 $this_row_id = "id=\"FUPDD-$feed_id\"";
1624
1625 # class needed for selectTableRows()
1626 print "<tr class=\"placeholder\" $this_row_id>";
1627
1628 $edit_title = htmlspecialchars($line["title"]);
1629
1630 # id needed for selectTableRows()
1631 print "<td width='5%' align='center'><input
1632 onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
1633 type=\"checkbox\" id=\"FUPDC-$feed_id\"></td>";
1634 print "<td>";
1635
1636 print "<a class=\"visibleLink\" href=\"#\" ".
1637 "title=\"".__("Click to edit feed")."\" ".
1638 "onclick=\"editFeed(".$line["id"].")\">".
1639 htmlspecialchars($line["title"])."</a>";
1640
1641 print "</td><td class=\"insensitive\" align='right'>";
1642 print make_local_datetime($this->link, $line['last_article'], false);
1643 print "</td>";
1644 print "</tr>";
1645
1646 ++$lnum;
1647 }
1648
1649 print "</table>";
1650 print "</div>";
1651
1652 print "<div class='dlgButtons'>";
1653 print "<div style='float : left'>";
1654 print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').removeSelected()\">"
1655 .__('Unsubscribe from selected feeds')."</button> ";
1656 print "</div>";
1657
1658 print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').hide()\">".
1659 __('Close this window')."</button>";
1660
1661 print "</div>";
1662
1663 }
1664
1665 function feedsWithErrors() {
1666 print "<div class=\"dialogNotice\">" . __("These feeds have not been updated because of errors:") . "</div>";
1667
1668 $result = db_query($this->link, "SELECT id,title,feed_url,last_error,site_url
1669 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
1670
1671 print "<div dojoType=\"dijit.Toolbar\">";
1672 print "<div dojoType=\"dijit.form.DropDownButton\">".
1673 "<span>" . __('Select')."</span>";
1674 print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
1675 print "<div onclick=\"selectTableRows('prefErrorFeedList', 'all')\"
1676 dojoType=\"dijit.MenuItem\">".__('All')."</div>";
1677 print "<div onclick=\"selectTableRows('prefErrorFeedList', 'none')\"
1678 dojoType=\"dijit.MenuItem\">".__('None')."</div>";
1679 print "</div></div>";
1680 print "</div>"; #toolbar
1681
1682 print "<div class=\"inactiveFeedHolder\">";
1683
1684 print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
1685
1686 $lnum = 1;
1687
1688 while ($line = db_fetch_assoc($result)) {
1689
1690 $class = ($lnum % 2) ? "even" : "odd";
1691 $feed_id = $line["id"];
1692 $this_row_id = "id=\"FERDD-$feed_id\"";
1693
1694 # class needed for selectTableRows()
1695 print "<tr class=\"placeholder\" $this_row_id>";
1696
1697 $edit_title = htmlspecialchars($line["title"]);
1698
1699 # id needed for selectTableRows()
1700 print "<td width='5%' align='center'><input
1701 onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
1702 type=\"checkbox\" id=\"FERDC-$feed_id\"></td>";
1703 print "<td>";
1704
1705 print "<a class=\"visibleLink\" href=\"#\" ".
1706 "title=\"".__("Click to edit feed")."\" ".
1707 "onclick=\"editFeed(".$line["id"].")\">".
1708 htmlspecialchars($line["title"])."</a>: ";
1709
1710 print "<span class=\"insensitive\">";
1711 print htmlspecialchars($line["last_error"]);
1712 print "</span>";
1713
1714 print "</td>";
1715 print "</tr>";
1716
1717 ++$lnum;
1718 }
1719
1720 print "</table>";
1721 print "</div>";
1722
1723 print "<div class='dlgButtons'>";
1724 print "<div style='float : left'>";
1725 print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').removeSelected()\">"
1726 .__('Unsubscribe from selected feeds')."</button> ";
1727 print "</div>";
1728
1729 print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').hide()\">".
1730 __('Close this window')."</button>";
1731
1732 print "</div>";
1733 }
1734
afcfe6ca
AD
1735}
1736?>