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