]>
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". | |
104 | "$feed_icon " . db_unescape_string($details["title"]) . | |
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 | ||
133 | $title = htmlspecialchars(db_unescape_string(db_fetch_result($result, | |
134 | 0, "title"))); | |
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"); | |
162 | $feed_url = htmlspecialchars(db_unescape_string(db_fetch_result($result, | |
163 | 0, "feed_url"))); | |
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 | ||
262 | $auth_login = escape_for_form(db_fetch_result($result, 0, "auth_login")); | |
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 | ||
268 | $auth_pass = escape_for_form(db_fetch_result($result, 0, "auth_pass")); | |
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 AD |
320 | |
321 | print "</td></tr>"; | |
322 | ||
323 | print "</table>"; | |
324 | ||
325 | print "</form>"; | |
326 | ||
327 | print "<div align='right'> | |
328 | <input type=\"submit\" class=\"button\" | |
31cc42f6 | 329 | onclick=\"return feedEditSave()\" value=\"".__('Save')."\"> |
ef8be8ea | 330 | <input type='submit' class='button' |
31cc42f6 | 331 | onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\"></div>"; |
ef8be8ea AD |
332 | |
333 | print "</div>"; | |
334 | ||
335 | return; | |
336 | } | |
337 | ||
338 | if ($subop == "editSave") { | |
339 | ||
340 | $feed_title = db_escape_string(trim($_POST["title"])); | |
341 | $feed_link = db_escape_string(trim($_POST["feed_url"])); | |
342 | $upd_intl = db_escape_string($_POST["update_interval"]); | |
343 | $purge_intl = db_escape_string($_POST["purge_interval"]); | |
344 | $feed_id = db_escape_string($_POST["id"]); | |
345 | $cat_id = db_escape_string($_POST["cat_id"]); | |
346 | $auth_login = db_escape_string(trim($_POST["auth_login"])); | |
347 | $auth_pass = db_escape_string(trim($_POST["auth_pass"])); | |
348 | $parent_feed = db_escape_string($_POST["parent_feed"]); | |
349 | $private = checkbox_to_sql_bool(db_escape_string($_POST["private"])); | |
350 | $rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"])); | |
351 | $hidden = checkbox_to_sql_bool(db_escape_string($_POST["hidden"])); | |
352 | $include_in_digest = checkbox_to_sql_bool( | |
353 | db_escape_string($_POST["include_in_digest"])); | |
354 | ||
355 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
356 | if ($cat_id && $cat_id != 0) { | |
357 | $category_qpart = "cat_id = '$cat_id',"; | |
358 | $category_qpart_nocomma = "cat_id = '$cat_id'"; | |
359 | } else { | |
360 | $category_qpart = 'cat_id = NULL,'; | |
361 | $category_qpart_nocomma = 'cat_id = NULL'; | |
362 | } | |
363 | } else { | |
364 | $category_qpart = ""; | |
365 | $category_qpart_nocomma = ""; | |
366 | } | |
367 | ||
368 | if ($parent_feed && $parent_feed != 0) { | |
369 | $parent_qpart = "parent_feed = '$parent_feed'"; | |
370 | } else { | |
371 | $parent_qpart = 'parent_feed = NULL'; | |
372 | } | |
373 | ||
374 | $result = db_query($link, "UPDATE ttrss_feeds SET | |
375 | $category_qpart $parent_qpart, | |
376 | title = '$feed_title', feed_url = '$feed_link', | |
377 | update_interval = '$upd_intl', | |
378 | purge_interval = '$purge_intl', | |
379 | auth_login = '$auth_login', | |
380 | auth_pass = '$auth_pass', | |
381 | private = $private, | |
382 | rtl_content = $rtl_content, | |
383 | hidden = $hidden, | |
384 | include_in_digest = $include_in_digest | |
385 | WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]); | |
386 | ||
387 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
388 | # update linked feed categories | |
389 | $result = db_query($link, "UPDATE ttrss_feeds SET | |
390 | $category_qpart_nocomma WHERE parent_feed = '$feed_id' AND | |
391 | owner_uid = " . $_SESSION["uid"]); | |
392 | } | |
393 | } | |
394 | ||
ef8be8ea AD |
395 | if ($subop == "remove") { |
396 | ||
397 | if (!WEB_DEMO_MODE) { | |
398 | ||
399 | $ids = split(",", db_escape_string($_GET["ids"])); | |
400 | ||
401 | foreach ($ids as $id) { | |
402 | ||
403 | if ($id > 0) { | |
404 | ||
405 | db_query($link, "DELETE FROM ttrss_feeds | |
406 | WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]); | |
407 | ||
408 | $icons_dir = ICONS_DIR; | |
409 | ||
410 | if (file_exists($icons_dir . "/$id.ico")) { | |
411 | unlink($icons_dir . "/$id.ico"); | |
412 | } | |
413 | } else if ($id < -10) { | |
414 | ||
415 | $label_id = -$id - 11; | |
416 | ||
417 | db_query($link, "DELETE FROM ttrss_labels | |
418 | WHERE id = '$label_id' AND owner_uid = " . $_SESSION["uid"]); | |
419 | } | |
420 | } | |
421 | } | |
422 | } | |
423 | ||
424 | if ($subop == "add") { | |
425 | ||
426 | if (!WEB_DEMO_MODE) { | |
427 | ||
f27de515 AD |
428 | $feed_url = db_escape_string(trim($_REQUEST["feed_url"])); |
429 | $cat_id = db_escape_string($_REQUEST["cat_id"]); | |
430 | $p_from = db_escape_string($_REQUEST["from"]); | |
431 | ||
432 | /* only read authentication information from POST */ | |
433 | ||
434 | $auth_login = db_escape_string(trim($_POST["auth_login"])); | |
435 | $auth_pass = db_escape_string(trim($_POST["auth_pass"])); | |
aa2122d4 | 436 | |
e513a74a | 437 | if ($p_from != 'tt-rss') { |
aa2122d4 AD |
438 | print "<html> |
439 | <head> | |
440 | <title>Tiny Tiny RSS - Subscribe to feed...</title> | |
441 | <link rel=\"stylesheet\" type=\"text/css\" href=\"quicksub.css\"> | |
442 | </head> | |
443 | <body> | |
444 | <img class=\"logo\" src=\"images/ttrss_logo.png\" | |
445 | alt=\"Tiny Tiny RSS\"/> | |
e513a74a AD |
446 | <h1>Subscribe to feed...</h1> |
447 | <div class=\"content\">"; | |
aa2122d4 | 448 | } |
ef8be8ea | 449 | |
f27de515 | 450 | if (subscribe_to_feed($link, $feed_url, $cat_id, $auth_login, $auth_pass)) { |
4dccf1ed | 451 | print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url)); |
ef8be8ea | 452 | } else { |
4dccf1ed | 453 | print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url)); |
ef8be8ea | 454 | } |
aa2122d4 | 455 | |
e513a74a | 456 | if ($p_from != 'tt-rss') { |
aa2122d4 AD |
457 | $tt_uri = 'http://' . $_SERVER['SERVER_NAME'] . |
458 | preg_replace('/backend\.php.*$/', | |
459 | 'tt-rss.php', $_SERVER["REQUEST_URI"]); | |
460 | ||
e513a74a AD |
461 | $tp_uri = 'http://' . $_SERVER['SERVER_NAME'] . |
462 | preg_replace('/backend\.php.*$/', | |
463 | 'prefs.php', $_SERVER["REQUEST_URI"]); | |
464 | ||
465 | print "<p><a href='$tt_uri'>Return to Tiny Tiny RSS</a> |"; | |
466 | ||
467 | $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE | |
468 | feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]); | |
469 | ||
470 | $feed_id = db_fetch_result($result, 0, "id"); | |
471 | ||
472 | if ($feed_id) { | |
473 | print "<a href='$tp_uri?tab=feedConfig&subop=editFeed:$feed_id'> | |
474 | Edit subscription options</a> | "; | |
475 | } | |
476 | ||
477 | print "<a href='javascript:window.close()'>Close this window</a>.</p>"; | |
aa2122d4 | 478 | |
e513a74a | 479 | print "</div></body></html>"; |
aa2122d4 AD |
480 | return; |
481 | } | |
442d77f1 | 482 | |
ef8be8ea AD |
483 | } |
484 | } | |
485 | ||
ef8be8ea AD |
486 | if ($subop == "categorize") { |
487 | ||
488 | if (!WEB_DEMO_MODE) { | |
489 | ||
490 | $ids = split(",", db_escape_string($_GET["ids"])); | |
491 | ||
492 | $cat_id = db_escape_string($_GET["cat_id"]); | |
493 | ||
494 | if ($cat_id == 0) { | |
495 | $cat_id_qpart = 'NULL'; | |
496 | } else { | |
497 | $cat_id_qpart = "'$cat_id'"; | |
498 | } | |
499 | ||
500 | db_query($link, "BEGIN"); | |
501 | ||
502 | foreach ($ids as $id) { | |
503 | ||
504 | db_query($link, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart | |
505 | WHERE id = '$id' AND parent_feed IS NULL | |
506 | AND owner_uid = " . $_SESSION["uid"]); | |
507 | ||
508 | # update linked feed categories | |
509 | db_query($link, "UPDATE ttrss_feeds SET | |
510 | cat_id = $cat_id_qpart WHERE parent_feed = '$id' AND | |
511 | owner_uid = " . $_SESSION["uid"]); | |
512 | ||
513 | } | |
514 | ||
515 | db_query($link, "COMMIT"); | |
516 | } | |
517 | ||
518 | } | |
519 | ||
9c483746 AD |
520 | if ($subop == "editCats") { |
521 | ||
31cc42f6 | 522 | print "<div id=\"infoBoxTitle\">".__('Category editor')."</div>"; |
9c483746 AD |
523 | |
524 | print "<div class=\"infoBoxContents\">"; | |
525 | ||
526 | $action = $_REQUEST["action"]; | |
527 | ||
528 | if ($action == "save") { | |
529 | ||
530 | $cat_title = db_escape_string(trim($_GET["title"])); | |
531 | $cat_id = db_escape_string($_GET["id"]); | |
532 | ||
533 | $result = db_query($link, "UPDATE ttrss_feed_categories SET | |
534 | title = '$cat_title' WHERE id = '$cat_id' AND owner_uid = ".$_SESSION["uid"]); | |
535 | ||
536 | } | |
537 | ||
538 | if ($action == "add") { | |
539 | ||
540 | if (!WEB_DEMO_MODE) { | |
541 | ||
542 | $feed_cat = db_escape_string(trim($_GET["cat"])); | |
543 | ||
544 | $result = db_query($link, | |
545 | "SELECT id FROM ttrss_feed_categories | |
546 | WHERE title = '$feed_cat' AND owner_uid = ".$_SESSION["uid"]); | |
547 | ||
548 | if (db_num_rows($result) == 0) { | |
549 | ||
550 | $result = db_query($link, | |
551 | "INSERT INTO ttrss_feed_categories (owner_uid,title) | |
552 | VALUES ('".$_SESSION["uid"]."', '$feed_cat')"); | |
553 | ||
554 | } else { | |
555 | ||
4dccf1ed AD |
556 | print_warning(T_sprintf("Category <b>$%s</b> already exists in the database.", |
557 | $feed_cat)); | |
9c483746 AD |
558 | } |
559 | ||
560 | } | |
561 | } | |
562 | ||
563 | if ($action == "remove") { | |
564 | ||
565 | if (!WEB_DEMO_MODE) { | |
566 | ||
567 | $ids = split(",", db_escape_string($_GET["ids"])); | |
568 | ||
569 | foreach ($ids as $id) { | |
570 | ||
571 | db_query($link, "BEGIN"); | |
572 | ||
573 | $result = db_query($link, | |
574 | "SELECT count(id) as num_feeds FROM ttrss_feeds | |
575 | WHERE cat_id = '$id'"); | |
576 | ||
577 | $num_feeds = db_fetch_result($result, 0, "num_feeds"); | |
578 | ||
579 | if ($num_feeds == 0) { | |
580 | db_query($link, "DELETE FROM ttrss_feed_categories | |
581 | WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]); | |
582 | } else { | |
583 | ||
31cc42f6 | 584 | print format_warning(__("Unable to delete non empty feed categories.")); |
9c483746 AD |
585 | |
586 | } | |
587 | ||
588 | db_query($link, "COMMIT"); | |
589 | } | |
590 | } | |
591 | } | |
592 | ||
593 | print "<div class=\"prefGenericAddBox\"> | |
594 | <input id=\"fadd_cat\" | |
1043a8c3 | 595 | onkeypress=\"return filterCR(event, addFeedCat)\" |
9c483746 | 596 | onkeyup=\"toggleSubmitNotEmpty(this, 'catadd_submit_btn')\" |
b5015f72 | 597 | onchange=\"toggleSubmitNotEmpty(this, 'catadd_submit_btn')\" |
9c483746 AD |
598 | size=\"40\"> |
599 | <input | |
600 | type=\"submit\" class=\"button\" disabled=\"true\" id=\"catadd_submit_btn\" | |
31cc42f6 | 601 | onclick=\"javascript:addFeedCat()\" value=\"".__('Create category')."\"></div>"; |
9c483746 AD |
602 | |
603 | $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories | |
604 | WHERE owner_uid = ".$_SESSION["uid"]." | |
605 | ORDER BY title"); | |
606 | ||
607 | print "<p>"; | |
608 | ||
609 | if (db_num_rows($result) != 0) { | |
610 | ||
611 | print "<table width=\"100%\" class=\"prefFeedCatList\" | |
612 | cellspacing=\"0\">"; | |
613 | ||
614 | print "<tr><td class=\"selectPrompt\" colspan=\"8\"> | |
e8d0177d AD |
615 | ".__('Select:')." |
616 | <a href=\"javascript:selectPrefRows('fcat', true)\">".__('All')."</a>, | |
617 | <a href=\"javascript:selectPrefRows('fcat', false)\">".__('None')."</a> | |
9c483746 AD |
618 | </td></tr>"; |
619 | ||
620 | print "</table>"; | |
621 | ||
622 | print "<div class=\"prefFeedCatHolder\">"; | |
623 | ||
e6312f6c | 624 | print "<form id=\"feed_cat_edit_form\" onsubmit=\"return false\">"; |
9c483746 AD |
625 | |
626 | print "<table width=\"100%\" class=\"prefFeedCatList\" | |
627 | cellspacing=\"0\" id=\"prefFeedCatList\">"; | |
628 | ||
629 | /* print "<tr class=\"title\"> | |
630 | <td width=\"5%\"> </td><td width=\"80%\">Title</td> | |
631 | </tr>"; */ | |
632 | ||
633 | $lnum = 0; | |
634 | ||
635 | while ($line = db_fetch_assoc($result)) { | |
636 | ||
637 | $class = ($lnum % 2) ? "even" : "odd"; | |
638 | ||
639 | $cat_id = $line["id"]; | |
640 | ||
641 | $edit_cat_id = $_GET["id"]; | |
81780e8f AD |
642 | |
643 | if ($action == "edit" && $cat_id == $edit_cat_id) { | |
644 | $class .= "Selected"; | |
645 | $this_row_id = ""; | |
646 | } else if ($action == "edit" && $cat_id != $edit_cat_id) { | |
647 | $class .= "Grayed"; | |
648 | $this_row_id = ""; | |
9c483746 AD |
649 | } else { |
650 | $this_row_id = "id=\"FCATR-$cat_id\""; | |
651 | } | |
652 | ||
653 | print "<tr class=\"$class\" $this_row_id>"; | |
654 | ||
655 | $edit_title = htmlspecialchars(db_unescape_string($line["title"])); | |
656 | ||
657 | if (!$edit_cat_id || $action != "edit") { | |
658 | ||
b5015f72 AD |
659 | print "<td width='5%' align='center'><input |
660 | onclick='toggleSelectPrefRow(this, \"fcat\");' | |
9c483746 AD |
661 | type=\"checkbox\" id=\"FCCHK-".$line["id"]."\"></td>"; |
662 | ||
663 | print "<td><a href=\"javascript:editFeedCat($cat_id);\">" . | |
664 | $edit_title . "</a></td>"; | |
665 | ||
666 | } else if ($cat_id != $edit_cat_id) { | |
667 | ||
668 | print "<td width='5%' align='center'><input disabled=\"true\" type=\"checkbox\" | |
669 | id=\"FRCHK-".$line["id"]."\"></td>"; | |
670 | ||
671 | print "<td>$edit_title</td>"; | |
672 | ||
673 | } else { | |
674 | ||
675 | print "<td width='5%' align='center'><input disabled=\"true\" type=\"checkbox\" checked>"; | |
676 | ||
677 | print "<input type=\"hidden\" name=\"id\" value=\"$cat_id\">"; | |
678 | print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">"; | |
679 | print "<input type=\"hidden\" name=\"subop\" value=\"editCats\">"; | |
680 | print "<input type=\"hidden\" name=\"action\" value=\"save\">"; | |
681 | ||
682 | print "</td>"; | |
683 | ||
1043a8c3 | 684 | print "<td><input onkeypress=\"return filterCR(event, feedCatEditSave)\" |
9c483746 AD |
685 | name=\"title\" size=\"40\" value=\"$edit_title\"></td>"; |
686 | ||
687 | } | |
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 | |
6f5b1e04 AD |
710 | if ($action == "edit") { |
711 | print "<input type=\"submit\" class=\"button\" | |
31cc42f6 | 712 | onclick=\"return feedCatEditSave()\" value=\"".__('Save')."\"> |
6f5b1e04 | 713 | <input type=\"submit\" class=\"button\" |
31cc42f6 | 714 | onclick=\"return feedCatEditCancel()\" value=\"".__('Cancel')."\">"; |
9c483746 | 715 | } else { |
6f5b1e04 AD |
716 | |
717 | print " | |
718 | <input type=\"submit\" class=\"button\" disabled=\"true\" | |
31cc42f6 | 719 | onclick=\"return editSelectedFeedCat()\" value=\"".__('Edit')."\"> |
6f5b1e04 | 720 | <input type=\"submit\" class=\"button\" disabled=\"true\" |
31cc42f6 | 721 | onclick=\"return removeSelectedFeedCats()\" value=\"".__('Remove')."\">"; |
9c483746 AD |
722 | } |
723 | ||
724 | print "</div>"; | |
725 | ||
6f5b1e04 AD |
726 | print "</div>"; |
727 | ||
9c483746 AD |
728 | return; |
729 | ||
730 | } | |
731 | ||
ef8be8ea AD |
732 | if ($quiet) return; |
733 | ||
442d77f1 AD |
734 | set_pref($link, "_PREFS_ACTIVE_TAB", "feedConfig"); |
735 | ||
a3656a41 | 736 | $result = db_query($link, "SELECT COUNT(id) AS num_errors |
ef8be8ea AD |
737 | FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); |
738 | ||
a3656a41 | 739 | $num_errors = db_fetch_result($result, 0, "num_errors"); |
ef8be8ea | 740 | |
a3656a41 | 741 | if ($num_errors > 0) { |
ef8be8ea | 742 | |
31cc42f6 AD |
743 | print format_notice("<a href=\"javascript:showFeedsWithErrors()\">". |
744 | __('Some feeds have update errors (click for details)')."</a>"); | |
ef8be8ea AD |
745 | } |
746 | ||
747 | $feed_search = db_escape_string($_GET["search"]); | |
748 | ||
749 | if (array_key_exists("search", $_GET)) { | |
750 | $_SESSION["prefs_feed_search"] = $feed_search; | |
751 | } else { | |
752 | $feed_search = $_SESSION["prefs_feed_search"]; | |
753 | } | |
754 | ||
755 | print "<div class=\"feedEditSearch\"> | |
756 | <input id=\"feed_search\" size=\"20\" | |
757 | onchange=\"javascript:updateFeedList()\" value=\"$feed_search\"> | |
758 | <input type=\"submit\" class=\"button\" | |
a3c159c4 | 759 | onclick=\"javascript:updateFeedList()\" value=\"".__('Search')."\"> |
ef8be8ea | 760 | </div>"; |
5e6f933a | 761 | |
442d77f1 | 762 | /* print "<input id=\"fadd_link\" |
ef8be8ea | 763 | onkeyup=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\" |
b5015f72 | 764 | onchange=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\" |
ef8be8ea AD |
765 | size=\"40\"> |
766 | <input type=\"submit\" class=\"button\" | |
767 | disabled=\"true\" id=\"fadd_submit_btn\" | |
442d77f1 AD |
768 | onclick=\"addFeed()\" value=\"".__('Subscribe')."\">"; */ |
769 | ||
770 | print "<input onclick=\"javascript:displayDlg('quickAddFeed')\" | |
a349077c | 771 | type=\"submit\" id=\"subscribe_to_feed_btn\" |
442d77f1 | 772 | class=\"button\" value=\"".__('Subscribe to feed')."\">"; |
ef8be8ea AD |
773 | |
774 | if (ENABLE_FEED_BROWSER && !SINGLE_USER_MODE) { | |
775 | print " <input type=\"submit\" class=\"button\" | |
a349077c | 776 | id=\"top25_feeds_btn\" |
a3c159c4 | 777 | onclick=\"javascript:browseFeeds()\" value=\"".__('Top 25')."\">"; |
ef8be8ea AD |
778 | } |
779 | ||
ef8be8ea AD |
780 | $feeds_sort = db_escape_string($_GET["sort"]); |
781 | ||
782 | if (!$feeds_sort || $feeds_sort == "undefined") { | |
783 | $feeds_sort = $_SESSION["pref_sort_feeds"]; | |
784 | if (!$feeds_sort) $feeds_sort = "title"; | |
785 | } | |
786 | ||
787 | $_SESSION["pref_sort_feeds"] = $feeds_sort; | |
788 | ||
789 | if ($feed_search) { | |
790 | $search_qpart = "(UPPER(F1.title) LIKE UPPER('%$feed_search%') OR | |
791 | UPPER(F1.feed_url) LIKE UPPER('%$feed_search%')) AND"; | |
792 | } else { | |
793 | $search_qpart = ""; | |
794 | } | |
795 | ||
400b60d8 AD |
796 | $show_last_article_info = false; |
797 | $show_last_article_checked = ""; | |
798 | $show_last_article_qpart = ""; | |
799 | ||
800 | if ($_GET["slat"] == "true") { | |
801 | $show_last_article_info = true; | |
802 | $show_last_article_checked = "checked"; | |
803 | $show_last_article_qpart = ", (SELECT SUBSTRING(MAX(updated),1,16) FROM ttrss_user_entries, | |
804 | ttrss_entries WHERE ref_id = ttrss_entries.id | |
805 | AND feed_id = F1.id) AS last_article"; | |
d2ca9130 AD |
806 | } else if ($feeds_sort == "last_article") { |
807 | $feeds_sort = "title"; | |
808 | } | |
809 | ||
810 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
811 | $order_by_qpart = "category,$feeds_sort,title"; | |
812 | } else { | |
813 | $order_by_qpart = "$feeds_sort,title"; | |
400b60d8 AD |
814 | } |
815 | ||
ef8be8ea AD |
816 | $result = db_query($link, "SELECT |
817 | F1.id, | |
818 | F1.title, | |
819 | F1.feed_url, | |
820 | substring(F1.last_updated,1,16) AS last_updated, | |
821 | F1.parent_feed, | |
822 | F1.update_interval, | |
365f95dc | 823 | F1.last_error, |
ef8be8ea AD |
824 | F1.purge_interval, |
825 | F1.cat_id, | |
826 | F2.title AS parent_title, | |
827 | C1.title AS category, | |
828 | F1.hidden, | |
400b60d8 AD |
829 | F1.include_in_digest |
830 | $show_last_article_qpart | |
ef8be8ea AD |
831 | FROM |
832 | ttrss_feeds AS F1 | |
833 | LEFT JOIN ttrss_feeds AS F2 | |
834 | ON (F1.parent_feed = F2.id) | |
835 | LEFT JOIN ttrss_feed_categories AS C1 | |
836 | ON (F1.cat_id = C1.id) | |
837 | WHERE | |
838 | $search_qpart F1.owner_uid = '".$_SESSION["uid"]."' | |
839 | ORDER by $order_by_qpart"); | |
840 | ||
841 | if (db_num_rows($result) != 0) { | |
842 | ||
843 | // print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>"; | |
844 | ||
845 | print "<p><table width=\"100%\" cellspacing=\"0\" | |
846 | class=\"prefFeedList\" id=\"prefFeedList\">"; | |
400b60d8 AD |
847 | print "<tr><td class=\"selectPrompt\" colspan=\"8\">". |
848 | "<div style='float : right'>". | |
849 | "<input id='show_last_article_times' type='checkbox' onchange='feedlistToggleSLAT()' | |
850 | $show_last_article_checked><label | |
851 | for='show_last_article_times'>".__('Show last article times')."</label></div>". | |
852 | __('Select:')." | |
e8d0177d AD |
853 | <a href=\"javascript:selectPrefRows('feed', true)\">".__('All')."</a>, |
854 | <a href=\"javascript:selectPrefRows('feed', false)\">".__('None')."</a> | |
ef8be8ea AD |
855 | </td</tr>"; |
856 | ||
857 | if (!get_pref($link, 'ENABLE_FEED_CATS')) { | |
858 | print "<tr class=\"title\"> | |
859 | <td width='5%' align='center'> </td>"; | |
860 | ||
861 | if (get_pref($link, 'ENABLE_FEED_ICONS')) { | |
862 | print "<td width='3%'> </td>"; | |
863 | } | |
864 | ||
c4b0f96c AD |
865 | print "<td width='60%'><a href=\"javascript:updateFeedList('title')\">".__('Title')."</a></td>"; |
866 | ||
867 | if ($show_last_article_info) { | |
868 | print "<td width='20%' align='right'><a href=\"javascript:updateFeedList('last_article')\">".__('Last Article')."</a></td>"; | |
869 | } | |
870 | ||
871 | print "<td width='20%' align='right'><a href=\"javascript:updateFeedList('last_updated')\">".__('Updated')."</a></td>"; | |
ef8be8ea AD |
872 | } |
873 | ||
874 | $lnum = 0; | |
875 | ||
876 | $cur_cat_id = -1; | |
877 | ||
878 | while ($line = db_fetch_assoc($result)) { | |
879 | ||
880 | $feed_id = $line["id"]; | |
881 | $cat_id = $line["cat_id"]; | |
882 | ||
883 | $edit_title = htmlspecialchars(db_unescape_string($line["title"])); | |
ef8be8ea AD |
884 | $edit_cat = htmlspecialchars(db_unescape_string($line["category"])); |
885 | ||
886 | $hidden = sql_bool_to_bool($line["hidden"]); | |
887 | ||
365f95dc AD |
888 | $last_error = $line["last_error"]; |
889 | ||
3692e98f | 890 | if (!$edit_cat) $edit_cat = __("Uncategorized"); |
ef8be8ea AD |
891 | |
892 | $last_updated = $line["last_updated"]; | |
893 | ||
7a74abd5 AD |
894 | if (!$last_updated) { |
895 | $last_updated = "—"; | |
896 | } else if (get_pref($link, 'HEADLINES_SMART_DATE')) { | |
ef8be8ea AD |
897 | $last_updated = smart_date_time(strtotime($last_updated)); |
898 | } else { | |
899 | $short_date = get_pref($link, 'SHORT_DATE_FORMAT'); | |
900 | $last_updated = date($short_date, strtotime($last_updated)); | |
901 | } | |
902 | ||
903 | $last_article = $line["last_article"]; | |
904 | ||
7a74abd5 AD |
905 | if (!$last_article) { |
906 | $last_article = "—"; | |
907 | } else if (get_pref($link, 'HEADLINES_SMART_DATE')) { | |
ef8be8ea AD |
908 | $last_article = smart_date_time(strtotime($last_article)); |
909 | } else { | |
910 | $short_date = get_pref($link, 'SHORT_DATE_FORMAT'); | |
911 | $last_article = date($short_date, strtotime($last_article)); | |
912 | } | |
913 | ||
914 | if (get_pref($link, 'ENABLE_FEED_CATS') && $cur_cat_id != $cat_id) { | |
915 | $lnum = 0; | |
916 | ||
917 | print "<tr><td colspan=\"6\" class=\"feedEditCat\">$edit_cat</td></tr>"; | |
918 | ||
919 | print "<tr class=\"title\"> | |
920 | <td width='5%'> </td>"; | |
921 | ||
922 | if (get_pref($link, 'ENABLE_FEED_ICONS')) { | |
923 | print "<td width='3%'> </td>"; | |
924 | } | |
925 | ||
400b60d8 AD |
926 | print "<td width='60%'><a href=\"javascript:updateFeedList('title')\">".__('Title')."</a></td>"; |
927 | ||
928 | if ($show_last_article_info) { | |
929 | print "<td width='20%' align='right'> | |
930 | <a href=\"javascript:updateFeedList('last_article')\">".__('Last Article')."</a></td>"; | |
931 | } | |
932 | ||
933 | print "<td width='20%' align='right'> | |
934 | <a href=\"javascript:updateFeedList('last_updated')\">".__('Updated')."</a></td>"; | |
ef8be8ea AD |
935 | |
936 | $cur_cat_id = $cat_id; | |
937 | } | |
938 | ||
939 | $class = ($lnum % 2) ? "even" : "odd"; | |
940 | $this_row_id = "id=\"FEEDR-$feed_id\""; | |
941 | ||
942 | print "<tr class=\"$class\" $this_row_id>"; | |
943 | ||
944 | $icon_file = ICONS_DIR . "/$feed_id.ico"; | |
945 | ||
946 | if (file_exists($icon_file) && filesize($icon_file) > 0) { | |
947 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . "/$feed_id.ico\">"; | |
948 | } else { | |
949 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">"; | |
950 | } | |
951 | ||
952 | print "<td class='feedSelect'><input onclick='toggleSelectPrefRow(this, \"feed\");' | |
953 | type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>"; | |
954 | ||
955 | if (get_pref($link, 'ENABLE_FEED_ICONS')) { | |
956 | print "<td class='feedIcon'>$feed_icon</td>"; | |
957 | } | |
958 | ||
ef8be8ea AD |
959 | if ($hidden) { |
960 | $edit_title = "<span class=\"insensitive\">$edit_title (Hidden)</span>"; | |
ef8be8ea AD |
961 | $last_updated = "<span class=\"insensitive\">$last_updated</span>"; |
962 | $last_article = "<span class=\"insensitive\">$last_article</span>"; | |
365f95dc AD |
963 | } |
964 | ||
965 | if ($last_error) { | |
966 | $edit_title = "<span class=\"feed_error\">$edit_title ($last_error)</span>"; | |
967 | $last_updated = "<span class=\"feed_error\">$last_updated</span>"; | |
968 | $last_article = "<span class=\"feed_error\">$last_article</span>"; | |
ef8be8ea AD |
969 | } |
970 | ||
971 | $parent_title = $line["parent_title"]; | |
972 | if ($parent_title) { | |
973 | $parent_title = "<span class='groupPrompt'>(linked to | |
974 | $parent_title)</span>"; | |
975 | } | |
976 | ||
977 | print "<td><a href=\"javascript:editFeed($feed_id);\">" . | |
978 | "$edit_title $parent_title" . "</a></td>"; | |
ef8be8ea | 979 | |
400b60d8 AD |
980 | if ($show_last_article_info) { |
981 | print "<td align='right'><a href=\"javascript:editFeed($feed_id);\">" . | |
982 | "$last_article</a></td>"; | |
983 | } | |
ef8be8ea AD |
984 | |
985 | print "<td align='right'><a href=\"javascript:editFeed($feed_id);\">" . | |
986 | "$last_updated</a></td>"; | |
987 | ||
988 | print "</tr>"; | |
989 | ||
990 | ++$lnum; | |
991 | } | |
992 | ||
993 | print "</table>"; | |
994 | ||
995 | print "<p><span id=\"feedOpToolbar\">"; | |
996 | ||
a3c159c4 AD |
997 | print "<input type=\"submit\" class=\"button\" disabled=\"true\" |
998 | onclick=\"javascript:editSelectedFeed()\" value=\"".__('Edit')."\"> | |
999 | <input type=\"submit\" class=\"button\" disabled=\"true\" | |
1000 | onclick=\"javascript:removeSelectedFeeds()\" | |
1001 | value=\"".__('Unsubscribe')."\">"; | |
ef8be8ea | 1002 | |
a3c159c4 | 1003 | if (get_pref($link, 'ENABLE_FEED_CATS')) { |
ef8be8ea | 1004 | |
a3c159c4 | 1005 | print " | "; |
ef8be8ea | 1006 | |
a3c159c4 | 1007 | print_feed_cat_select($link, "sfeed_set_fcat", "", "disabled"); |
ef8be8ea | 1008 | |
a3c159c4 AD |
1009 | print " <input type=\"submit\" class=\"button\" disabled=\"true\" |
1010 | onclick=\"javascript:categorizeSelectedFeeds()\" value=\"". | |
1011 | __('Recategorize')."\">"; | |
1012 | } | |
ef8be8ea | 1013 | |
a3c159c4 | 1014 | print "</span>"; |
9c483746 | 1015 | |
a3c159c4 | 1016 | if (get_pref($link, 'ENABLE_FEED_CATS')) { |
9c483746 | 1017 | |
a3c159c4 | 1018 | print " <input type=\"submit\" class=\"button\" |
3692e98f AD |
1019 | onclick=\"javascript:editFeedCats()\" value=\"". |
1020 | __("Edit categories")."\">"; | |
9c483746 | 1021 | |
a3c159c4 | 1022 | # print " | "; |
9c483746 | 1023 | |
ef8be8ea AD |
1024 | } |
1025 | } else { | |
1026 | ||
6f5b1e04 | 1027 | // print "<p>No feeds defined.</p>"; |
ef8be8ea AD |
1028 | |
1029 | } | |
1030 | ||
a3c159c4 | 1031 | print "<h3>".__('OPML')."</h3> |
94a4ba88 AD |
1032 | |
1033 | <div style='float : left'> | |
ef8be8ea AD |
1034 | <form enctype=\"multipart/form-data\" method=\"POST\" action=\"opml.php\"> |
1035 | File: <input id=\"opml_file\" name=\"opml_file\" type=\"file\"> | |
1036 | <input class=\"button\" name=\"op\" onclick=\"return validateOpmlImport();\" | |
a3c159c4 | 1037 | type=\"submit\" value=\"".__('Import')."\"> |
94a4ba88 AD |
1038 | </form></div>"; |
1039 | ||
3692e98f | 1040 | print " "; |
94a4ba88 AD |
1041 | |
1042 | print "<input type=\"submit\" | |
1043 | class=\"button\" onclick=\"gotoExportOpml()\" | |
a3c159c4 | 1044 | value=\"".__('Export OPML')."\">"; |
94a4ba88 | 1045 | |
ef8be8ea AD |
1046 | } |
1047 | ?> |