]>
Commit | Line | Data |
---|---|---|
ef8be8ea | 1 | <?php |
d20f3544 | 2 | |
ef8be8ea AD |
3 | function module_pref_feeds($link) { |
4 | ||
d20f3544 AD |
5 | global $update_intervals; |
6 | global $purge_intervals; | |
7 | ||
ef8be8ea AD |
8 | $subop = $_REQUEST["subop"]; |
9 | $quiet = $_REQUEST["quiet"]; | |
10 | ||
11 | if ($subop == "massSubscribe") { | |
12 | $ids = split(",", db_escape_string($_GET["ids"])); | |
13 | ||
14 | $subscribed = array(); | |
15 | ||
16 | foreach ($ids as $id) { | |
17 | $result = db_query($link, "SELECT feed_url,title FROM ttrss_feeds | |
18 | WHERE id = '$id'"); | |
19 | ||
20 | $feed_url = db_escape_string(db_fetch_result($result, 0, "feed_url")); | |
21 | $title = db_escape_string(db_fetch_result($result, 0, "title")); | |
22 | ||
23 | $title_orig = db_fetch_result($result, 0, "title"); | |
24 | ||
25 | $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE | |
26 | feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]); | |
27 | ||
28 | if (db_num_rows($result) == 0) { | |
29 | $result = db_query($link, | |
30 | "INSERT INTO ttrss_feeds (owner_uid,feed_url,title,cat_id) | |
31 | VALUES ('".$_SESSION["uid"]."', '$feed_url', '$title', NULL)"); | |
32 | ||
33 | array_push($subscribed, $title_orig); | |
34 | } | |
35 | } | |
36 | ||
37 | if (count($subscribed) > 0) { | |
31cc42f6 | 38 | $msg = "<b>".__('Subscribed to feeds:')."</b>". |
0d32b41e AD |
39 | "<ul class=\"nomarks\">"; |
40 | ||
ef8be8ea | 41 | foreach ($subscribed as $title) { |
0d32b41e | 42 | $msg .= "<li>$title</li>"; |
ef8be8ea | 43 | } |
0d32b41e AD |
44 | $msg .= "</ul>"; |
45 | ||
46 | print format_notice($msg); | |
ef8be8ea AD |
47 | } |
48 | } | |
49 | ||
50 | if ($subop == "browse") { | |
51 | ||
52 | if (!ENABLE_FEED_BROWSER) { | |
31cc42f6 | 53 | print __("Feed browser is administratively disabled."); |
ef8be8ea AD |
54 | return; |
55 | } | |
56 | ||
31cc42f6 | 57 | print "<div id=\"infoBoxTitle\">".__('Other feeds: Top 25')."</div>"; |
ef8be8ea AD |
58 | |
59 | print "<div class=\"infoBoxContents\">"; | |
60 | ||
31cc42f6 | 61 | print "<p>".__("Showing top 25 registered feeds, sorted by popularity:")."</p>"; |
ef8be8ea AD |
62 | |
63 | # $result = db_query($link, "SELECT feed_url,count(id) AS subscribers | |
64 | # FROM ttrss_feeds | |
65 | # WHERE auth_login = '' AND auth_pass = '' AND private = false | |
66 | # GROUP BY feed_url ORDER BY subscribers DESC LIMIT 25"); | |
67 | ||
68 | $owner_uid = $_SESSION["uid"]; | |
69 | ||
70 | $result = db_query($link, "SELECT feed_url,COUNT(id) AS subscribers | |
71 | FROM ttrss_feeds WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf | |
72 | WHERE tf.feed_url = ttrss_feeds.feed_url | |
73 | AND owner_uid = '$owner_uid') GROUP BY feed_url | |
74 | ORDER BY subscribers DESC LIMIT 25"); | |
75 | ||
76 | print "<ul class='browseFeedList' id='browseFeedList'>"; | |
77 | ||
78 | $feedctr = 0; | |
79 | ||
80 | while ($line = db_fetch_assoc($result)) { | |
81 | $feed_url = $line["feed_url"]; | |
82 | $subscribers = $line["subscribers"]; | |
83 | ||
84 | $det_result = db_query($link, "SELECT site_url,title,id | |
85 | FROM ttrss_feeds WHERE feed_url = '$feed_url' LIMIT 1"); | |
86 | ||
87 | $details = db_fetch_assoc($det_result); | |
88 | ||
89 | $icon_file = ICONS_DIR . "/" . $details["id"] . ".ico"; | |
90 | ||
91 | if (file_exists($icon_file) && filesize($icon_file) > 0) { | |
92 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . | |
93 | "/".$details["id"].".ico\">"; | |
94 | } else { | |
95 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">"; | |
96 | } | |
97 | ||
98 | $check_box = "<input onclick='toggleSelectListRow(this)' class='feedBrowseCB' | |
99 | type=\"checkbox\" id=\"FBCHK-" . $details["id"] . "\">"; | |
100 | ||
101 | $class = ($feedctr % 2) ? "even" : "odd"; | |
102 | ||
103 | print "<li class='$class' id=\"FBROW-".$details["id"]."\">$check_box". | |
47439031 | 104 | "$feed_icon " . $details["title"] . |
ef8be8ea AD |
105 | " <span class='subscribers'>($subscribers)</span></li>"; |
106 | ||
107 | ++$feedctr; | |
108 | } | |
109 | ||
110 | if ($feedctr == 0) { | |
31cc42f6 | 111 | print "<li>".__('No feeds found to subscribe.')."</li>"; |
ef8be8ea AD |
112 | } |
113 | ||
114 | print "</ul>"; | |
115 | ||
116 | print "<div align='center'> | |
117 | <input type=\"submit\" class=\"button\" | |
31cc42f6 | 118 | onclick=\"feedBrowserSubscribe()\" value=\"".__('Subscribe')."\"> |
ef8be8ea | 119 | <input type='submit' class='button' |
31cc42f6 | 120 | onclick=\"closeInfoBox()\" value=\"".__('Cancel')."\"></div>"; |
ef8be8ea AD |
121 | |
122 | print "</div>"; | |
123 | return; | |
124 | } | |
125 | ||
126 | if ($subop == "editfeed") { | |
127 | $feed_id = db_escape_string($_REQUEST["id"]); | |
128 | ||
129 | $result = db_query($link, | |
130 | "SELECT * FROM ttrss_feeds WHERE id = '$feed_id' AND | |
131 | owner_uid = " . $_SESSION["uid"]); | |
132 | ||
47439031 AD |
133 | $title = htmlspecialchars(db_fetch_result($result, |
134 | 0, "title")); | |
ef8be8ea AD |
135 | |
136 | $icon_file = ICONS_DIR . "/$feed_id.ico"; | |
137 | ||
138 | if (file_exists($icon_file) && filesize($icon_file) > 0) { | |
139 | $feed_icon = "<img width=\"16\" height=\"16\" | |
140 | src=\"" . ICONS_URL . "/$feed_id.ico\">"; | |
141 | } else { | |
142 | $feed_icon = ""; | |
143 | } | |
144 | ||
31cc42f6 | 145 | print "<div id=\"infoBoxTitle\">".__('Feed editor')."</div>"; |
ef8be8ea AD |
146 | |
147 | print "<div class=\"infoBoxContents\">"; | |
148 | ||
e6312f6c | 149 | print "<form id=\"edit_feed_form\" onsubmit=\"return false\">"; |
ef8be8ea AD |
150 | |
151 | print "<input type=\"hidden\" name=\"id\" value=\"$feed_id\">"; | |
152 | print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">"; | |
153 | print "<input type=\"hidden\" name=\"subop\" value=\"editSave\">"; | |
154 | ||
155 | print "<table width='100%'>"; | |
156 | ||
31cc42f6 | 157 | print "<tr><td>".__('Title:')."</td>"; |
ef8be8ea AD |
158 | print "<td><input class=\"iedit\" onkeypress=\"return filterCR(event, feedEditSave)\" |
159 | name=\"title\" value=\"$title\"></td></tr>"; | |
160 | ||
161 | $feed_url = db_fetch_result($result, 0, "feed_url"); | |
47439031 AD |
162 | $feed_url = htmlspecialchars(db_fetch_result($result, |
163 | 0, "feed_url")); | |
ef8be8ea | 164 | |
31cc42f6 | 165 | print "<tr><td>".__('Feed URL:')."</td>"; |
ef8be8ea AD |
166 | print "<td><input class=\"iedit\" onkeypress=\"return filterCR(event, feedEditSave)\" |
167 | name=\"feed_url\" value=\"$feed_url\"></td></tr>"; | |
168 | ||
169 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
170 | ||
171 | $cat_id = db_fetch_result($result, 0, "cat_id"); | |
172 | ||
31cc42f6 | 173 | print "<tr><td>".__('Category:')."</td>"; |
ef8be8ea AD |
174 | print "<td>"; |
175 | ||
176 | $parent_feed = db_fetch_result($result, 0, "parent_feed"); | |
177 | ||
178 | if (sprintf("%d", $parent_feed) > 0) { | |
179 | $disabled = "disabled"; | |
180 | } else { | |
181 | $disabled = ""; | |
182 | } | |
183 | ||
184 | print_feed_cat_select($link, "cat_id", $cat_id, "class=\"iedit\" $disabled"); | |
185 | ||
186 | print "</td>"; | |
187 | print "</td></tr>"; | |
188 | ||
189 | } | |
190 | ||
191 | $update_interval = db_fetch_result($result, 0, "update_interval"); | |
192 | ||
31cc42f6 | 193 | print "<tr><td>".__('Update Interval:')."</td>"; |
ef8be8ea AD |
194 | |
195 | print "<td>"; | |
196 | ||
197 | print_select_hash("update_interval", $update_interval, $update_intervals, | |
198 | "class=\"iedit\""); | |
199 | ||
200 | print "</td>"; | |
201 | ||
31cc42f6 | 202 | print "<tr><td>".__('Link to:')."</td><td>"; |
ef8be8ea AD |
203 | |
204 | $tmp_result = db_query($link, "SELECT COUNT(id) AS count | |
205 | FROM ttrss_feeds WHERE parent_feed = '$feed_id'"); | |
206 | ||
207 | $linked_count = db_fetch_result($tmp_result, 0, "count"); | |
208 | ||
209 | $parent_feed = db_fetch_result($result, 0, "parent_feed"); | |
210 | ||
211 | if ($linked_count > 0) { | |
212 | $disabled = "disabled"; | |
213 | } else { | |
214 | $disabled = ""; | |
215 | } | |
216 | ||
217 | print "<select class=\"iedit\" $disabled name=\"parent_feed\">"; | |
218 | ||
31cc42f6 | 219 | print "<option value=\"0\">".__('Not linked')."</option>"; |
ef8be8ea AD |
220 | |
221 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
222 | if ($cat_id) { | |
223 | $cat_qpart = "AND cat_id = '$cat_id'"; | |
224 | } else { | |
225 | $cat_qpart = "AND cat_id IS NULL"; | |
226 | } | |
227 | } | |
228 | ||
229 | $tmp_result = db_query($link, "SELECT id,title FROM ttrss_feeds | |
230 | WHERE id != '$feed_id' AND owner_uid = ".$_SESSION["uid"]." AND | |
231 | (SELECT COUNT(id) FROM ttrss_feeds AS T2 WHERE T2.id = ttrss_feeds.parent_feed) = 0 | |
232 | $cat_qpart ORDER BY title"); | |
233 | ||
234 | if (db_num_rows($tmp_result) > 0) { | |
235 | print "<option disabled>--------</option>"; | |
236 | } | |
237 | ||
238 | while ($tmp_line = db_fetch_assoc($tmp_result)) { | |
239 | if ($tmp_line["id"] == $parent_feed) { | |
240 | $is_selected = "selected"; | |
241 | } else { | |
242 | $is_selected = ""; | |
243 | } | |
244 | printf("<option $is_selected value='%d'>%s</option>", | |
245 | $tmp_line["id"], $tmp_line["title"]); | |
246 | } | |
247 | ||
248 | print "</select>"; | |
249 | print "</td></tr>"; | |
250 | ||
251 | $purge_interval = db_fetch_result($result, 0, "purge_interval"); | |
252 | ||
31cc42f6 | 253 | print "<tr><td>".__('Article purging:')."</td>"; |
ef8be8ea AD |
254 | |
255 | print "<td>"; | |
256 | ||
257 | print_select_hash("purge_interval", $purge_interval, $purge_intervals, | |
258 | "class=\"iedit\""); | |
259 | ||
260 | print "</td>"; | |
261 | ||
47439031 | 262 | $auth_login = htmlspecialchars(db_fetch_result($result, 0, "auth_login")); |
ef8be8ea | 263 | |
31cc42f6 | 264 | print "<tr><td>".__('Login:')."</td>"; |
ef8be8ea AD |
265 | print "<td><input class=\"iedit\" onkeypress=\"return filterCR(event, feedEditSave)\" |
266 | name=\"auth_login\" value=\"$auth_login\"></td></tr>"; | |
267 | ||
47439031 | 268 | $auth_pass = htmlspecialchars(db_fetch_result($result, 0, "auth_pass")); |
ef8be8ea | 269 | |
31cc42f6 | 270 | print "<tr><td>".__('Password:')."</td>"; |
ef8be8ea AD |
271 | print "<td><input class=\"iedit\" type=\"password\" name=\"auth_pass\" |
272 | onkeypress=\"return filterCR(event, feedEditSave)\" | |
273 | value=\"$auth_pass\"></td></tr>"; | |
274 | ||
275 | $private = sql_bool_to_bool(db_fetch_result($result, 0, "private")); | |
276 | ||
277 | if ($private) { | |
278 | $checked = "checked"; | |
279 | } else { | |
280 | $checked = ""; | |
281 | } | |
282 | ||
31cc42f6 | 283 | print "<tr><td valign='top'>".__('Options:')."</td>"; |
ef8be8ea | 284 | print "<td><input type=\"checkbox\" name=\"private\" id=\"private\" |
31cc42f6 | 285 | $checked><label for=\"private\">".__('Hide from "Other Feeds"')."</label>"; |
ef8be8ea AD |
286 | |
287 | $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content")); | |
288 | ||
289 | if ($rtl_content) { | |
290 | $checked = "checked"; | |
291 | } else { | |
292 | $checked = ""; | |
293 | } | |
294 | ||
295 | print "<br><input type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\" | |
3692e98f | 296 | $checked><label for=\"rtl_content\">".__('Right-to-left content')."</label>"; |
ef8be8ea AD |
297 | |
298 | $hidden = sql_bool_to_bool(db_fetch_result($result, 0, "hidden")); | |
299 | ||
300 | if ($hidden) { | |
301 | $checked = "checked"; | |
302 | } else { | |
303 | $checked = ""; | |
304 | } | |
305 | ||
306 | print "<br><input type=\"checkbox\" id=\"hidden\" name=\"hidden\" | |
31cc42f6 | 307 | $checked><label for=\"hidden\">".__('Hide from my feed list')."</label>"; |
ef8be8ea AD |
308 | |
309 | $include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest")); | |
310 | ||
311 | if ($include_in_digest) { | |
312 | $checked = "checked"; | |
313 | } else { | |
314 | $checked = ""; | |
315 | } | |
316 | ||
317 | print "<br><input type=\"checkbox\" id=\"include_in_digest\" | |
318 | name=\"include_in_digest\" | |
31cc42f6 | 319 | $checked><label for=\"include_in_digest\">".__('Include in e-mail digest')."</label>"; |
ef8be8ea | 320 | |
bc0f0785 AD |
321 | $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images")); |
322 | ||
323 | if ($cache_images) { | |
324 | $checked = "checked"; | |
325 | } else { | |
326 | $checked = ""; | |
327 | } | |
328 | ||
329 | if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { | |
330 | $disabled = ""; | |
331 | $label_class = ""; | |
332 | } else { | |
333 | $disabled = "disabled"; | |
334 | $label_class = "class='insensitive'"; | |
335 | } | |
336 | ||
337 | print "<br><input type=\"checkbox\" id=\"cache_images\" | |
338 | name=\"cache_images\" $disabled | |
339 | $checked><label $label_class for=\"cache_images\">". | |
340 | __('Cache images locally')."</label>"; | |
341 | ||
ef8be8ea AD |
342 | print "</td></tr>"; |
343 | ||
344 | print "</table>"; | |
345 | ||
346 | print "</form>"; | |
347 | ||
348 | print "<div align='right'> | |
349 | <input type=\"submit\" class=\"button\" | |
31cc42f6 | 350 | onclick=\"return feedEditSave()\" value=\"".__('Save')."\"> |
ef8be8ea | 351 | <input type='submit' class='button' |
31cc42f6 | 352 | onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\"></div>"; |
ef8be8ea AD |
353 | |
354 | print "</div>"; | |
355 | ||
356 | return; | |
357 | } | |
358 | ||
359 | if ($subop == "editSave") { | |
360 | ||
361 | $feed_title = db_escape_string(trim($_POST["title"])); | |
362 | $feed_link = db_escape_string(trim($_POST["feed_url"])); | |
363 | $upd_intl = db_escape_string($_POST["update_interval"]); | |
364 | $purge_intl = db_escape_string($_POST["purge_interval"]); | |
365 | $feed_id = db_escape_string($_POST["id"]); | |
366 | $cat_id = db_escape_string($_POST["cat_id"]); | |
367 | $auth_login = db_escape_string(trim($_POST["auth_login"])); | |
368 | $auth_pass = db_escape_string(trim($_POST["auth_pass"])); | |
369 | $parent_feed = db_escape_string($_POST["parent_feed"]); | |
370 | $private = checkbox_to_sql_bool(db_escape_string($_POST["private"])); | |
371 | $rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"])); | |
372 | $hidden = checkbox_to_sql_bool(db_escape_string($_POST["hidden"])); | |
373 | $include_in_digest = checkbox_to_sql_bool( | |
374 | db_escape_string($_POST["include_in_digest"])); | |
bc0f0785 AD |
375 | $cache_images = checkbox_to_sql_bool( |
376 | db_escape_string($_POST["cache_images"])); | |
ef8be8ea AD |
377 | |
378 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
379 | if ($cat_id && $cat_id != 0) { | |
380 | $category_qpart = "cat_id = '$cat_id',"; | |
381 | $category_qpart_nocomma = "cat_id = '$cat_id'"; | |
382 | } else { | |
383 | $category_qpart = 'cat_id = NULL,'; | |
384 | $category_qpart_nocomma = 'cat_id = NULL'; | |
385 | } | |
386 | } else { | |
387 | $category_qpart = ""; | |
388 | $category_qpart_nocomma = ""; | |
389 | } | |
390 | ||
391 | if ($parent_feed && $parent_feed != 0) { | |
392 | $parent_qpart = "parent_feed = '$parent_feed'"; | |
393 | } else { | |
394 | $parent_qpart = 'parent_feed = NULL'; | |
395 | } | |
396 | ||
bc0f0785 AD |
397 | if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { |
398 | $cache_images_qpart = "cache_images = $cache_images,"; | |
399 | } else { | |
400 | $cache_images_qpart = ""; | |
401 | } | |
402 | ||
ef8be8ea AD |
403 | $result = db_query($link, "UPDATE ttrss_feeds SET |
404 | $category_qpart $parent_qpart, | |
405 | title = '$feed_title', feed_url = '$feed_link', | |
406 | update_interval = '$upd_intl', | |
407 | purge_interval = '$purge_intl', | |
408 | auth_login = '$auth_login', | |
409 | auth_pass = '$auth_pass', | |
410 | private = $private, | |
411 | rtl_content = $rtl_content, | |
412 | hidden = $hidden, | |
bc0f0785 | 413 | $cache_images_qpart |
ef8be8ea AD |
414 | include_in_digest = $include_in_digest |
415 | WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]); | |
416 | ||
417 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
418 | # update linked feed categories | |
419 | $result = db_query($link, "UPDATE ttrss_feeds SET | |
420 | $category_qpart_nocomma WHERE parent_feed = '$feed_id' AND | |
421 | owner_uid = " . $_SESSION["uid"]); | |
422 | } | |
423 | } | |
424 | ||
ef8be8ea AD |
425 | if ($subop == "remove") { |
426 | ||
427 | if (!WEB_DEMO_MODE) { | |
428 | ||
429 | $ids = split(",", db_escape_string($_GET["ids"])); | |
430 | ||
431 | foreach ($ids as $id) { | |
432 | ||
433 | if ($id > 0) { | |
434 | ||
435 | db_query($link, "DELETE FROM ttrss_feeds | |
436 | WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]); | |
437 | ||
438 | $icons_dir = ICONS_DIR; | |
439 | ||
440 | if (file_exists($icons_dir . "/$id.ico")) { | |
441 | unlink($icons_dir . "/$id.ico"); | |
442 | } | |
443 | } else if ($id < -10) { | |
444 | ||
445 | $label_id = -$id - 11; | |
446 | ||
447 | db_query($link, "DELETE FROM ttrss_labels | |
448 | WHERE id = '$label_id' AND owner_uid = " . $_SESSION["uid"]); | |
449 | } | |
450 | } | |
451 | } | |
452 | } | |
453 | ||
d1f0c584 AD |
454 | if ($subop == "clear") { |
455 | $id = db_escape_string($_GET["id"]); | |
456 | clear_feed_articles($link, $id); | |
457 | } | |
458 | ||
ef8be8ea AD |
459 | if ($subop == "add") { |
460 | ||
461 | if (!WEB_DEMO_MODE) { | |
462 | ||
f27de515 AD |
463 | $feed_url = db_escape_string(trim($_REQUEST["feed_url"])); |
464 | $cat_id = db_escape_string($_REQUEST["cat_id"]); | |
465 | $p_from = db_escape_string($_REQUEST["from"]); | |
466 | ||
467 | /* only read authentication information from POST */ | |
468 | ||
469 | $auth_login = db_escape_string(trim($_POST["auth_login"])); | |
470 | $auth_pass = db_escape_string(trim($_POST["auth_pass"])); | |
aa2122d4 | 471 | |
e513a74a | 472 | if ($p_from != 'tt-rss') { |
aa2122d4 AD |
473 | print "<html> |
474 | <head> | |
475 | <title>Tiny Tiny RSS - Subscribe to feed...</title> | |
476 | <link rel=\"stylesheet\" type=\"text/css\" href=\"quicksub.css\"> | |
477 | </head> | |
478 | <body> | |
479 | <img class=\"logo\" src=\"images/ttrss_logo.png\" | |
480 | alt=\"Tiny Tiny RSS\"/> | |
e513a74a AD |
481 | <h1>Subscribe to feed...</h1> |
482 | <div class=\"content\">"; | |
aa2122d4 | 483 | } |
ef8be8ea | 484 | |
f27de515 | 485 | if (subscribe_to_feed($link, $feed_url, $cat_id, $auth_login, $auth_pass)) { |
4dccf1ed | 486 | print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url)); |
ef8be8ea | 487 | } else { |
4dccf1ed | 488 | print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url)); |
ef8be8ea | 489 | } |
aa2122d4 | 490 | |
e513a74a | 491 | if ($p_from != 'tt-rss') { |
aa2122d4 AD |
492 | $tt_uri = 'http://' . $_SERVER['SERVER_NAME'] . |
493 | preg_replace('/backend\.php.*$/', | |
494 | 'tt-rss.php', $_SERVER["REQUEST_URI"]); | |
495 | ||
e513a74a AD |
496 | $tp_uri = 'http://' . $_SERVER['SERVER_NAME'] . |
497 | preg_replace('/backend\.php.*$/', | |
498 | 'prefs.php', $_SERVER["REQUEST_URI"]); | |
499 | ||
500 | print "<p><a href='$tt_uri'>Return to Tiny Tiny RSS</a> |"; | |
501 | ||
502 | $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE | |
503 | feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]); | |
504 | ||
505 | $feed_id = db_fetch_result($result, 0, "id"); | |
506 | ||
507 | if ($feed_id) { | |
508 | print "<a href='$tp_uri?tab=feedConfig&subop=editFeed:$feed_id'> | |
509 | Edit subscription options</a> | "; | |
510 | } | |
511 | ||
512 | print "<a href='javascript:window.close()'>Close this window</a>.</p>"; | |
aa2122d4 | 513 | |
e513a74a | 514 | print "</div></body></html>"; |
aa2122d4 AD |
515 | return; |
516 | } | |
442d77f1 | 517 | |
ef8be8ea AD |
518 | } |
519 | } | |
520 | ||
ef8be8ea AD |
521 | if ($subop == "categorize") { |
522 | ||
523 | if (!WEB_DEMO_MODE) { | |
524 | ||
525 | $ids = split(",", db_escape_string($_GET["ids"])); | |
526 | ||
527 | $cat_id = db_escape_string($_GET["cat_id"]); | |
528 | ||
529 | if ($cat_id == 0) { | |
530 | $cat_id_qpart = 'NULL'; | |
531 | } else { | |
532 | $cat_id_qpart = "'$cat_id'"; | |
533 | } | |
534 | ||
535 | db_query($link, "BEGIN"); | |
536 | ||
537 | foreach ($ids as $id) { | |
538 | ||
539 | db_query($link, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart | |
540 | WHERE id = '$id' AND parent_feed IS NULL | |
541 | AND owner_uid = " . $_SESSION["uid"]); | |
542 | ||
543 | # update linked feed categories | |
544 | db_query($link, "UPDATE ttrss_feeds SET | |
545 | cat_id = $cat_id_qpart WHERE parent_feed = '$id' AND | |
546 | owner_uid = " . $_SESSION["uid"]); | |
547 | ||
548 | } | |
549 | ||
550 | db_query($link, "COMMIT"); | |
551 | } | |
552 | ||
553 | } | |
554 | ||
9c483746 AD |
555 | if ($subop == "editCats") { |
556 | ||
9c483746 AD |
557 | $action = $_REQUEST["action"]; |
558 | ||
559 | if ($action == "save") { | |
560 | ||
11f083e7 AD |
561 | $cat_title = db_escape_string(trim($_REQUEST["value"])); |
562 | $cat_id = db_escape_string($_GET["cid"]); | |
9c483746 AD |
563 | |
564 | $result = db_query($link, "UPDATE ttrss_feed_categories SET | |
565 | title = '$cat_title' WHERE id = '$cat_id' AND owner_uid = ".$_SESSION["uid"]); | |
11f083e7 AD |
566 | |
567 | print $_REQUEST["value"]; | |
568 | ||
569 | return; | |
570 | ||
9c483746 AD |
571 | } |
572 | ||
11f083e7 AD |
573 | print "<div id=\"infoBoxTitle\">".__('Category editor')."</div>"; |
574 | ||
575 | print "<div class=\"infoBoxContents\">"; | |
576 | ||
577 | ||
9c483746 AD |
578 | if ($action == "add") { |
579 | ||
580 | if (!WEB_DEMO_MODE) { | |
581 | ||
582 | $feed_cat = db_escape_string(trim($_GET["cat"])); | |
583 | ||
584 | $result = db_query($link, | |
585 | "SELECT id FROM ttrss_feed_categories | |
586 | WHERE title = '$feed_cat' AND owner_uid = ".$_SESSION["uid"]); | |
587 | ||
588 | if (db_num_rows($result) == 0) { | |
589 | ||
590 | $result = db_query($link, | |
591 | "INSERT INTO ttrss_feed_categories (owner_uid,title) | |
592 | VALUES ('".$_SESSION["uid"]."', '$feed_cat')"); | |
593 | ||
594 | } else { | |
595 | ||
4dccf1ed AD |
596 | print_warning(T_sprintf("Category <b>$%s</b> already exists in the database.", |
597 | $feed_cat)); | |
9c483746 AD |
598 | } |
599 | ||
600 | } | |
601 | } | |
602 | ||
603 | if ($action == "remove") { | |
604 | ||
605 | if (!WEB_DEMO_MODE) { | |
606 | ||
607 | $ids = split(",", db_escape_string($_GET["ids"])); | |
608 | ||
609 | foreach ($ids as $id) { | |
610 | ||
611 | db_query($link, "BEGIN"); | |
612 | ||
613 | $result = db_query($link, | |
614 | "SELECT count(id) as num_feeds FROM ttrss_feeds | |
615 | WHERE cat_id = '$id'"); | |
616 | ||
617 | $num_feeds = db_fetch_result($result, 0, "num_feeds"); | |
618 | ||
619 | if ($num_feeds == 0) { | |
620 | db_query($link, "DELETE FROM ttrss_feed_categories | |
621 | WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]); | |
622 | } else { | |
623 | ||
31cc42f6 | 624 | print format_warning(__("Unable to delete non empty feed categories.")); |
9c483746 AD |
625 | |
626 | } | |
627 | ||
628 | db_query($link, "COMMIT"); | |
629 | } | |
630 | } | |
631 | } | |
632 | ||
633 | print "<div class=\"prefGenericAddBox\"> | |
634 | <input id=\"fadd_cat\" | |
1043a8c3 | 635 | onkeypress=\"return filterCR(event, addFeedCat)\" |
9c483746 | 636 | onkeyup=\"toggleSubmitNotEmpty(this, 'catadd_submit_btn')\" |
b5015f72 | 637 | onchange=\"toggleSubmitNotEmpty(this, 'catadd_submit_btn')\" |
9c483746 AD |
638 | size=\"40\"> |
639 | <input | |
640 | type=\"submit\" class=\"button\" disabled=\"true\" id=\"catadd_submit_btn\" | |
31cc42f6 | 641 | onclick=\"javascript:addFeedCat()\" value=\"".__('Create category')."\"></div>"; |
9c483746 AD |
642 | |
643 | $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories | |
644 | WHERE owner_uid = ".$_SESSION["uid"]." | |
645 | ORDER BY title"); | |
646 | ||
647 | print "<p>"; | |
648 | ||
649 | if (db_num_rows($result) != 0) { | |
650 | ||
651 | print "<table width=\"100%\" class=\"prefFeedCatList\" | |
652 | cellspacing=\"0\">"; | |
653 | ||
654 | print "<tr><td class=\"selectPrompt\" colspan=\"8\"> | |
e8d0177d AD |
655 | ".__('Select:')." |
656 | <a href=\"javascript:selectPrefRows('fcat', true)\">".__('All')."</a>, | |
657 | <a href=\"javascript:selectPrefRows('fcat', false)\">".__('None')."</a> | |
9c483746 AD |
658 | </td></tr>"; |
659 | ||
660 | print "</table>"; | |
661 | ||
662 | print "<div class=\"prefFeedCatHolder\">"; | |
663 | ||
e6312f6c | 664 | print "<form id=\"feed_cat_edit_form\" onsubmit=\"return false\">"; |
9c483746 AD |
665 | |
666 | print "<table width=\"100%\" class=\"prefFeedCatList\" | |
667 | cellspacing=\"0\" id=\"prefFeedCatList\">"; | |
9c483746 AD |
668 | |
669 | $lnum = 0; | |
670 | ||
671 | while ($line = db_fetch_assoc($result)) { | |
672 | ||
673 | $class = ($lnum % 2) ? "even" : "odd"; | |
674 | ||
675 | $cat_id = $line["id"]; | |
11f083e7 | 676 | $this_row_id = "id=\"FCATR-$cat_id\""; |
9c483746 AD |
677 | |
678 | print "<tr class=\"$class\" $this_row_id>"; | |
679 | ||
47439031 | 680 | $edit_title = htmlspecialchars($line["title"]); |
9c483746 | 681 | |
11f083e7 AD |
682 | print "<td width='5%' align='center'><input |
683 | onclick='toggleSelectPrefRow(this, \"fcat\");' | |
684 | type=\"checkbox\" id=\"FCCHK-$cat_id\"></td>"; | |
685 | ||
686 | print "<td><span id=\"FCATT-$cat_id\">" . | |
687 | $edit_title . "</span></td>"; | |
9c483746 AD |
688 | |
689 | print "</tr>"; | |
690 | ||
691 | ++$lnum; | |
692 | } | |
693 | ||
694 | print "</table>"; | |
695 | ||
696 | print "</form>"; | |
697 | ||
698 | print "</div>"; | |
699 | ||
6f5b1e04 | 700 | } else { |
31cc42f6 | 701 | print "<p>".__('No feed categories defined.')."</p>"; |
6f5b1e04 | 702 | } |
9c483746 | 703 | |
6f5b1e04 AD |
704 | print "<div style='float : right'> |
705 | <input type='submit' class='button' | |
31cc42f6 | 706 | onclick=\"selectTab('feedConfig')\" value=\"".__('Close this window')."\"></div>"; |
9c483746 | 707 | |
6f5b1e04 | 708 | print "<div id=\"catOpToolbar\">"; |
9c483746 | 709 | |
11f083e7 | 710 | print " |
6f5b1e04 | 711 | <input type=\"submit\" class=\"button\" disabled=\"true\" |
31cc42f6 | 712 | onclick=\"return removeSelectedFeedCats()\" value=\"".__('Remove')."\">"; |
11f083e7 | 713 | |
9c483746 AD |
714 | print "</div>"; |
715 | ||
6f5b1e04 AD |
716 | print "</div>"; |
717 | ||
9c483746 AD |
718 | return; |
719 | ||
720 | } | |
721 | ||
ef8be8ea AD |
722 | if ($quiet) return; |
723 | ||
442d77f1 AD |
724 | set_pref($link, "_PREFS_ACTIVE_TAB", "feedConfig"); |
725 | ||
a3656a41 | 726 | $result = db_query($link, "SELECT COUNT(id) AS num_errors |
ef8be8ea AD |
727 | FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); |
728 | ||
a3656a41 | 729 | $num_errors = db_fetch_result($result, 0, "num_errors"); |
ef8be8ea | 730 | |
a3656a41 | 731 | if ($num_errors > 0) { |
ef8be8ea | 732 | |
31cc42f6 AD |
733 | print format_notice("<a href=\"javascript:showFeedsWithErrors()\">". |
734 | __('Some feeds have update errors (click for details)')."</a>"); | |
ef8be8ea AD |
735 | } |
736 | ||
737 | $feed_search = db_escape_string($_GET["search"]); | |
738 | ||
739 | if (array_key_exists("search", $_GET)) { | |
740 | $_SESSION["prefs_feed_search"] = $feed_search; | |
741 | } else { | |
742 | $feed_search = $_SESSION["prefs_feed_search"]; | |
743 | } | |
744 | ||
745 | print "<div class=\"feedEditSearch\"> | |
746 | <input id=\"feed_search\" size=\"20\" | |
747 | onchange=\"javascript:updateFeedList()\" value=\"$feed_search\"> | |
748 | <input type=\"submit\" class=\"button\" | |
a3c159c4 | 749 | onclick=\"javascript:updateFeedList()\" value=\"".__('Search')."\"> |
ef8be8ea | 750 | </div>"; |
5e6f933a | 751 | |
442d77f1 | 752 | /* print "<input id=\"fadd_link\" |
ef8be8ea | 753 | onkeyup=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\" |
b5015f72 | 754 | onchange=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\" |
ef8be8ea AD |
755 | size=\"40\"> |
756 | <input type=\"submit\" class=\"button\" | |
757 | disabled=\"true\" id=\"fadd_submit_btn\" | |
442d77f1 AD |
758 | onclick=\"addFeed()\" value=\"".__('Subscribe')."\">"; */ |
759 | ||
760 | print "<input onclick=\"javascript:displayDlg('quickAddFeed')\" | |
a349077c | 761 | type=\"submit\" id=\"subscribe_to_feed_btn\" |
442d77f1 | 762 | class=\"button\" value=\"".__('Subscribe to feed')."\">"; |
ef8be8ea AD |
763 | |
764 | if (ENABLE_FEED_BROWSER && !SINGLE_USER_MODE) { | |
765 | print " <input type=\"submit\" class=\"button\" | |
a349077c | 766 | id=\"top25_feeds_btn\" |
a3c159c4 | 767 | onclick=\"javascript:browseFeeds()\" value=\"".__('Top 25')."\">"; |
ef8be8ea AD |
768 | } |
769 | ||
ef8be8ea AD |
770 | $feeds_sort = db_escape_string($_GET["sort"]); |
771 | ||
772 | if (!$feeds_sort || $feeds_sort == "undefined") { | |
773 | $feeds_sort = $_SESSION["pref_sort_feeds"]; | |
774 | if (!$feeds_sort) $feeds_sort = "title"; | |
775 | } | |
776 | ||
777 | $_SESSION["pref_sort_feeds"] = $feeds_sort; | |
778 | ||
779 | if ($feed_search) { | |
780 | $search_qpart = "(UPPER(F1.title) LIKE UPPER('%$feed_search%') OR | |
781 | UPPER(F1.feed_url) LIKE UPPER('%$feed_search%')) AND"; | |
782 | } else { | |
783 | $search_qpart = ""; | |
784 | } | |
785 | ||
400b60d8 AD |
786 | $show_last_article_info = false; |
787 | $show_last_article_checked = ""; | |
788 | $show_last_article_qpart = ""; | |
789 | ||
790 | if ($_GET["slat"] == "true") { | |
791 | $show_last_article_info = true; | |
792 | $show_last_article_checked = "checked"; | |
793 | $show_last_article_qpart = ", (SELECT SUBSTRING(MAX(updated),1,16) FROM ttrss_user_entries, | |
794 | ttrss_entries WHERE ref_id = ttrss_entries.id | |
795 | AND feed_id = F1.id) AS last_article"; | |
d2ca9130 AD |
796 | } else if ($feeds_sort == "last_article") { |
797 | $feeds_sort = "title"; | |
798 | } | |
799 | ||
800 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
801 | $order_by_qpart = "category,$feeds_sort,title"; | |
802 | } else { | |
803 | $order_by_qpart = "$feeds_sort,title"; | |
400b60d8 AD |
804 | } |
805 | ||
ef8be8ea AD |
806 | $result = db_query($link, "SELECT |
807 | F1.id, | |
808 | F1.title, | |
809 | F1.feed_url, | |
810 | substring(F1.last_updated,1,16) AS last_updated, | |
811 | F1.parent_feed, | |
812 | F1.update_interval, | |
365f95dc | 813 | F1.last_error, |
ef8be8ea AD |
814 | F1.purge_interval, |
815 | F1.cat_id, | |
816 | F2.title AS parent_title, | |
817 | C1.title AS category, | |
818 | F1.hidden, | |
400b60d8 AD |
819 | F1.include_in_digest |
820 | $show_last_article_qpart | |
ef8be8ea AD |
821 | FROM |
822 | ttrss_feeds AS F1 | |
823 | LEFT JOIN ttrss_feeds AS F2 | |
824 | ON (F1.parent_feed = F2.id) | |
825 | LEFT JOIN ttrss_feed_categories AS C1 | |
826 | ON (F1.cat_id = C1.id) | |
827 | WHERE | |
828 | $search_qpart F1.owner_uid = '".$_SESSION["uid"]."' | |
829 | ORDER by $order_by_qpart"); | |
830 | ||
831 | if (db_num_rows($result) != 0) { | |
832 | ||
833 | // print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>"; | |
834 | ||
835 | print "<p><table width=\"100%\" cellspacing=\"0\" | |
836 | class=\"prefFeedList\" id=\"prefFeedList\">"; | |
400b60d8 AD |
837 | print "<tr><td class=\"selectPrompt\" colspan=\"8\">". |
838 | "<div style='float : right'>". | |
839 | "<input id='show_last_article_times' type='checkbox' onchange='feedlistToggleSLAT()' | |
840 | $show_last_article_checked><label | |
841 | for='show_last_article_times'>".__('Show last article times')."</label></div>". | |
842 | __('Select:')." | |
e8d0177d AD |
843 | <a href=\"javascript:selectPrefRows('feed', true)\">".__('All')."</a>, |
844 | <a href=\"javascript:selectPrefRows('feed', false)\">".__('None')."</a> | |
ef8be8ea AD |
845 | </td</tr>"; |
846 | ||
847 | if (!get_pref($link, 'ENABLE_FEED_CATS')) { | |
848 | print "<tr class=\"title\"> | |
849 | <td width='5%' align='center'> </td>"; | |
850 | ||
851 | if (get_pref($link, 'ENABLE_FEED_ICONS')) { | |
852 | print "<td width='3%'> </td>"; | |
853 | } | |
854 | ||
c4b0f96c AD |
855 | print "<td width='60%'><a href=\"javascript:updateFeedList('title')\">".__('Title')."</a></td>"; |
856 | ||
857 | if ($show_last_article_info) { | |
858 | print "<td width='20%' align='right'><a href=\"javascript:updateFeedList('last_article')\">".__('Last Article')."</a></td>"; | |
859 | } | |
860 | ||
861 | print "<td width='20%' align='right'><a href=\"javascript:updateFeedList('last_updated')\">".__('Updated')."</a></td>"; | |
ef8be8ea AD |
862 | } |
863 | ||
864 | $lnum = 0; | |
865 | ||
866 | $cur_cat_id = -1; | |
867 | ||
868 | while ($line = db_fetch_assoc($result)) { | |
869 | ||
870 | $feed_id = $line["id"]; | |
871 | $cat_id = $line["cat_id"]; | |
872 | ||
47439031 AD |
873 | $edit_title = htmlspecialchars($line["title"]); |
874 | $edit_cat = htmlspecialchars($line["category"]); | |
ef8be8ea AD |
875 | |
876 | $hidden = sql_bool_to_bool($line["hidden"]); | |
877 | ||
365f95dc AD |
878 | $last_error = $line["last_error"]; |
879 | ||
3692e98f | 880 | if (!$edit_cat) $edit_cat = __("Uncategorized"); |
ef8be8ea AD |
881 | |
882 | $last_updated = $line["last_updated"]; | |
883 | ||
7a74abd5 AD |
884 | if (!$last_updated) { |
885 | $last_updated = "—"; | |
886 | } else if (get_pref($link, 'HEADLINES_SMART_DATE')) { | |
ef8be8ea AD |
887 | $last_updated = smart_date_time(strtotime($last_updated)); |
888 | } else { | |
889 | $short_date = get_pref($link, 'SHORT_DATE_FORMAT'); | |
890 | $last_updated = date($short_date, strtotime($last_updated)); | |
891 | } | |
892 | ||
893 | $last_article = $line["last_article"]; | |
894 | ||
7a74abd5 AD |
895 | if (!$last_article) { |
896 | $last_article = "—"; | |
897 | } else if (get_pref($link, 'HEADLINES_SMART_DATE')) { | |
ef8be8ea AD |
898 | $last_article = smart_date_time(strtotime($last_article)); |
899 | } else { | |
900 | $short_date = get_pref($link, 'SHORT_DATE_FORMAT'); | |
901 | $last_article = date($short_date, strtotime($last_article)); | |
902 | } | |
903 | ||
904 | if (get_pref($link, 'ENABLE_FEED_CATS') && $cur_cat_id != $cat_id) { | |
905 | $lnum = 0; | |
906 | ||
907 | print "<tr><td colspan=\"6\" class=\"feedEditCat\">$edit_cat</td></tr>"; | |
908 | ||
909 | print "<tr class=\"title\"> | |
910 | <td width='5%'> </td>"; | |
911 | ||
912 | if (get_pref($link, 'ENABLE_FEED_ICONS')) { | |
913 | print "<td width='3%'> </td>"; | |
914 | } | |
915 | ||
400b60d8 AD |
916 | print "<td width='60%'><a href=\"javascript:updateFeedList('title')\">".__('Title')."</a></td>"; |
917 | ||
918 | if ($show_last_article_info) { | |
919 | print "<td width='20%' align='right'> | |
920 | <a href=\"javascript:updateFeedList('last_article')\">".__('Last Article')."</a></td>"; | |
921 | } | |
922 | ||
923 | print "<td width='20%' align='right'> | |
924 | <a href=\"javascript:updateFeedList('last_updated')\">".__('Updated')."</a></td>"; | |
ef8be8ea AD |
925 | |
926 | $cur_cat_id = $cat_id; | |
927 | } | |
928 | ||
929 | $class = ($lnum % 2) ? "even" : "odd"; | |
930 | $this_row_id = "id=\"FEEDR-$feed_id\""; | |
931 | ||
932 | print "<tr class=\"$class\" $this_row_id>"; | |
933 | ||
934 | $icon_file = ICONS_DIR . "/$feed_id.ico"; | |
935 | ||
936 | if (file_exists($icon_file) && filesize($icon_file) > 0) { | |
937 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . "/$feed_id.ico\">"; | |
938 | } else { | |
939 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">"; | |
940 | } | |
941 | ||
942 | print "<td class='feedSelect'><input onclick='toggleSelectPrefRow(this, \"feed\");' | |
943 | type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>"; | |
944 | ||
945 | if (get_pref($link, 'ENABLE_FEED_ICONS')) { | |
946 | print "<td class='feedIcon'>$feed_icon</td>"; | |
947 | } | |
948 | ||
ef8be8ea AD |
949 | if ($hidden) { |
950 | $edit_title = "<span class=\"insensitive\">$edit_title (Hidden)</span>"; | |
ef8be8ea AD |
951 | $last_updated = "<span class=\"insensitive\">$last_updated</span>"; |
952 | $last_article = "<span class=\"insensitive\">$last_article</span>"; | |
365f95dc AD |
953 | } |
954 | ||
955 | if ($last_error) { | |
1fc77c25 | 956 | $edit_title = "<span class=\"feed_error\">$edit_title</span>"; |
365f95dc AD |
957 | $last_updated = "<span class=\"feed_error\">$last_updated</span>"; |
958 | $last_article = "<span class=\"feed_error\">$last_article</span>"; | |
ef8be8ea AD |
959 | } |
960 | ||
961 | $parent_title = $line["parent_title"]; | |
962 | if ($parent_title) { | |
963 | $parent_title = "<span class='groupPrompt'>(linked to | |
964 | $parent_title)</span>"; | |
965 | } | |
966 | ||
967 | print "<td><a href=\"javascript:editFeed($feed_id);\">" . | |
968 | "$edit_title $parent_title" . "</a></td>"; | |
ef8be8ea | 969 | |
400b60d8 AD |
970 | if ($show_last_article_info) { |
971 | print "<td align='right'><a href=\"javascript:editFeed($feed_id);\">" . | |
972 | "$last_article</a></td>"; | |
973 | } | |
ef8be8ea AD |
974 | |
975 | print "<td align='right'><a href=\"javascript:editFeed($feed_id);\">" . | |
976 | "$last_updated</a></td>"; | |
977 | ||
978 | print "</tr>"; | |
979 | ||
980 | ++$lnum; | |
981 | } | |
982 | ||
983 | print "</table>"; | |
984 | ||
e88a65f4 | 985 | print "<p>"; |
c4a36709 AD |
986 | |
987 | print "<select id=\"feedActionChooser\" onchange=\"feedActionChange()\"> | |
988 | <option value=\"facDefault\" selected>".__('Actions...')."</option> | |
989 | <option disabled>--------</option> | |
990 | <option style=\"color : #5050aa\" disabled>".__('Selection:')."</option> | |
991 | <option value=\"facEdit\"> ".__('Edit')."</option> | |
e88a65f4 | 992 | <option value=\"facPurge\"> ".__('Manual purge')."</option> |
c4a36709 AD |
993 | <option value=\"facClear\"> ".__('Clear feed data')."</option> |
994 | <option value=\"facUnsubscribe\"> ".__('Unsubscribe')."</option>"; | |
995 | ||
996 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
997 | ||
998 | print "<option disabled>--------</option> | |
999 | <option style=\"color : #5050aa\" disabled>".__('Other:')."</option> | |
1000 | <option value=\"facEditCats\"> ".__('Edit categories')." | |
1001 | </option>"; | |
1002 | } | |
1003 | ||
1004 | print "</select>"; | |
1005 | ||
e88a65f4 AD |
1006 | print "<span id=\"feedOpToolbar\">"; |
1007 | ||
c4a36709 | 1008 | /* print "<input type=\"submit\" class=\"button\" disabled=\"true\" |
a3c159c4 AD |
1009 | onclick=\"javascript:editSelectedFeed()\" value=\"".__('Edit')."\"> |
1010 | <input type=\"submit\" class=\"button\" disabled=\"true\" | |
1011 | onclick=\"javascript:removeSelectedFeeds()\" | |
c4a36709 | 1012 | value=\"".__('Unsubscribe')."\">"; */ |
ef8be8ea | 1013 | |
a3c159c4 | 1014 | if (get_pref($link, 'ENABLE_FEED_CATS')) { |
ef8be8ea | 1015 | |
e88a65f4 | 1016 | print " | " . __('Selection:') . " "; |
ef8be8ea | 1017 | |
a3c159c4 | 1018 | print_feed_cat_select($link, "sfeed_set_fcat", "", "disabled"); |
ef8be8ea | 1019 | |
a3c159c4 AD |
1020 | print " <input type=\"submit\" class=\"button\" disabled=\"true\" |
1021 | onclick=\"javascript:categorizeSelectedFeeds()\" value=\"". | |
1022 | __('Recategorize')."\">"; | |
1023 | } | |
ef8be8ea | 1024 | |
a3c159c4 | 1025 | print "</span>"; |
9c483746 | 1026 | |
e88a65f4 | 1027 | // if (get_pref($link, 'ENABLE_FEED_CATS')) { |
9c483746 | 1028 | |
c4a36709 | 1029 | /* print " <input type=\"submit\" class=\"button\" |
3692e98f | 1030 | onclick=\"javascript:editFeedCats()\" value=\"". |
c4a36709 | 1031 | __("Edit categories")."\">"; */ |
9c483746 | 1032 | |
a3c159c4 | 1033 | # print " | "; |
9c483746 | 1034 | |
e88a65f4 | 1035 | // } |
ef8be8ea AD |
1036 | } else { |
1037 | ||
6f5b1e04 | 1038 | // print "<p>No feeds defined.</p>"; |
ef8be8ea AD |
1039 | |
1040 | } | |
1041 | ||
a3c159c4 | 1042 | print "<h3>".__('OPML')."</h3> |
94a4ba88 AD |
1043 | |
1044 | <div style='float : left'> | |
ef8be8ea | 1045 | <form enctype=\"multipart/form-data\" method=\"POST\" action=\"opml.php\"> |
999703d1 AD |
1046 | ".__('File:')." <input id=\"opml_file\" name=\"opml_file\" type=\"file\"> |
1047 | <input type=\"hidden\" name=\"op\" value=\"Import\"> | |
1048 | <input class=\"button\" onclick=\"return validateOpmlImport();\" | |
a3c159c4 | 1049 | type=\"submit\" value=\"".__('Import')."\"> |
94a4ba88 AD |
1050 | </form></div>"; |
1051 | ||
3692e98f | 1052 | print " "; |
94a4ba88 AD |
1053 | |
1054 | print "<input type=\"submit\" | |
1055 | class=\"button\" onclick=\"gotoExportOpml()\" | |
a3c159c4 | 1056 | value=\"".__('Export OPML')."\">"; |
94a4ba88 | 1057 | |
e4f4b46f | 1058 | |
755a43ee AD |
1059 | print "<h3>" . __("Firefox Integration") . "</h3>"; |
1060 | ||
1061 | print "<p>" . __('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.'); | |
1062 | print "</p><p class=\"small\"> <a href='javascript:window.navigator.registerContentHandler(" . | |
1063 | "\"application/vnd.mozilla.maybe.feed\", " . | |
1064 | "\"" . add_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" . | |
1065 | __('Click here to register this site as a feed reader.') . "</a></p>"; | |
1066 | ||
1067 | ||
e400230e | 1068 | print "<h3>".__("Published articles")."</h3>"; |
e4f4b46f AD |
1069 | |
1070 | if (!get_pref($link, "_PREFS_PUBLISH_KEY")) { | |
1071 | set_pref($link, "_PREFS_PUBLISH_KEY", generate_publish_key()); | |
1072 | } | |
1073 | ||
1074 | print "<p>".__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the address specified below.')."</p>"; | |
1075 | ||
f56e3080 | 1076 | $url_path = article_publish_url($link); |
e4f4b46f | 1077 | |
945c243e | 1078 | print "<p class=\"small\"><a id=\"pubGenAddress\" target=\"_new\" href=\"$url_path\">$url_path</a></p>"; |
e4f4b46f AD |
1079 | |
1080 | print "<p><input type=\"submit\" onclick=\"return pubRegenKey()\" | |
1081 | value=\"".__('Generate another address')."\"></p>"; | |
1082 | ||
ef8be8ea AD |
1083 | } |
1084 | ?> |