]>
Commit | Line | Data |
---|---|---|
ef8be8ea | 1 | <?php |
d20f3544 | 2 | |
758e1c4a | 3 | function batch_edit_cbox($elem, $label = false) { |
cd935c42 | 4 | print "<input type=\"checkbox\" title=\"".__("Check to enable field")."\" |
758e1c4a AD |
5 | onchange=\"batchFeedsToggleField(this, '$elem', '$label')\">"; |
6 | } | |
7 | ||
ef8be8ea AD |
8 | function module_pref_feeds($link) { |
9 | ||
d20f3544 AD |
10 | global $update_intervals; |
11 | global $purge_intervals; | |
16211ddb | 12 | global $update_methods; |
d20f3544 | 13 | |
ef8be8ea AD |
14 | $subop = $_REQUEST["subop"]; |
15 | $quiet = $_REQUEST["quiet"]; | |
082ae95b | 16 | $mode = $_REQUEST["mode"]; |
ef8be8ea | 17 | |
7b8a143f AD |
18 | if ($subop == "renamecat") { |
19 | $title = db_escape_string($_REQUEST['title']); | |
20 | $id = db_escape_string($_REQUEST['id']); | |
21 | ||
22 | if ($title) { | |
23 | db_query($link, "UPDATE ttrss_feed_categories SET | |
24 | title = '$title' WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]); | |
25 | } | |
26 | return; | |
27 | } | |
28 | ||
29 | if ($subop == "getfeedtree") { | |
30 | ||
31 | $root = array(); | |
32 | $root['id'] = 'root'; | |
33 | $root['name'] = __('Feeds'); | |
34 | $root['items'] = array(); | |
35 | ||
36 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
37 | ||
38 | $result = db_query($link, "SELECT id, title FROM ttrss_feed_categories | |
39 | WHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY order_id, title"); | |
40 | ||
41 | while ($line = db_fetch_assoc($result)) { | |
42 | $cat = array(); | |
43 | $cat['id'] = 'CAT:' . $line['id']; | |
44 | $cat['bare_id'] = $feed_id; | |
45 | $cat['name'] = $line['title']; | |
46 | $cat['items'] = array(); | |
47 | ||
82aea978 AD |
48 | $feed_result = db_query($link, "SELECT id, title, last_error |
49 | FROM ttrss_feeds | |
7b8a143f AD |
50 | WHERE cat_id = '".$line['id']."' AND owner_uid = ".$_SESSION["uid"]. |
51 | " ORDER BY order_id, title"); | |
52 | ||
53 | while ($feed_line = db_fetch_assoc($feed_result)) { | |
54 | $feed = array(); | |
55 | $feed['id'] = 'FEED:' . $feed_line['id']; | |
56 | $feed['bare_id'] = $feed_line['id']; | |
57 | $feed['name'] = $feed_line['title']; | |
58 | $feed['checkbox'] = false; | |
82aea978 AD |
59 | $feed['error'] = $feed_line['last_error']; |
60 | $feed['icon'] = getFeedIcon($feed_line['id']); | |
61 | ||
7b8a143f AD |
62 | array_push($cat['items'], $feed); |
63 | } | |
64 | ||
65 | array_push($root['items'], $cat); | |
66 | } | |
67 | ||
68 | /* Uncategorized is a special case */ | |
69 | ||
70 | $cat = array(); | |
71 | $cat['id'] = 'CAT:0'; | |
72 | $cat['bare_id'] = 0; | |
73 | $cat['name'] = __("Uncategorized"); | |
74 | $cat['items'] = array(); | |
75 | ||
82aea978 AD |
76 | $feed_result = db_query($link, "SELECT id, title,last_error |
77 | FROM ttrss_feeds | |
7b8a143f AD |
78 | WHERE cat_id IS NULL AND owner_uid = ".$_SESSION["uid"]. |
79 | " ORDER BY order_id, title"); | |
80 | ||
81 | while ($feed_line = db_fetch_assoc($feed_result)) { | |
82 | $feed = array(); | |
83 | $feed['id'] = 'FEED:' . $feed_line['id']; | |
84 | $feed['bare_id'] = $feed_line['id']; | |
85 | $feed['name'] = $feed_line['title']; | |
86 | $feed['checkbox'] = false; | |
82aea978 AD |
87 | $feed['error'] = $feed_line['last_error']; |
88 | $feed['icon'] = getFeedIcon($feed_line['id']); | |
89 | ||
7b8a143f AD |
90 | array_push($cat['items'], $feed); |
91 | } | |
92 | ||
93 | array_push($root['items'], $cat); | |
94 | } else { | |
82aea978 AD |
95 | $feed_result = db_query($link, "SELECT id, title, last_error |
96 | FROM ttrss_feeds | |
7b8a143f AD |
97 | WHERE owner_uid = ".$_SESSION["uid"]. |
98 | " ORDER BY order_id, title"); | |
99 | ||
100 | while ($feed_line = db_fetch_assoc($feed_result)) { | |
101 | $feed = array(); | |
102 | $feed['id'] = 'FEED:' . $feed_line['id']; | |
103 | $feed['bare_id'] = $feed_line['id']; | |
104 | $feed['name'] = $feed_line['title']; | |
105 | $feed['checkbox'] = false; | |
82aea978 AD |
106 | $feed['error'] = $feed_line['last_error']; |
107 | $feed['icon'] = getFeedIcon($feed_line['id']); | |
108 | ||
7b8a143f AD |
109 | array_push($root['items'], $feed); |
110 | } | |
111 | } | |
112 | ||
113 | $fl = array(); | |
114 | $fl['identifier'] = 'id'; | |
115 | $fl['label'] = 'name'; | |
116 | $fl['items'] = array($root); | |
117 | ||
118 | print json_encode($fl); | |
119 | return; | |
120 | } | |
121 | ||
122 | if ($subop == "catsortreset") { | |
123 | db_query($link, "UPDATE ttrss_feed_categories | |
124 | SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]); | |
125 | return; | |
126 | } | |
127 | ||
128 | if ($subop == "feedsortreset") { | |
129 | db_query($link, "UPDATE ttrss_feeds | |
130 | SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]); | |
131 | return; | |
132 | } | |
133 | ||
134 | if ($subop == "savefeedorder") { | |
135 | if ($_POST['payload']) { | |
136 | file_put_contents("/tmp/blahblah.txt", $_POST['payload']); | |
137 | } | |
138 | ||
139 | $data = file_get_contents("/tmp/blahblah.txt"); | |
140 | $data = json_decode($data, true); | |
141 | ||
142 | if (is_array($data) && is_array($data['items'])) { | |
143 | $cat_order_id = 0; | |
144 | ||
145 | $data_map = array(); | |
146 | ||
147 | foreach ($data['items'] as $item) { | |
148 | $data_map[$item['id']] =& $item['items']; | |
149 | } | |
150 | ||
151 | foreach ($data['items'][0]['items'] as $item) { | |
152 | $id = $item['_reference']; | |
153 | $bare_id = substr($id, strpos($id, ':')+1); | |
154 | ||
155 | ++$cat_order_id; | |
156 | ||
157 | if ($bare_id > 0) { | |
158 | db_query($link, "UPDATE ttrss_feed_categories | |
159 | SET order_id = '$cat_order_id' WHERE id = '$bare_id' AND | |
160 | owner_uid = " . $_SESSION["uid"]); | |
161 | } | |
162 | ||
163 | $feed_order_id = 0; | |
164 | ||
165 | if (is_array($data_map[$id])) { | |
166 | foreach ($data_map[$id] as $feed) { | |
167 | $id = $feed['_reference']; | |
168 | $bare_id = substr($id, strpos($id, ':')+1); | |
169 | ||
170 | db_query($link, "UPDATE ttrss_feeds | |
171 | SET order_id = '$feed_order_id' WHERE id = '$bare_id' AND | |
172 | owner_uid = " . $_SESSION["uid"]); | |
173 | ||
174 | ++$feed_order_id; | |
175 | } | |
176 | } | |
177 | } | |
178 | } | |
179 | ||
180 | return; | |
181 | } | |
182 | ||
7abf159d AD |
183 | if ($subop == "removeicon") { |
184 | $feed_id = db_escape_string($_REQUEST["feed_id"]); | |
185 | ||
186 | $result = db_query($link, "SELECT id FROM ttrss_feeds | |
187 | WHERE id = '$feed_id' AND owner_uid = ". $_SESSION["uid"]); | |
188 | ||
189 | if (db_num_rows($result) != 0) { | |
190 | unlink(ICONS_DIR . "/$feed_id.ico"); | |
191 | } | |
192 | ||
193 | return; | |
194 | } | |
195 | ||
c3b7b797 | 196 | if ($subop == "uploadicon") { |
7abf159d AD |
197 | $icon_file = $_FILES['icon_file']['tmp_name']; |
198 | $feed_id = db_escape_string($_REQUEST["feed_id"]); | |
199 | ||
200 | if (is_file($icon_file) && $feed_id) { | |
e258bceb | 201 | if (filesize($icon_file) < 20000) { |
7abf159d AD |
202 | |
203 | $result = db_query($link, "SELECT id FROM ttrss_feeds | |
204 | WHERE id = '$feed_id' AND owner_uid = ". $_SESSION["uid"]); | |
205 | ||
206 | if (db_num_rows($result) != 0) { | |
207 | unlink(ICONS_DIR . "/$feed_id.ico"); | |
208 | move_uploaded_file($icon_file, ICONS_DIR . "/$feed_id.ico"); | |
209 | $rc = 0; | |
210 | } else { | |
211 | $rc = 2; | |
212 | } | |
213 | } else { | |
214 | $rc = 1; | |
215 | } | |
216 | } else { | |
217 | $rc = 2; | |
218 | } | |
219 | ||
c3b7b797 | 220 | print "<script type=\"text/javascript\">"; |
7abf159d | 221 | print "parent.uploadIconHandler($rc);"; |
c3b7b797 AD |
222 | print "</script>"; |
223 | return; | |
224 | } | |
225 | ||
951906dc AD |
226 | if ($subop == "editfeed") { |
227 | header("Content-Type: text/xml"); | |
ef8be8ea | 228 | |
951906dc AD |
229 | print "<dlg id=\"$subop\">"; |
230 | print "<title>".__('Feed Editor')."</title>"; | |
231 | print "<content><![CDATA["; | |
ef8be8ea | 232 | |
ef8be8ea AD |
233 | $feed_id = db_escape_string($_REQUEST["id"]); |
234 | ||
235 | $result = db_query($link, | |
236 | "SELECT * FROM ttrss_feeds WHERE id = '$feed_id' AND | |
237 | owner_uid = " . $_SESSION["uid"]); | |
238 | ||
47439031 AD |
239 | $title = htmlspecialchars(db_fetch_result($result, |
240 | 0, "title")); | |
ef8be8ea AD |
241 | |
242 | $icon_file = ICONS_DIR . "/$feed_id.ico"; | |
243 | ||
244 | if (file_exists($icon_file) && filesize($icon_file) > 0) { | |
245 | $feed_icon = "<img width=\"16\" height=\"16\" | |
246 | src=\"" . ICONS_URL . "/$feed_id.ico\">"; | |
247 | } else { | |
248 | $feed_icon = ""; | |
249 | } | |
250 | ||
e6312f6c | 251 | print "<form id=\"edit_feed_form\" onsubmit=\"return false\">"; |
ef8be8ea AD |
252 | |
253 | print "<input type=\"hidden\" name=\"id\" value=\"$feed_id\">"; | |
254 | print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">"; | |
255 | print "<input type=\"hidden\" name=\"subop\" value=\"editSave\">"; | |
256 | ||
ecace165 AD |
257 | print "<div class=\"dlgSec\">".__("Feed")."</div>"; |
258 | print "<div class=\"dlgSecCont\">"; | |
ef8be8ea | 259 | |
ecace165 AD |
260 | /* Title */ |
261 | ||
262 | print "<input style=\"font-size : 16px\" size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\" | |
263 | name=\"title\" value=\"$title\">"; | |
264 | ||
265 | /* Feed URL */ | |
ef8be8ea AD |
266 | |
267 | $feed_url = db_fetch_result($result, 0, "feed_url"); | |
47439031 AD |
268 | $feed_url = htmlspecialchars(db_fetch_result($result, |
269 | 0, "feed_url")); | |
ecace165 AD |
270 | |
271 | print "<br/>"; | |
272 | ||
273 | print __('URL:') . " "; | |
274 | print "<input size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\" | |
275 | name=\"feed_url\" value=\"$feed_url\">"; | |
276 | ||
277 | /* Category */ | |
ef8be8ea AD |
278 | |
279 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
280 | ||
281 | $cat_id = db_fetch_result($result, 0, "cat_id"); | |
282 | ||
ecace165 AD |
283 | print "<br/>"; |
284 | ||
285 | print __('Place in category:') . " "; | |
ef8be8ea | 286 | |
ecace165 | 287 | print_feed_cat_select($link, "cat_id", $cat_id, $disabled); |
ef8be8ea AD |
288 | } |
289 | ||
ecace165 | 290 | print "</div>"; |
ef8be8ea | 291 | |
e6bf0f4b | 292 | print "<div class=\"dlgSec\">".__("Update")."</div>"; |
ecace165 | 293 | print "<div class=\"dlgSecCont\">"; |
ef8be8ea | 294 | |
ecace165 | 295 | /* Update Interval */ |
ef8be8ea | 296 | |
ecace165 AD |
297 | $update_interval = db_fetch_result($result, 0, "update_interval"); |
298 | ||
299 | print_select_hash("update_interval", $update_interval, $update_intervals); | |
16211ddb | 300 | |
ecace165 AD |
301 | /* Update method */ |
302 | ||
34f29d78 | 303 | $update_method = db_fetch_result($result, 0, "update_method"); |
ecace165 | 304 | |
34f29d78 AD |
305 | print " " . __('using') . " "; |
306 | print_select_hash("update_method", $update_method, $update_methods); | |
16211ddb | 307 | |
22c1bc60 AD |
308 | $purge_interval = db_fetch_result($result, 0, "purge_interval"); |
309 | ||
3907ef71 | 310 | if (FORCE_ARTICLE_PURGE == 0) { |
ecace165 | 311 | |
3907ef71 AD |
312 | /* Purge intl */ |
313 | ||
314 | print "<br/>"; | |
315 | ||
3907ef71 | 316 | print __('Article purging:') . " "; |
ecace165 | 317 | |
3907ef71 | 318 | print_select_hash("purge_interval", $purge_interval, $purge_intervals); |
ecace165 | 319 | |
22c1bc60 AD |
320 | } else { |
321 | print "<input type='hidden' name='purge_interval' value='$purge_interval'>"; | |
322 | ||
3907ef71 | 323 | } |
ecace165 AD |
324 | |
325 | print "</div>"; | |
326 | print "<div class=\"dlgSec\">".__("Authentication")."</div>"; | |
327 | print "<div class=\"dlgSecCont\">"; | |
328 | ||
47439031 | 329 | $auth_login = htmlspecialchars(db_fetch_result($result, 0, "auth_login")); |
ef8be8ea | 330 | |
d616904c AD |
331 | print "<table>"; |
332 | ||
333 | print "<tr><td>" . __('Login:') . "</td><td>"; | |
334 | ||
ecace165 AD |
335 | print "<input size=\"20\" onkeypress=\"return filterCR(event, feedEditSave)\" |
336 | name=\"auth_login\" value=\"$auth_login\">"; | |
337 | ||
d616904c | 338 | print "</tr><tr><td>" . __("Password:") . "</td><td>"; |
ef8be8ea | 339 | |
47439031 | 340 | $auth_pass = htmlspecialchars(db_fetch_result($result, 0, "auth_pass")); |
ef8be8ea | 341 | |
ecace165 | 342 | print "<input size=\"20\" type=\"password\" name=\"auth_pass\" |
ef8be8ea | 343 | onkeypress=\"return filterCR(event, feedEditSave)\" |
ecace165 | 344 | value=\"$auth_pass\">"; |
ef8be8ea | 345 | |
d616904c AD |
346 | print "</td></tr></table>"; |
347 | ||
ecace165 AD |
348 | print "</div>"; |
349 | print "<div class=\"dlgSec\">".__("Options")."</div>"; | |
350 | print "<div class=\"dlgSecCont\">"; | |
ef8be8ea | 351 | |
ecace165 | 352 | print "<div style=\"line-height : 100%\">"; |
ef8be8ea | 353 | |
886d4bce AD |
354 | $private = sql_bool_to_bool(db_fetch_result($result, 0, "private")); |
355 | ||
356 | if ($private) { | |
357 | $checked = "checked"; | |
358 | } else { | |
359 | $checked = ""; | |
360 | } | |
361 | ||
ecace165 | 362 | print "<input type=\"checkbox\" name=\"private\" id=\"private\" |
117335bf | 363 | $checked> <label for=\"private\">".__('Hide from Popular feeds')."</label>"; |
ef8be8ea AD |
364 | |
365 | $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content")); | |
366 | ||
367 | if ($rtl_content) { | |
368 | $checked = "checked"; | |
369 | } else { | |
370 | $checked = ""; | |
371 | } | |
372 | ||
ecace165 AD |
373 | print "<br/><input type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\" |
374 | $checked> <label for=\"rtl_content\">".__('Right-to-left content')."</label>"; | |
ef8be8ea | 375 | |
ef8be8ea AD |
376 | $include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest")); |
377 | ||
378 | if ($include_in_digest) { | |
379 | $checked = "checked"; | |
380 | } else { | |
381 | $checked = ""; | |
382 | } | |
383 | ||
ecace165 | 384 | print "<br/><input type=\"checkbox\" id=\"include_in_digest\" |
ef8be8ea | 385 | name=\"include_in_digest\" |
ecace165 | 386 | $checked> <label for=\"include_in_digest\">".__('Include in e-mail digest')."</label>"; |
ef8be8ea | 387 | |
54e61a68 AD |
388 | |
389 | $always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures")); | |
390 | ||
391 | if ($always_display_enclosures) { | |
392 | $checked = "checked"; | |
393 | } else { | |
394 | $checked = ""; | |
395 | } | |
396 | ||
397 | print "<br/><input type=\"checkbox\" id=\"always_display_enclosures\" | |
398 | name=\"always_display_enclosures\" | |
399 | $checked> <label for=\"always_display_enclosures\">".__('Always display image attachments')."</label>"; | |
400 | ||
401 | ||
bc0f0785 AD |
402 | $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images")); |
403 | ||
404 | if ($cache_images) { | |
405 | $checked = "checked"; | |
406 | } else { | |
407 | $checked = ""; | |
408 | } | |
409 | ||
78a5c296 | 410 | if (SIMPLEPIE_CACHE_IMAGES) { |
bc0f0785 AD |
411 | $disabled = ""; |
412 | $label_class = ""; | |
413 | } else { | |
414 | $disabled = "disabled"; | |
415 | $label_class = "class='insensitive'"; | |
416 | } | |
417 | ||
ecace165 | 418 | print "<br/><input type=\"checkbox\" id=\"cache_images\" |
bc0f0785 | 419 | name=\"cache_images\" $disabled |
ecace165 | 420 | $checked> <label $label_class for=\"cache_images\">". |
bc0f0785 AD |
421 | __('Cache images locally')."</label>"; |
422 | ||
ef8be8ea | 423 | |
ecace165 AD |
424 | print "</div>"; |
425 | print "</div>"; | |
ef8be8ea AD |
426 | |
427 | print "</form>"; | |
428 | ||
c3b7b797 AD |
429 | /* Icon */ |
430 | ||
431 | print "<br/>"; | |
432 | ||
7abf159d | 433 | print "<div class=\"dlgSec\">".__("Icon")."</div>"; |
c3b7b797 AD |
434 | print "<div class=\"dlgSecCont\">"; |
435 | ||
436 | print "<iframe name=\"icon_upload_iframe\" | |
437 | style=\"width: 400px; height: 100px; display: none;\"></iframe>"; | |
438 | ||
439 | print "<form style='display : block' target=\"icon_upload_iframe\" | |
440 | enctype=\"multipart/form-data\" method=\"POST\" | |
441 | action=\"backend.php\"> | |
7abf159d | 442 | <input id=\"icon_file\" size=\"10\" name=\"icon_file\" type=\"file\"> |
c3b7b797 | 443 | <input type=\"hidden\" name=\"op\" value=\"pref-feeds\"> |
7abf159d | 444 | <input type=\"hidden\" name=\"feed_id\" value=\"$feed_id\"> |
c3b7b797 AD |
445 | <input type=\"hidden\" name=\"subop\" value=\"uploadicon\"> |
446 | <button onclick=\"return uploadFeedIcon();\" | |
447 | type=\"submit\">".__('Replace')."</button> | |
7abf159d AD |
448 | <button onclick=\"return removeFeedIcon($feed_id);\" |
449 | type=\"submit\">".__('Remove')."</button> | |
c3b7b797 AD |
450 | </form>"; |
451 | ||
7abf159d | 452 | print "</div>"; |
c3b7b797 | 453 | |
ddb61e79 AD |
454 | $title = htmlspecialchars($title, ENT_QUOTES); |
455 | ||
ecace165 | 456 | print "<div class='dlgButtons'> |
143a4973 | 457 | <div style=\"float : left\"> |
ad491d75 AD |
458 | <button onclick='return unsubscribeFeed($feed_id, \"$title\")'>". |
459 | __('Unsubscribe')."</button> | |
143a4973 | 460 | </div> |
ad491d75 AD |
461 | <button onclick=\"return feedEditSave()\">".__('Save')."</button> |
462 | <button onclick=\"return feedEditCancel()\">".__('Cancel')."</button> | |
c8d5dcfe | 463 | </div>"; |
ef8be8ea | 464 | |
951906dc AD |
465 | print "]]></content></dlg>"; |
466 | ||
ef8be8ea AD |
467 | return; |
468 | } | |
469 | ||
758e1c4a AD |
470 | if ($subop == "editfeeds") { |
471 | ||
472 | $feed_ids = db_escape_string($_REQUEST["ids"]); | |
951906dc AD |
473 | |
474 | header("Content-Type: text/xml"); | |
475 | print "<dlg id=\"$subop\">"; | |
476 | print "<title>".__('Multiple Feed Editor')."</title>"; | |
477 | print "<content><![CDATA["; | |
758e1c4a | 478 | |
758e1c4a AD |
479 | print "<form id=\"batch_edit_feed_form\" onsubmit=\"return false\">"; |
480 | ||
481 | print "<input type=\"hidden\" name=\"ids\" value=\"$feed_ids\">"; | |
482 | print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">"; | |
483 | print "<input type=\"hidden\" name=\"subop\" value=\"batchEditSave\">"; | |
484 | ||
485 | print "<div class=\"dlgSec\">".__("Feed")."</div>"; | |
486 | print "<div class=\"dlgSecCont\">"; | |
487 | ||
488 | /* Title */ | |
489 | ||
490 | print "<input disabled style=\"font-size : 16px\" size=\"35\" onkeypress=\"return filterCR(event, feedEditSave)\" | |
491 | name=\"title\" value=\"$title\">"; | |
492 | ||
493 | batch_edit_cbox("title"); | |
494 | ||
495 | /* Feed URL */ | |
496 | ||
497 | print "<br/>"; | |
498 | ||
499 | print __('URL:') . " "; | |
500 | print "<input disabled size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\" | |
501 | name=\"feed_url\" value=\"$feed_url\">"; | |
502 | ||
503 | batch_edit_cbox("feed_url"); | |
504 | ||
505 | /* Category */ | |
506 | ||
507 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
508 | ||
509 | print "<br/>"; | |
510 | ||
511 | print __('Place in category:') . " "; | |
512 | ||
513 | print_feed_cat_select($link, "cat_id", $cat_id, "disabled"); | |
514 | ||
515 | batch_edit_cbox("cat_id"); | |
516 | ||
517 | } | |
518 | ||
519 | print "</div>"; | |
520 | ||
521 | print "<div class=\"dlgSec\">".__("Update")."</div>"; | |
522 | print "<div class=\"dlgSecCont\">"; | |
523 | ||
524 | /* Update Interval */ | |
525 | ||
526 | print_select_hash("update_interval", $update_interval, $update_intervals, | |
527 | "disabled"); | |
528 | ||
529 | batch_edit_cbox("update_interval"); | |
530 | ||
531 | /* Update method */ | |
532 | ||
34f29d78 AD |
533 | print " " . __('using') . " "; |
534 | print_select_hash("update_method", $update_method, $update_methods, | |
535 | "disabled"); | |
536 | batch_edit_cbox("update_method"); | |
758e1c4a AD |
537 | |
538 | /* Purge intl */ | |
539 | ||
3907ef71 | 540 | if (FORCE_ARTICLE_PURGE != 0) { |
758e1c4a | 541 | |
3907ef71 | 542 | print "<br/>"; |
758e1c4a | 543 | |
3907ef71 | 544 | print __('Article purging:') . " "; |
758e1c4a | 545 | |
3907ef71 AD |
546 | print_select_hash("purge_interval", $purge_interval, $purge_intervals, |
547 | "disabled"); | |
548 | ||
549 | batch_edit_cbox("purge_interval"); | |
550 | } | |
758e1c4a AD |
551 | |
552 | print "</div>"; | |
553 | print "<div class=\"dlgSec\">".__("Authentication")."</div>"; | |
554 | print "<div class=\"dlgSecCont\">"; | |
555 | ||
556 | print __('Login:') . " "; | |
557 | print "<input disabled size=\"15\" onkeypress=\"return filterCR(event, feedEditSave)\" | |
558 | name=\"auth_login\" value=\"$auth_login\">"; | |
559 | ||
560 | batch_edit_cbox("auth_login"); | |
561 | ||
562 | print " " . __("Password:") . " "; | |
563 | ||
564 | print "<input disabled size=\"15\" type=\"password\" name=\"auth_pass\" | |
565 | onkeypress=\"return filterCR(event, feedEditSave)\" | |
566 | value=\"$auth_pass\">"; | |
567 | ||
568 | batch_edit_cbox("auth_pass"); | |
569 | ||
570 | print "</div>"; | |
571 | print "<div class=\"dlgSec\">".__("Options")."</div>"; | |
572 | print "<div class=\"dlgSecCont\">"; | |
573 | ||
574 | print "<div style=\"line-height : 100%\">"; | |
575 | ||
576 | print "<input disabled type=\"checkbox\" name=\"private\" id=\"private\" | |
43f0968e | 577 | $checked> <label id=\"private_l\" class='insensitive' for=\"private\">".__('Hide from Popular feeds')."</label>"; |
758e1c4a AD |
578 | |
579 | print " "; batch_edit_cbox("private", "private_l"); | |
580 | ||
581 | print "<br/><input disabled type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\" | |
582 | $checked> <label class='insensitive' id=\"rtl_content_l\" for=\"rtl_content\">".__('Right-to-left content')."</label>"; | |
583 | ||
584 | print " "; batch_edit_cbox("rtl_content", "rtl_content_l"); | |
585 | ||
758e1c4a AD |
586 | print "<br/><input disabled type=\"checkbox\" id=\"include_in_digest\" |
587 | name=\"include_in_digest\" | |
588 | $checked> <label id=\"include_in_digest_l\" class='insensitive' for=\"include_in_digest\">".__('Include in e-mail digest')."</label>"; | |
589 | ||
590 | print " "; batch_edit_cbox("include_in_digest", "include_in_digest_l"); | |
591 | ||
c9f185bd AD |
592 | print "<br/><input disabled type=\"checkbox\" id=\"always_display_enclosures\" |
593 | name=\"always_display_enclosures\" | |
594 | $checked> <label id=\"always_display_enclosures_l\" class='insensitive' for=\"always_display_enclosures\">".__('Always display image attachments')."</label>"; | |
595 | ||
596 | print " "; batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l"); | |
597 | ||
758e1c4a AD |
598 | print "<br/><input disabled type=\"checkbox\" id=\"cache_images\" |
599 | name=\"cache_images\" | |
600 | $checked> <label class='insensitive' id=\"cache_images_l\" | |
601 | for=\"cache_images\">". | |
602 | __('Cache images locally')."</label>"; | |
603 | ||
604 | ||
78a5c296 | 605 | if (SIMPLEPIE_CACHE_IMAGES) { |
758e1c4a AD |
606 | print " "; batch_edit_cbox("cache_images", "cache_images_l"); |
607 | } | |
608 | ||
609 | print "</div>"; | |
610 | print "</div>"; | |
611 | ||
612 | print "</form>"; | |
613 | ||
614 | print "<div class='dlgButtons'> | |
615 | <input type=\"submit\" class=\"button\" | |
616 | onclick=\"return feedsEditSave()\" value=\"".__('Save')."\"> | |
617 | <input type='submit' class='button' | |
618 | onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\"> | |
619 | </div>"; | |
620 | ||
951906dc AD |
621 | print "]]></content></dlg>"; |
622 | ||
758e1c4a AD |
623 | return; |
624 | } | |
625 | ||
b0f015a2 | 626 | if ($subop == "editSave" || $subop == "batchEditSave") { |
ef8be8ea AD |
627 | |
628 | $feed_title = db_escape_string(trim($_POST["title"])); | |
629 | $feed_link = db_escape_string(trim($_POST["feed_url"])); | |
630 | $upd_intl = db_escape_string($_POST["update_interval"]); | |
631 | $purge_intl = db_escape_string($_POST["purge_interval"]); | |
b0f015a2 AD |
632 | $feed_id = db_escape_string($_POST["id"]); /* editSave */ |
633 | $feed_ids = db_escape_string($_POST["ids"]); /* batchEditSave */ | |
ef8be8ea AD |
634 | $cat_id = db_escape_string($_POST["cat_id"]); |
635 | $auth_login = db_escape_string(trim($_POST["auth_login"])); | |
636 | $auth_pass = db_escape_string(trim($_POST["auth_pass"])); | |
ef8be8ea AD |
637 | $private = checkbox_to_sql_bool(db_escape_string($_POST["private"])); |
638 | $rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"])); | |
ef8be8ea AD |
639 | $include_in_digest = checkbox_to_sql_bool( |
640 | db_escape_string($_POST["include_in_digest"])); | |
bc0f0785 AD |
641 | $cache_images = checkbox_to_sql_bool( |
642 | db_escape_string($_POST["cache_images"])); | |
16211ddb | 643 | $update_method = (int) db_escape_string($_POST["update_method"]); |
ef8be8ea | 644 | |
54e61a68 AD |
645 | $always_display_enclosures = checkbox_to_sql_bool( |
646 | db_escape_string($_POST["always_display_enclosures"])); | |
647 | ||
ef8be8ea AD |
648 | if (get_pref($link, 'ENABLE_FEED_CATS')) { |
649 | if ($cat_id && $cat_id != 0) { | |
650 | $category_qpart = "cat_id = '$cat_id',"; | |
651 | $category_qpart_nocomma = "cat_id = '$cat_id'"; | |
652 | } else { | |
653 | $category_qpart = 'cat_id = NULL,'; | |
654 | $category_qpart_nocomma = 'cat_id = NULL'; | |
655 | } | |
656 | } else { | |
657 | $category_qpart = ""; | |
658 | $category_qpart_nocomma = ""; | |
659 | } | |
660 | ||
78a5c296 | 661 | if (SIMPLEPIE_CACHE_IMAGES) { |
bc0f0785 AD |
662 | $cache_images_qpart = "cache_images = $cache_images,"; |
663 | } else { | |
664 | $cache_images_qpart = ""; | |
665 | } | |
666 | ||
b0f015a2 AD |
667 | if ($subop == "editSave") { |
668 | ||
669 | $result = db_query($link, "UPDATE ttrss_feeds SET | |
6e63a7c3 | 670 | $category_qpart |
b0f015a2 AD |
671 | title = '$feed_title', feed_url = '$feed_link', |
672 | update_interval = '$upd_intl', | |
673 | purge_interval = '$purge_intl', | |
674 | auth_login = '$auth_login', | |
675 | auth_pass = '$auth_pass', | |
676 | private = $private, | |
677 | rtl_content = $rtl_content, | |
b0f015a2 AD |
678 | $cache_images_qpart |
679 | include_in_digest = $include_in_digest, | |
54e61a68 | 680 | always_display_enclosures = $always_display_enclosures, |
b0f015a2 | 681 | update_method = '$update_method' |
5ffd798d | 682 | WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]); |
b0f015a2 | 683 | |
b0f015a2 AD |
684 | } else if ($subop == "batchEditSave") { |
685 | $feed_data = array(); | |
ef8be8ea | 686 | |
b0f015a2 AD |
687 | foreach (array_keys($_POST) as $k) { |
688 | if ($k != "op" && $k != "subop" && $k != "ids") { | |
689 | $feed_data[$k] = $_POST[$k]; | |
690 | } | |
691 | } | |
692 | ||
693 | db_query($link, "BEGIN"); | |
694 | ||
695 | foreach (array_keys($feed_data) as $k) { | |
696 | ||
697 | $qpart = ""; | |
698 | ||
699 | switch ($k) { | |
700 | case "title": | |
701 | $qpart = "title = '$feed_title'"; | |
702 | break; | |
703 | ||
704 | case "feed_url": | |
705 | $qpart = "feed_url = '$feed_link'"; | |
706 | break; | |
707 | ||
708 | case "update_interval": | |
709 | $qpart = "update_interval = '$upd_intl'"; | |
710 | break; | |
711 | ||
712 | case "purge_interval": | |
713 | $qpart = "purge_interval = '$purge_intl'"; | |
714 | break; | |
715 | ||
716 | case "auth_login": | |
717 | $qpart = "auth_login = '$auth_login'"; | |
718 | break; | |
719 | ||
720 | case "auth_pass": | |
721 | $qpart = "auth_pass = '$auth_pass'"; | |
722 | break; | |
723 | ||
724 | case "private": | |
725 | $qpart = "private = '$private'"; | |
726 | break; | |
727 | ||
b0f015a2 AD |
728 | case "include_in_digest": |
729 | $qpart = "include_in_digest = '$include_in_digest'"; | |
730 | break; | |
731 | ||
c9f185bd AD |
732 | case "always_display_enclosures": |
733 | $qpart = "always_display_enclosures = '$always_display_enclosures'"; | |
734 | break; | |
735 | ||
5d538f4f AD |
736 | case "cache_images": |
737 | $qpart = "cache_images = '$cache_images'"; | |
738 | break; | |
739 | ||
740 | case "rtl_content": | |
741 | $qpart = "rtl_content = '$rtl_content'"; | |
742 | break; | |
743 | ||
b0f015a2 AD |
744 | case "update_method": |
745 | $qpart = "update_method = '$update_method'"; | |
746 | break; | |
747 | ||
748 | case "cat_id": | |
749 | $qpart = $category_qpart_nocomma; | |
750 | break; | |
751 | ||
752 | } | |
753 | ||
754 | if ($qpart) { | |
cff7a3a2 | 755 | db_query($link, |
b0f015a2 | 756 | "UPDATE ttrss_feeds SET $qpart WHERE id IN ($feed_ids) |
cd935c42 AD |
757 | AND owner_uid = " . $_SESSION["uid"]); |
758 | print "<br/>"; | |
b0f015a2 AD |
759 | } |
760 | } | |
761 | ||
762 | db_query($link, "COMMIT"); | |
ef8be8ea | 763 | } |
b0f015a2 | 764 | |
ef8be8ea AD |
765 | } |
766 | ||
ef8be8ea AD |
767 | if ($subop == "remove") { |
768 | ||
b4e75b2a | 769 | $ids = split(",", db_escape_string($_REQUEST["ids"])); |
ef8be8ea | 770 | |
810b1561 | 771 | foreach ($ids as $id) { |
7e329f13 | 772 | remove_feed($link, $id, $_SESSION["uid"]); |
ef8be8ea | 773 | } |
b6a6e262 AD |
774 | |
775 | return; | |
ef8be8ea AD |
776 | } |
777 | ||
d1f0c584 | 778 | if ($subop == "clear") { |
b4e75b2a | 779 | $id = db_escape_string($_REQUEST["id"]); |
d1f0c584 AD |
780 | clear_feed_articles($link, $id); |
781 | } | |
782 | ||
fee840fb | 783 | if ($subop == "rescore") { |
b4e75b2a | 784 | $ids = split(",", db_escape_string($_REQUEST["ids"])); |
fee840fb AD |
785 | |
786 | foreach ($ids as $id) { | |
787 | ||
788 | $filters = load_filters($link, $id, $_SESSION["uid"], 6); | |
789 | ||
38edb151 AD |
790 | $result = db_query($link, "SELECT |
791 | title, content, link, ref_id, author,". | |
792 | SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated | |
793 | FROM | |
fee840fb AD |
794 | ttrss_user_entries, ttrss_entries |
795 | WHERE ref_id = id AND feed_id = '$id' AND | |
796 | owner_uid = " .$_SESSION['uid']." | |
ef1b0366 | 797 | "); |
fee840fb AD |
798 | |
799 | $scores = array(); | |
800 | ||
801 | while ($line = db_fetch_assoc($result)) { | |
802 | ||
38edb151 AD |
803 | $tags = get_article_tags($link, $line["ref_id"]); |
804 | ||
fee840fb | 805 | $article_filters = get_article_filters($filters, $line['title'], |
38edb151 AD |
806 | $line['content'], $line['link'], strtotime($line['updated']), |
807 | $line['author'], $tags); | |
fee840fb AD |
808 | |
809 | $new_score = calculate_article_score($article_filters); | |
810 | ||
811 | if (!$scores[$new_score]) $scores[$new_score] = array(); | |
812 | ||
813 | array_push($scores[$new_score], $line['ref_id']); | |
814 | } | |
815 | ||
816 | foreach (array_keys($scores) as $s) { | |
817 | if ($s > 1000) { | |
818 | db_query($link, "UPDATE ttrss_user_entries SET score = '$s', | |
819 | marked = true WHERE | |
95a948a5 | 820 | ref_id IN (" . join(',', $scores[$s]) . ")"); |
1618a849 AD |
821 | } else if ($s < -500) { |
822 | db_query($link, "UPDATE ttrss_user_entries SET score = '$s', | |
823 | unread = false WHERE | |
824 | ref_id IN (" . join(',', $scores[$s]) . ")"); | |
95a948a5 AD |
825 | } else { |
826 | db_query($link, "UPDATE ttrss_user_entries SET score = '$s' WHERE | |
827 | ref_id IN (" . join(',', $scores[$s]) . ")"); | |
828 | } | |
829 | } | |
830 | } | |
831 | ||
832 | print __("All done."); | |
833 | ||
834 | } | |
835 | ||
836 | if ($subop == "rescoreAll") { | |
837 | ||
838 | $result = db_query($link, | |
839 | "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']); | |
840 | ||
841 | while ($feed_line = db_fetch_assoc($result)) { | |
842 | ||
843 | $id = $feed_line["id"]; | |
844 | ||
845 | $filters = load_filters($link, $id, $_SESSION["uid"], 6); | |
846 | ||
38edb151 AD |
847 | $tmp_result = db_query($link, "SELECT |
848 | title, content, link, ref_id, author,". | |
849 | SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated | |
850 | FROM | |
95a948a5 AD |
851 | ttrss_user_entries, ttrss_entries |
852 | WHERE ref_id = id AND feed_id = '$id' AND | |
853 | owner_uid = " .$_SESSION['uid']." | |
854 | "); | |
855 | ||
856 | $scores = array(); | |
857 | ||
858 | while ($line = db_fetch_assoc($tmp_result)) { | |
859 | ||
38edb151 AD |
860 | $tags = get_article_tags($link, $line["ref_id"]); |
861 | ||
95a948a5 | 862 | $article_filters = get_article_filters($filters, $line['title'], |
38edb151 AD |
863 | $line['content'], $line['link'], strtotime($line['updated']), |
864 | $line['author'], $tags); | |
865 | ||
95a948a5 AD |
866 | $new_score = calculate_article_score($article_filters); |
867 | ||
868 | if (!$scores[$new_score]) $scores[$new_score] = array(); | |
869 | ||
870 | array_push($scores[$new_score], $line['ref_id']); | |
871 | } | |
872 | ||
873 | foreach (array_keys($scores) as $s) { | |
874 | if ($s > 1000) { | |
875 | db_query($link, "UPDATE ttrss_user_entries SET score = '$s', | |
876 | marked = true WHERE | |
fee840fb AD |
877 | ref_id IN (" . join(',', $scores[$s]) . ")"); |
878 | } else { | |
879 | db_query($link, "UPDATE ttrss_user_entries SET score = '$s' WHERE | |
880 | ref_id IN (" . join(',', $scores[$s]) . ")"); | |
881 | } | |
882 | } | |
883 | } | |
884 | ||
885 | print __("All done."); | |
886 | ||
887 | } | |
888 | ||
ef8be8ea | 889 | if ($subop == "add") { |
ef8be8ea | 890 | |
a5819bb3 AD |
891 | $feed_url = db_escape_string(trim($_REQUEST["feed_url"])); |
892 | $cat_id = db_escape_string($_REQUEST["cat_id"]); | |
893 | $p_from = db_escape_string($_REQUEST["from"]); | |
ef8be8ea | 894 | |
a5819bb3 | 895 | /* only read authentication information from POST */ |
aa2122d4 | 896 | |
a5819bb3 AD |
897 | $auth_login = db_escape_string(trim($_POST["auth_login"])); |
898 | $auth_pass = db_escape_string(trim($_POST["auth_pass"])); | |
aa2122d4 | 899 | |
a5819bb3 AD |
900 | if ($p_from != 'tt-rss') { |
901 | print "<html> | |
902 | <head> | |
903 | <title>Tiny Tiny RSS</title> | |
904 | <link rel=\"stylesheet\" type=\"text/css\" href=\"utility.css\"> | |
905 | </head> | |
906 | <body> | |
907 | <img class=\"floatingLogo\" src=\"images/ttrss_logo.png\" | |
908 | alt=\"Tiny Tiny RSS\"/> | |
909 | <h1>Subscribe to feed...</h1>"; | |
910 | } | |
d70c5ae4 | 911 | |
a5819bb3 AD |
912 | $rc = subscribe_to_feed($link, $feed_url, $cat_id, $auth_login, $auth_pass); |
913 | ||
914 | switch ($rc) { | |
915 | case 1: | |
916 | print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url)); | |
917 | break; | |
918 | case 2: | |
919 | print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url)); | |
920 | break; | |
921 | case 0: | |
922 | print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url)); | |
923 | break; | |
924 | } | |
e513a74a | 925 | |
a5819bb3 AD |
926 | if ($p_from != 'tt-rss') { |
927 | $tt_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\.php.*$/', 'tt-rss.php', $_SERVER["REQUEST_URI"]); | |
e513a74a | 928 | |
e513a74a | 929 | |
a5819bb3 | 930 | $tp_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\.php.*$/', 'prefs.php', $_SERVER["REQUEST_URI"]); |
6906f145 | 931 | |
a5819bb3 AD |
932 | $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE |
933 | feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]); | |
e513a74a | 934 | |
a5819bb3 | 935 | $feed_id = db_fetch_result($result, 0, "id"); |
aa2122d4 | 936 | |
a5819bb3 AD |
937 | print "<p>"; |
938 | ||
939 | if ($feed_id) { | |
940 | print "<form method=\"GET\" style='display: inline' | |
941 | action=\"$tp_uri\"> | |
942 | <input type=\"hidden\" name=\"tab\" value=\"feedConfig\"> | |
943 | <input type=\"hidden\" name=\"subop\" value=\"editFeed\"> | |
944 | <input type=\"hidden\" name=\"subopparam\" value=\"$feed_id\"> | |
945 | <input type=\"submit\" value=\"".__("Edit subscription options")."\"> | |
946 | </form>"; | |
aa2122d4 | 947 | } |
442d77f1 | 948 | |
a5819bb3 AD |
949 | print "<form style='display: inline' method=\"GET\" action=\"$tt_uri\"> |
950 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> | |
951 | </form></p>"; | |
952 | ||
953 | print "</body></html>"; | |
954 | return; | |
ef8be8ea AD |
955 | } |
956 | } | |
957 | ||
ef8be8ea AD |
958 | if ($subop == "categorize") { |
959 | ||
ef8be8ea | 960 | |
913f374b | 961 | $ids = split(",", db_escape_string($_REQUEST["ids"])); |
ef8be8ea | 962 | |
913f374b | 963 | $cat_id = db_escape_string($_REQUEST["cat_id"]); |
ef8be8ea | 964 | |
913f374b AD |
965 | if ($cat_id == 0) { |
966 | $cat_id_qpart = 'NULL'; | |
967 | } else { | |
968 | $cat_id_qpart = "'$cat_id'"; | |
969 | } | |
ef8be8ea | 970 | |
913f374b | 971 | db_query($link, "BEGIN"); |
ef8be8ea | 972 | |
913f374b AD |
973 | foreach ($ids as $id) { |
974 | ||
975 | db_query($link, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart | |
6e63a7c3 | 976 | WHERE id = '$id' |
913f374b | 977 | AND owner_uid = " . $_SESSION["uid"]); |
ef8be8ea | 978 | |
ef8be8ea AD |
979 | } |
980 | ||
913f374b AD |
981 | db_query($link, "COMMIT"); |
982 | ||
ef8be8ea AD |
983 | } |
984 | ||
9c483746 AD |
985 | if ($subop == "editCats") { |
986 | ||
9c483746 AD |
987 | $action = $_REQUEST["action"]; |
988 | ||
989 | if ($action == "save") { | |
990 | ||
11f083e7 | 991 | $cat_title = db_escape_string(trim($_REQUEST["value"])); |
b4e75b2a | 992 | $cat_id = db_escape_string($_REQUEST["cid"]); |
11f083e7 | 993 | |
8f708155 AD |
994 | db_query($link, "BEGIN"); |
995 | ||
996 | $result = db_query($link, "SELECT title FROM ttrss_feed_categories | |
997 | WHERE id = '$cat_id' AND owner_uid = ".$_SESSION["uid"]); | |
998 | ||
999 | if (db_num_rows($result) == 1) { | |
1000 | ||
1001 | $old_title = db_fetch_result($result, 0, "title"); | |
1002 | ||
1003 | if ($cat_title != "") { | |
1004 | $result = db_query($link, "UPDATE ttrss_feed_categories SET | |
1005 | title = '$cat_title' WHERE id = '$cat_id' AND | |
1006 | owner_uid = ".$_SESSION["uid"]); | |
1007 | ||
1008 | print $cat_title; | |
1009 | } else { | |
1010 | print $old_title; | |
1011 | } | |
1012 | } else { | |
1013 | print $_REQUEST["value"]; | |
1014 | } | |
1015 | ||
1016 | db_query($link, "COMMIT"); | |
11f083e7 AD |
1017 | |
1018 | return; | |
1019 | ||
9c483746 AD |
1020 | } |
1021 | ||
951906dc AD |
1022 | header("Content-Type: text/xml"); |
1023 | print "<dlg id=\"$subop\">"; | |
1024 | print "<title>".__('Category editor')."</title>"; | |
1025 | print "<content><![CDATA["; | |
11f083e7 | 1026 | |
9c483746 AD |
1027 | if ($action == "add") { |
1028 | ||
913f374b AD |
1029 | $feed_cat = db_escape_string(trim($_REQUEST["cat"])); |
1030 | ||
5c7c7da9 AD |
1031 | if (!add_feed_category($link, $feed_cat)) |
1032 | print_warning(T_sprintf("Category <b>$%s</b> already exists in the database.", $feed_cat)); | |
913f374b | 1033 | |
9c483746 AD |
1034 | } |
1035 | ||
1036 | if ($action == "remove") { | |
1037 | ||
b4e75b2a | 1038 | $ids = split(",", db_escape_string($_REQUEST["ids"])); |
9c483746 | 1039 | |
7e329f13 AD |
1040 | foreach ($ids as $id) { |
1041 | remove_feed_category($link, $id, $_SESSION["uid"]); | |
9c483746 AD |
1042 | } |
1043 | } | |
1044 | ||
d9084cf2 | 1045 | print "<div> |
9c483746 | 1046 | <input id=\"fadd_cat\" |
1043a8c3 | 1047 | onkeypress=\"return filterCR(event, addFeedCat)\" |
d60009cd | 1048 | size=\"40\"> |
a998dbef | 1049 | <button onclick=\"addFeedCat()\">". |
d60009cd | 1050 | __('Create category')."</button></div>"; |
9c483746 AD |
1051 | |
1052 | $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories | |
1053 | WHERE owner_uid = ".$_SESSION["uid"]." | |
1054 | ORDER BY title"); | |
1055 | ||
1056 | print "<p>"; | |
1057 | ||
1058 | if (db_num_rows($result) != 0) { | |
1059 | ||
d60009cd | 1060 | print __('Select:')." |
e69fb880 AD |
1061 | <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'all')\">".__('All')."</a>, |
1062 | <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'none')\">".__('None')."</a>"; | |
9c483746 AD |
1063 | |
1064 | print "<div class=\"prefFeedCatHolder\">"; | |
1065 | ||
e6312f6c | 1066 | print "<form id=\"feed_cat_edit_form\" onsubmit=\"return false\">"; |
9c483746 AD |
1067 | |
1068 | print "<table width=\"100%\" class=\"prefFeedCatList\" | |
1069 | cellspacing=\"0\" id=\"prefFeedCatList\">"; | |
9c483746 AD |
1070 | |
1071 | $lnum = 0; | |
1072 | ||
1073 | while ($line = db_fetch_assoc($result)) { | |
1074 | ||
1075 | $class = ($lnum % 2) ? "even" : "odd"; | |
1076 | ||
1077 | $cat_id = $line["id"]; | |
11f083e7 | 1078 | $this_row_id = "id=\"FCATR-$cat_id\""; |
9c483746 AD |
1079 | |
1080 | print "<tr class=\"$class\" $this_row_id>"; | |
1081 | ||
47439031 | 1082 | $edit_title = htmlspecialchars($line["title"]); |
9c483746 | 1083 | |
11f083e7 | 1084 | print "<td width='5%' align='center'><input |
a998dbef | 1085 | onclick='toggleSelectRow(this);' |
11f083e7 AD |
1086 | type=\"checkbox\" id=\"FCCHK-$cat_id\"></td>"; |
1087 | ||
1088 | print "<td><span id=\"FCATT-$cat_id\">" . | |
1089 | $edit_title . "</span></td>"; | |
9c483746 AD |
1090 | |
1091 | print "</tr>"; | |
1092 | ||
1093 | ++$lnum; | |
1094 | } | |
1095 | ||
1096 | print "</table>"; | |
1097 | ||
1098 | print "</form>"; | |
1099 | ||
1100 | print "</div>"; | |
1101 | ||
6f5b1e04 | 1102 | } else { |
31cc42f6 | 1103 | print "<p>".__('No feed categories defined.')."</p>"; |
6f5b1e04 | 1104 | } |
9c483746 | 1105 | |
d60009cd AD |
1106 | print "<div class='dlgButtons'> |
1107 | <div style='float : left'> | |
1108 | <button onclick=\"return removeSelectedFeedCats()\">". | |
1109 | __('Remove')."</button> | |
1110 | </div>"; | |
9c483746 | 1111 | |
d60009cd AD |
1112 | print "<button onclick=\"selectTab('feedConfig')\">". |
1113 | __('Close this window')."</button></div>"; | |
9c483746 | 1114 | |
951906dc | 1115 | print "]]></content></dlg>"; |
6f5b1e04 | 1116 | |
9c483746 AD |
1117 | return; |
1118 | ||
1119 | } | |
1120 | ||
ef8be8ea AD |
1121 | if ($quiet) return; |
1122 | ||
8df7184c AD |
1123 | print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">"; |
1124 | print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Feeds')."\">"; | |
1125 | ||
442d77f1 AD |
1126 | set_pref($link, "_PREFS_ACTIVE_TAB", "feedConfig"); |
1127 | ||
a3656a41 | 1128 | $result = db_query($link, "SELECT COUNT(id) AS num_errors |
ef8be8ea AD |
1129 | FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); |
1130 | ||
a3656a41 | 1131 | $num_errors = db_fetch_result($result, 0, "num_errors"); |
ef8be8ea | 1132 | |
a3656a41 | 1133 | if ($num_errors > 0) { |
ef8be8ea | 1134 | |
49c6c279 AD |
1135 | $error_button = "<button dojoType=\"dijit.form.Button\" |
1136 | onclick=\"showFeedsWithErrors\" id=\"errorButton\">" . | |
1137 | __("Feeds with errors") . "</button>"; | |
1138 | ||
1139 | // print format_notice("<a href=\"javascript:showFeedsWithErrors()\">". | |
1140 | // __('Some feeds have update errors (click for details)')."</a>"); | |
ef8be8ea AD |
1141 | } |
1142 | ||
b4e75b2a | 1143 | $feed_search = db_escape_string($_REQUEST["search"]); |
ef8be8ea | 1144 | |
b4e75b2a | 1145 | if (array_key_exists("search", $_REQUEST)) { |
ef8be8ea AD |
1146 | $_SESSION["prefs_feed_search"] = $feed_search; |
1147 | } else { | |
1148 | $feed_search = $_SESSION["prefs_feed_search"]; | |
1149 | } | |
1150 | ||
8df7184c AD |
1151 | print "<div dojoType=\"dijit.Toolbar\">"; |
1152 | ||
1985a5e0 | 1153 | /* |
577399e8 | 1154 | print "<div style='float : right'> |
3dc8ee84 | 1155 | <input id=\"feed_search\" size=\"20\" type=\"search\" |
a998dbef AD |
1156 | onfocus=\"disableHotkeys();\" |
1157 | onblur=\"enableHotkeys();\" | |
1158 | onchange=\"updateFeedList()\" value=\"$feed_search\"> | |
1159 | <button onclick=\"updateFeedList()\">". | |
577399e8 | 1160 | __('Search')."</button> |
1985a5e0 AD |
1161 | </div>"; */ |
1162 | ||
1163 | print "<div dojoType=\"dijit.form.DropDownButton\">". | |
d69fa6d6 | 1164 | "<span>" . __('Select')."</span>"; |
1985a5e0 AD |
1165 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
1166 | print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(true)\" | |
1167 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; | |
1168 | print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(false)\" | |
1169 | dojoType=\"dijit.MenuItem\">".__('None')."</div>"; | |
d69fa6d6 | 1170 | print "</div></div>"; |
1e5548db | 1171 | |
7b8a143f AD |
1172 | print "<div dojoType=\"dijit.form.DropDownButton\">". |
1173 | "<span>" . __('Feeds')."</span>"; | |
1174 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; | |
1175 | print "<div onclick=\"quickAddFeed()\" | |
1176 | dojoType=\"dijit.MenuItem\">".__('Subscribe to feed')."</div>"; | |
1177 | print "<div onclick=\"editSelectedFeed()\" | |
82aea978 | 1178 | dojoType=\"dijit.MenuItem\">".__('Edit selected feeds')."</div>"; |
7b8a143f AD |
1179 | print "<div onclick=\"resetFeedOrder()\" |
1180 | dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>"; | |
1181 | print "</div></div>"; | |
1e5548db AD |
1182 | |
1183 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
7b8a143f AD |
1184 | print "<div dojoType=\"dijit.form.DropDownButton\">". |
1185 | "<span>" . __('Categories')."</span>"; | |
1186 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; | |
1187 | print "<div onclick=\"editFeedCats()\" | |
1188 | dojoType=\"dijit.MenuItem\">".__('Edit categories')."</div>"; | |
1189 | print "<div onclick=\"resetCatOrder()\" | |
1190 | dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>"; | |
1191 | print "</div></div>"; | |
1e5548db | 1192 | |
1e5548db AD |
1193 | } |
1194 | ||
49c6c279 AD |
1195 | print $error_button; |
1196 | ||
1985a5e0 AD |
1197 | print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedFeeds()\">" |
1198 | .__('Unsubscribe')."</button dojoType=\"dijit.form.Button\"> "; | |
1e5548db | 1199 | |
a522a767 | 1200 | if (defined('_ENABLE_FEED_DEBUGGING')) { |
ef8be8ea | 1201 | |
a522a767 AD |
1202 | print "<select id=\"feedActionChooser\" onchange=\"feedActionChange()\"> |
1203 | <option value=\"facDefault\" selected>".__('More actions...')."</option>"; | |
1204 | ||
1205 | if (FORCE_ARTICLE_PURGE == 0) { | |
1206 | ||
1207 | "<option value=\"facPurge\">".__('Manual purge')."</option>"; | |
1208 | } | |
1209 | ||
1210 | print " | |
1211 | <option value=\"facClear\">".__('Clear feed data')."</option> | |
1212 | <option value=\"facRescore\">".__('Rescore articles')."</option>"; | |
1213 | ||
1214 | print "</select>"; | |
0b9751cd | 1215 | |
a522a767 | 1216 | } |
0b9751cd | 1217 | |
8df7184c AD |
1218 | print "</div>"; # toolbar |
1219 | ||
1985a5e0 AD |
1220 | print "<div id=\"feedlistLoading\"> |
1221 | <img src='images/indicator_tiny.gif'>". | |
1222 | __("Loading, please wait...")."</div>"; | |
1223 | ||
7b8a143f AD |
1224 | print "<div dojoType=\"fox.PrefFeedStore\" jsId=\"feedStore\" |
1225 | url=\"backend.php?op=pref-feeds&subop=getfeedtree\"> | |
1985a5e0 AD |
1226 | </div> |
1227 | <div dojoType=\"lib.CheckBoxStoreModel\" jsId=\"feedModel\" store=\"feedStore\" | |
1228 | query=\"{id:'root'}\" rootId=\"root\" rootLabel=\"Feeds\" | |
1229 | childrenAttrs=\"items\" checkboxStrict=\"false\" checkboxAll=\"false\"> | |
1230 | </div> | |
2148e0d5 AD |
1231 | <div dojoType=\"fox.PrefFeedTree\" id=\"feedTree\" |
1232 | dndController=\"dijit.tree.dndSource\" | |
7b8a143f | 1233 | betweenThreshold=\"5\" |
1985a5e0 AD |
1234 | model=\"feedModel\" openOnClick=\"false\"> |
1235 | <script type=\"dojo/method\" event=\"onClick\" args=\"item\"> | |
1236 | var id = String(item.id); | |
1237 | var bare_id = id.substr(id.indexOf(':')+1); | |
1238 | ||
7b8a143f | 1239 | if (id.match('FEED:')) { |
1985a5e0 | 1240 | editFeed(bare_id, event); |
7b8a143f AD |
1241 | } else if (id.match('CAT:')) { |
1242 | editCat(bare_id, item, event); | |
1243 | } | |
1985a5e0 AD |
1244 | </script> |
1245 | <script type=\"dojo/method\" event=\"onLoad\" args=\"item\"> | |
1246 | Element.hide(\"feedlistLoading\"); | |
1247 | </script> | |
1985a5e0 AD |
1248 | </div>"; |
1249 | ||
a740f4b5 AD |
1250 | print "<div dojoType=\"dijit.Tooltip\" connectId=\"feedTree\" position=\"below\"> |
1251 | <b>Hint:</b> you can drag feeds and categories around. | |
1252 | </div>"; | |
1253 | ||
8df7184c | 1254 | print "</div>"; # feeds pane |
94a4ba88 | 1255 | |
8df7184c | 1256 | print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('OPML')."\">"; |
b6a6e262 | 1257 | |
00a35bb6 AD |
1258 | print "<p>" . __("Using OPML you can export and import your feeds and Tiny Tiny RSS settings."); |
1259 | ||
254ac705 | 1260 | print "<div class=\"insensitive\">" . __("Note: Only main settings profile can be migrated using OPML.") . "</div>"; |
c107797c | 1261 | |
00a35bb6 AD |
1262 | print "</p>"; |
1263 | ||
c3b7b797 | 1264 | print "<iframe name=\"upload_iframe\" |
b6a6e262 AD |
1265 | style=\"width: 400px; height: 100px; display: none;\"></iframe>"; |
1266 | ||
1267 | print "<div style='float : left'>"; | |
1268 | print "<form style='display : block' target=\"upload_iframe\" | |
1269 | enctype=\"multipart/form-data\" method=\"POST\" | |
1270 | action=\"backend.php\"> | |
1271 | <input id=\"opml_file\" name=\"opml_file\" type=\"file\"> | |
1272 | <input type=\"hidden\" name=\"op\" value=\"dlg\"> | |
1273 | <input type=\"hidden\" name=\"id\" value=\"importOpml\"> | |
1274 | <button onclick=\"return opmlImport();\" | |
1275 | type=\"submit\">".__('Import')."</button> | |
1276 | </form>"; | |
1277 | print "</div> "; | |
94a4ba88 | 1278 | |
8df7184c | 1279 | print "<button onclick=\"gotoExportOpml()\">".__('Export OPML')."</button>"; |
94a4ba88 | 1280 | |
c107797c AD |
1281 | print "<p>".__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.'); |
1282 | ||
1283 | print "<div class=\"insensitive\">" . __("Note: Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") . "</div>" . "</p>"; | |
e4f4b46f | 1284 | |
c107797c AD |
1285 | print "<button onclick=\"return displayDlg('pubOPMLUrl')\">". |
1286 | __('Display URL')."</button> "; | |
1287 | ||
1288 | ||
8df7184c AD |
1289 | print "</div>"; # pane |
1290 | ||
68313e5d | 1291 | if (strpos($_SERVER['HTTP_USER_AGENT'], "Firefox") !== false) { |
8df7184c AD |
1292 | |
1293 | print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Firefox integration')."\">"; | |
755a43ee | 1294 | |
c107797c | 1295 | print "<p>" . __('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.') . "</p>"; |
cf9dc032 | 1296 | |
68313e5d | 1297 | print "<p>"; |
cf9dc032 | 1298 | |
c107797c | 1299 | print "<button onclick='window.navigator.registerContentHandler(" . |
755a43ee AD |
1300 | "\"application/vnd.mozilla.maybe.feed\", " . |
1301 | "\"" . add_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" . | |
cf9dc032 AD |
1302 | __('Click here to register this site as a feed reader.') . |
1303 | "</button>"; | |
755a43ee | 1304 | |
c107797c | 1305 | print "</p>"; |
755a43ee | 1306 | |
8df7184c AD |
1307 | print "</div>"; # pane |
1308 | } | |
46dc1538 | 1309 | |
8df7184c AD |
1310 | print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Subscribing using bookmarklet')."\">"; |
1311 | ||
46dc1538 AD |
1312 | 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>"; |
1313 | ||
1314 | $bm_subscribe_url = str_replace('%s', '', add_feed_url()); | |
1315 | ||
1316 | $confirm_str = __('Subscribe to %s in Tiny Tiny RSS?'); | |
1317 | ||
1318 | $bm_url = htmlspecialchars("javascript:{if(confirm('$confirm_str'.replace('%s',window.location.href)))window.location.href='$bm_subscribe_url'+window.location.href}"); | |
1319 | ||
1320 | print "<a href=\"$bm_url\" class='visibleLink'>" . __('Subscribe in Tiny Tiny RSS'). "</a>"; | |
1321 | ||
8df7184c AD |
1322 | print "</div>"; #pane |
1323 | ||
1324 | print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Published articles and generated feeds')."\">"; | |
e4f4b46f | 1325 | |
e635d56a | 1326 | print "<p>".__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.')."</p>"; |
e4f4b46f | 1327 | |
8801fb01 AD |
1328 | $rss_url = '-2::' . htmlspecialchars(get_self_url_prefix() . |
1329 | "/backend.php?op=rss&id=-2&view-mode=all_articles");; | |
1330 | ||
1331 | print "<button onclick=\"return displayDlg('generatedFeed', '$rss_url')\">". | |
cf9dc032 | 1332 | __('Display URL')."</button> "; |
c107797c | 1333 | |
8d86f15f AD |
1334 | print "<button onclick=\"return clearFeedAccessKeys()\">". |
1335 | __('Clear all generated URLs')."</button> "; | |
e4f4b46f | 1336 | |
8df7184c AD |
1337 | print "</div>"; #pane |
1338 | print "</div>"; #container | |
1339 | ||
ef8be8ea | 1340 | } |
b56465dd | 1341 | |
082ae95b | 1342 | function print_feed_browser($link, $search, $limit, $mode = 1) { |
b56465dd | 1343 | |
c2913898 AD |
1344 | $owner_uid = $_SESSION["uid"]; |
1345 | ||
1346 | if ($search) { | |
1347 | $search_qpart = "AND (UPPER(feed_url) LIKE UPPER('%$search%') OR | |
1348 | UPPER(title) LIKE UPPER('%$search%'))"; | |
1349 | } else { | |
1350 | $search_qpart = ""; | |
1351 | } | |
1352 | ||
082ae95b AD |
1353 | if ($mode == 1) { |
1354 | $result = db_query($link, "SELECT feed_url, subscribers FROM | |
1355 | ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf | |
1356 | WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url | |
1357 | AND owner_uid = '$owner_uid') $search_qpart | |
1358 | ORDER BY subscribers DESC LIMIT $limit"); | |
1359 | } else if ($mode == 2) { | |
ef88b1cc AD |
1360 | $result = db_query($link, "SELECT *, |
1361 | (SELECT COUNT(*) FROM ttrss_user_entries WHERE | |
1362 | orig_feed_id = ttrss_archived_feeds.id) AS articles_archived | |
1363 | FROM | |
1364 | ttrss_archived_feeds | |
1365 | WHERE | |
082ae95b AD |
1366 | (SELECT COUNT(*) FROM ttrss_feeds |
1367 | WHERE ttrss_feeds.feed_url = ttrss_archived_feeds.feed_url AND | |
1368 | owner_uid = '$owner_uid') = 0 AND | |
1369 | owner_uid = '$owner_uid' $search_qpart | |
1370 | ORDER BY id DESC LIMIT $limit"); | |
1371 | } | |
b56465dd AD |
1372 | |
1373 | $feedctr = 0; | |
1374 | ||
1375 | while ($line = db_fetch_assoc($result)) { | |
b56465dd | 1376 | |
082ae95b | 1377 | if ($mode == 1) { |
b56465dd | 1378 | |
2211a391 | 1379 | $feed_url = $line["feed_url"]; |
082ae95b | 1380 | $subscribers = $line["subscribers"]; |
2211a391 | 1381 | |
082ae95b AD |
1382 | $det_result = db_query($link, "SELECT site_url,title,id |
1383 | FROM ttrss_feeds WHERE feed_url = '$feed_url' LIMIT 1"); | |
1384 | ||
1385 | $details = db_fetch_assoc($det_result); | |
1386 | ||
1387 | $icon_file = ICONS_DIR . "/" . $details["id"] . ".ico"; | |
1388 | ||
1389 | if (file_exists($icon_file) && filesize($icon_file) > 0) { | |
1390 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . | |
1391 | "/".$details["id"].".ico\">"; | |
1392 | } else { | |
1393 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">"; | |
1394 | } | |
1395 | ||
ef88b1cc AD |
1396 | $check_box = "<input onclick='toggleSelectListRow(this)' |
1397 | class='feedBrowseCB' | |
082ae95b AD |
1398 | type=\"checkbox\" id=\"FBCHK-" . $details["id"] . "\">"; |
1399 | ||
1400 | $class = ($feedctr % 2) ? "even" : "odd"; | |
1401 | ||
2211a391 AD |
1402 | $feed_url = htmlspecialchars($line["feed_url"]); |
1403 | ||
082ae95b | 1404 | if ($details["site_url"]) { |
ef88b1cc AD |
1405 | $site_url = "<a target=\"_blank\" href=\"". |
1406 | htmlspecialchars($details["site_url"])."\"> | |
082ae95b AD |
1407 | <img style='border-width : 0px' src='images/www.png' alt='www'></a>"; |
1408 | } else { | |
1409 | $site_url = ""; | |
1410 | } | |
e15bb6f7 AD |
1411 | |
1412 | $feed_url = "<a target=\"_blank\" href=\"$feed_url\"><img | |
1413 | style='border-width : 0px; vertical-align : middle' | |
1414 | src='images/feed-icon-12x12.png'></a>"; | |
1415 | ||
ef88b1cc AD |
1416 | print "<li title=\"".htmlspecialchars($details["site_url"])."\" |
1417 | class='$class' id=\"FBROW-".$details["id"]."\">$check_box". | |
e15bb6f7 | 1418 | "$feed_icon $feed_url " . htmlspecialchars($details["title"]) . |
082ae95b | 1419 | " <span class='subscribers'>($subscribers)</span> |
ef88b1cc | 1420 | $site_url</li>"; |
082ae95b AD |
1421 | |
1422 | } else if ($mode == 2) { | |
ef88b1cc AD |
1423 | $feed_url = htmlspecialchars($line["feed_url"]); |
1424 | $site_url = htmlspecialchars($line["site_url"]); | |
1425 | $title = htmlspecialchars($line["title"]); | |
69877646 AD |
1426 | |
1427 | $icon_file = ICONS_DIR . "/" . $line["id"] . ".ico"; | |
082ae95b | 1428 | |
69877646 AD |
1429 | if (file_exists($icon_file) && filesize($icon_file) > 0) { |
1430 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . | |
1431 | "/".$line["id"].".ico\">"; | |
1432 | } else { | |
1433 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">"; | |
1434 | } | |
1435 | ||
082ae95b AD |
1436 | $check_box = "<input onclick='toggleSelectListRow(this)' class='feedBrowseCB' |
1437 | type=\"checkbox\" id=\"FBCHK-" . $line["id"] . "\">"; | |
1438 | ||
1439 | $class = ($feedctr % 2) ? "even" : "odd"; | |
ef88b1cc AD |
1440 | |
1441 | if ($line['articles_archived'] > 0) { | |
1442 | $archived = sprintf(__("%d archived articles"), $line['articles_archived']); | |
1443 | $archived = " <span class='subscribers'>($archived)</span>"; | |
1444 | } else { | |
1445 | $archived = ''; | |
1446 | } | |
1447 | ||
082ae95b | 1448 | if ($line["site_url"]) { |
ef88b1cc | 1449 | $site_url = "<a target=\"_blank\" href=\"$site_url\"> |
082ae95b AD |
1450 | <img style='border-width : 0px' src='images/www.png' alt='www'></a>"; |
1451 | } else { | |
1452 | $site_url = ""; | |
1453 | } | |
e15bb6f7 AD |
1454 | |
1455 | $feed_url = "<a target=\"_blank\" href=\"$feed_url\"><img | |
1456 | style='border-width : 0px; vertical-align : middle' | |
1457 | src='images/feed-icon-12x12.png'></a>"; | |
1458 | ||
ef88b1cc AD |
1459 | print "<li title='".$line['site_url']."' class='$class' |
1460 | id=\"FBROW-".$line["id"]."\">". | |
e15bb6f7 AD |
1461 | $check_box . "$feed_icon $feed_url " . $title . |
1462 | $archived . $site_url . "</li>"; | |
b56465dd | 1463 | |
b56465dd | 1464 | |
2bab8824 AD |
1465 | } |
1466 | ||
082ae95b | 1467 | ++$feedctr; |
b56465dd AD |
1468 | } |
1469 | ||
1470 | if ($feedctr == 0) { | |
1471 | print "<li style=\"text-align : center\"><p>".__('No feeds found.')."</p></li>"; | |
1472 | } | |
1473 | ||
1474 | return $feedctr; | |
1475 | ||
1476 | } | |
a5819bb3 | 1477 | |
ef8be8ea | 1478 | ?> |