]>
git.wh0rd.org - tt-rss.git/blob - modules/pref-feeds.php
d83a1a25b54f5fa9ea8c633d245ad9fb98a12139
3 function batch_edit_cbox ( $elem , $label = false ) {
4 print "<input type= \" checkbox \" title= \" " . __ ( "Check to enable field" ). " \"
5 onchange= \" batchFeedsToggleField(this, ' $elem ', ' $label ') \" >" ;
8 function module_pref_feeds ( $link ) {
10 global $update_intervals ;
11 global $purge_intervals ;
12 global $update_methods ;
14 $subop = $_REQUEST [ "subop" ];
15 $quiet = $_REQUEST [ "quiet" ];
16 $mode = $_REQUEST [ "mode" ];
18 if ( $subop == "removeicon" ) {
19 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
21 $result = db_query ( $link , "SELECT id FROM ttrss_feeds
22 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
24 if ( db_num_rows ( $result ) != 0 ) {
25 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
31 if ( $subop == "uploadicon" ) {
32 $icon_file = $_FILES [ 'icon_file' ][ 'tmp_name' ];
33 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
35 if ( is_file ( $icon_file ) && $feed_id ) {
36 if ( filesize ( $icon_file ) < 20000 ) {
38 $result = db_query ( $link , "SELECT id FROM ttrss_feeds
39 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
41 if ( db_num_rows ( $result ) != 0 ) {
42 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
43 move_uploaded_file ( $icon_file , ICONS_DIR
. "/ $feed_id .ico" );
55 print "<script type= \" text/javascript \" >" ;
56 print "parent.uploadIconHandler( $rc );" ;
61 /* if ($subop == "massSubscribe") {
62 $ids = split(",", db_escape_string($_REQUEST["ids"]));
64 $subscribed = array();
66 foreach ($ids as $id) {
69 $result = db_query($link, "SELECT feed_url,title FROM ttrss_feeds
71 } else if ($mode == 2) {
72 $result = db_query($link, "SELECT * FROM ttrss_archived_feeds
73 WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]);
74 $orig_id = db_escape_string(db_fetch_result($result, 0, "id"));
75 $site_url = db_escape_string(db_fetch_result($result, 0, "site_url"));
78 $feed_url = db_escape_string(db_fetch_result($result, 0, "feed_url"));
79 $title = db_escape_string(db_fetch_result($result, 0, "title"));
81 $title_orig = db_fetch_result($result, 0, "title");
83 $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE
84 feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]);
86 if (db_num_rows($result) == 0) {
88 $result = db_query($link,
89 "INSERT INTO ttrss_feeds (owner_uid,feed_url,title,cat_id)
90 VALUES ('".$_SESSION["uid"]."', '$feed_url', '$title', NULL)");
91 } else if ($mode == 2) {
92 $result = db_query($link,
93 "INSERT INTO ttrss_feeds (id,owner_uid,feed_url,title,cat_id,site_url)
94 VALUES ('$orig_id','".$_SESSION["uid"]."', '$feed_url', '$title', NULL, '$site_url')");
96 array_push($subscribed, $title_orig);
100 if (count($subscribed) > 0) {
101 $msg = "<b>".__('Subscribed to feeds:')."</b>".
102 "<ul class=\"nomarks\">";
104 foreach ($subscribed as $title) {
105 $msg .= "<li>$title</li>";
109 print format_notice($msg);
115 /* if ($subop == "browse") {
117 print "<div id=\"infoBoxTitle\">".__('Feed Browser')."</div>";
119 print "<div class=\"infoBoxContents\">";
121 $browser_search = db_escape_string($_REQUEST["search"]);
123 //print "<p>".__("Showing top 25 registered feeds, sorted by popularity:")."</p>";
125 print "<form onsubmit='return false;' display='inline' name='feed_browser' id='feed_browser'>";
128 <div style='float : right'>
129 <img style='display : none'
130 id='feed_browser_spinner' src='images/indicator_white.gif'>
131 <input name=\"search\" size=\"20\" type=\"search\"
132 onchange=\"javascript:updateFeedBrowser()\" value=\"$browser_search\">
133 <button onclick=\"javascript:updateFeedBrowser()\">".__('Search')."</button>
136 print " <select name=\"mode\" onchange=\"updateFeedBrowser()\">
137 <option value='1'>" . __('Popular feeds') . "</option>
138 <option value='2'>" . __('Feed archive') . "</option>
143 print " <select name=\"limit\" onchange='updateFeedBrowser()'>";
145 foreach (array(25, 50, 100, 200) as $l) {
146 $issel = ($l == $limit) ? "selected" : "";
147 print "<option $issel>$l</option>";
154 $owner_uid = $_SESSION["uid"];
156 print "<ul class='browseFeedList' id='browseFeedList'>";
157 print_feed_browser($link, $search, 25);
160 print "<div align='center'>
161 <button onclick=\"feedBrowserSubscribe()\">".__('Subscribe')."</button>
162 <button onclick=\"closeInfoBox()\" >".__('Cancel')."</button></div>";
168 if ( $subop == "editfeed" ) {
169 $feed_id = db_escape_string ( $_REQUEST [ "id" ]);
171 $result = db_query ( $link ,
172 "SELECT * FROM ttrss_feeds WHERE id = ' $feed_id ' AND
173 owner_uid = " . $_SESSION [ "uid" ]);
175 $title = htmlspecialchars ( db_fetch_result ( $result ,
178 $icon_file = ICONS_DIR
. "/ $feed_id .ico" ;
180 if ( file_exists ( $icon_file ) && filesize ( $icon_file ) > 0 ) {
181 $feed_icon = "<img width= \" 16 \" height= \" 16 \"
182 src= \" " . ICONS_URL
. "/ $feed_id .ico \" >" ;
187 print "<div id= \" infoBoxTitle \" >" . __ ( 'Feed Editor' ). "</div>" ;
189 print "<div class= \" infoBoxContents \" >" ;
191 print "<form id= \" edit_feed_form \" onsubmit= \" return false \" >" ;
193 print "<input type= \" hidden \" name= \" id \" value= \" $feed_id\" >" ;
194 print "<input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >" ;
195 print "<input type= \" hidden \" name= \" subop \" value= \" editSave \" >" ;
197 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
198 print "<div class= \" dlgSecCont \" >" ;
202 print "<input style= \" font-size : 16px \" size= \" 40 \" onkeypress= \" return filterCR(event, feedEditSave) \"
203 name= \" title \" value= \" $title\" >" ;
207 $feed_url = db_fetch_result ( $result , 0 , "feed_url" );
208 $feed_url = htmlspecialchars ( db_fetch_result ( $result ,
213 print __ ( 'URL:' ) . " " ;
214 print "<input size= \" 40 \" onkeypress= \" return filterCR(event, feedEditSave) \"
215 name= \" feed_url \" value= \" $feed_url\" >" ;
219 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
221 $cat_id = db_fetch_result ( $result , 0 , "cat_id" );
225 print __ ( 'Place in category:' ) . " " ;
227 print_feed_cat_select ( $link , "cat_id" , $cat_id , $disabled );
232 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
233 print "<div class= \" dlgSecCont \" >" ;
235 /* Update Interval */
237 $update_interval = db_fetch_result ( $result , 0 , "update_interval" );
239 print_select_hash ( "update_interval" , $update_interval , $update_intervals );
243 $update_method = db_fetch_result ( $result , 0 , "update_method" );
245 print " " . __ ( 'using' ) . " " ;
246 print_select_hash ( "update_method" , $update_method , $update_methods );
248 $purge_interval = db_fetch_result ( $result , 0 , "purge_interval" );
250 if ( FORCE_ARTICLE_PURGE
== 0 ) {
256 print __ ( 'Article purging:' ) . " " ;
258 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals );
261 print "<input type='hidden' name='purge_interval' value=' $purge_interval '>" ;
266 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
267 print "<div class= \" dlgSecCont \" >" ;
269 $auth_login = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_login" ));
273 print "<tr><td>" . __ ( 'Login:' ) . "</td><td>" ;
275 print "<input size= \" 20 \" onkeypress= \" return filterCR(event, feedEditSave) \"
276 name= \" auth_login \" value= \" $auth_login\" >" ;
278 print "</tr><tr><td>" . __ ( "Password:" ) . "</td><td>" ;
280 $auth_pass = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_pass" ));
282 print "<input size= \" 20 \" type= \" password \" name= \" auth_pass \"
283 onkeypress= \" return filterCR(event, feedEditSave) \"
284 value= \" $auth_pass\" >" ;
286 print "</td></tr></table>" ;
289 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
290 print "<div class= \" dlgSecCont \" >" ;
292 print "<div style= \" line-height : 100% \" >" ;
294 $private = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "private" ));
297 $checked = "checked" ;
302 print "<input type= \" checkbox \" name= \" private \" id= \" private \"
303 $checked > <label for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
305 $rtl_content = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "rtl_content" ));
308 $checked = "checked" ;
313 print "<br/><input type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
314 $checked > <label for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
316 $include_in_digest = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "include_in_digest" ));
318 if ( $include_in_digest ) {
319 $checked = "checked" ;
324 print "<br/><input type= \" checkbox \" id= \" include_in_digest \"
325 name= \" include_in_digest \"
326 $checked > <label for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
329 $always_display_enclosures = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "always_display_enclosures" ));
331 if ( $always_display_enclosures ) {
332 $checked = "checked" ;
337 print "<br/><input type= \" checkbox \" id= \" always_display_enclosures \"
338 name= \" always_display_enclosures \"
339 $checked > <label for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
342 $cache_images = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "cache_images" ));
345 $checked = "checked" ;
350 if ( SIMPLEPIE_CACHE_IMAGES
) {
354 $disabled = "disabled" ;
355 $label_class = "class='insensitive'" ;
358 print "<br/><input type= \" checkbox \" id= \" cache_images \"
359 name= \" cache_images \" $disabled
360 $checked > <label $label_class for= \" cache_images \" >" .
361 __ ( 'Cache images locally' ). "</label>" ;
373 print "<div class= \" dlgSec \" >" . __ ( "Icon" ). "</div>" ;
374 print "<div class= \" dlgSecCont \" >" ;
376 print "<iframe name= \" icon_upload_iframe \"
377 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
379 print "<form style='display : block' target= \" icon_upload_iframe \"
380 enctype= \" multipart/form-data \" method= \" POST \"
381 action= \" backend.php \" >
382 <input id= \" icon_file \" size= \" 10 \" name= \" icon_file \" type= \" file \" >
383 <input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >
384 <input type= \" hidden \" name= \" feed_id \" value= \" $feed_id\" >
385 <input type= \" hidden \" name= \" subop \" value= \" uploadicon \" >
386 <button onclick= \" return uploadFeedIcon(); \"
387 type= \" submit \" >" . __ ( 'Replace' ). "</button>
388 <button onclick= \" return removeFeedIcon( $feed_id ); \"
389 type= \" submit \" >" . __ ( 'Remove' ). "</button>
394 $title = htmlspecialchars ( $title , ENT_QUOTES
);
396 print "<div class='dlgButtons'>
397 <div style= \" float : left \" >
398 <button onclick='return unsubscribeFeed( $feed_id , \" $title\" )'>" .
399 __ ( 'Unsubscribe' ). "</button>
401 <button onclick= \" return feedEditSave() \" >" . __ ( 'Save' ). "</button>
402 <button onclick= \" return feedEditCancel() \" >" . __ ( 'Cancel' ). "</button>
408 if ( $subop == "editfeeds" ) {
410 $feed_ids = db_escape_string ( $_REQUEST [ "ids" ]);
412 print "<div id= \" infoBoxTitle \" >" . __ ( 'Multiple Feed Editor' ). "</div>" ;
414 print "<div class= \" infoBoxContents \" >" ;
416 print "<form id= \" batch_edit_feed_form \" onsubmit= \" return false \" >" ;
418 print "<input type= \" hidden \" name= \" ids \" value= \" $feed_ids\" >" ;
419 print "<input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >" ;
420 print "<input type= \" hidden \" name= \" subop \" value= \" batchEditSave \" >" ;
422 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
423 print "<div class= \" dlgSecCont \" >" ;
427 print "<input disabled style= \" font-size : 16px \" size= \" 35 \" onkeypress= \" return filterCR(event, feedEditSave) \"
428 name= \" title \" value= \" $title\" >" ;
430 batch_edit_cbox ( "title" );
436 print __ ( 'URL:' ) . " " ;
437 print "<input disabled size= \" 40 \" onkeypress= \" return filterCR(event, feedEditSave) \"
438 name= \" feed_url \" value= \" $feed_url\" >" ;
440 batch_edit_cbox ( "feed_url" );
444 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
448 print __ ( 'Place in category:' ) . " " ;
450 print_feed_cat_select ( $link , "cat_id" , $cat_id , "disabled" );
452 batch_edit_cbox ( "cat_id" );
458 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
459 print "<div class= \" dlgSecCont \" >" ;
461 /* Update Interval */
463 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
466 batch_edit_cbox ( "update_interval" );
470 print " " . __ ( 'using' ) . " " ;
471 print_select_hash ( "update_method" , $update_method , $update_methods ,
473 batch_edit_cbox ( "update_method" );
477 if ( FORCE_ARTICLE_PURGE
!= 0 ) {
481 print __ ( 'Article purging:' ) . " " ;
483 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
486 batch_edit_cbox ( "purge_interval" );
490 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
491 print "<div class= \" dlgSecCont \" >" ;
493 print __ ( 'Login:' ) . " " ;
494 print "<input disabled size= \" 15 \" onkeypress= \" return filterCR(event, feedEditSave) \"
495 name= \" auth_login \" value= \" $auth_login\" >" ;
497 batch_edit_cbox ( "auth_login" );
499 print " " . __ ( "Password:" ) . " " ;
501 print "<input disabled size= \" 15 \" type= \" password \" name= \" auth_pass \"
502 onkeypress= \" return filterCR(event, feedEditSave) \"
503 value= \" $auth_pass\" >" ;
505 batch_edit_cbox ( "auth_pass" );
508 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
509 print "<div class= \" dlgSecCont \" >" ;
511 print "<div style= \" line-height : 100% \" >" ;
513 print "<input disabled type= \" checkbox \" name= \" private \" id= \" private \"
514 $checked > <label id= \" private_l \" class='insensitive' for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
516 print " " ; batch_edit_cbox ( "private" , "private_l" );
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>" ;
521 print " " ; batch_edit_cbox ( "rtl_content" , "rtl_content_l" );
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>" ;
527 print " " ; batch_edit_cbox ( "include_in_digest" , "include_in_digest_l" );
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>" ;
533 print " " ; batch_edit_cbox ( "always_display_enclosures" , "always_display_enclosures_l" );
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>" ;
542 if ( SIMPLEPIE_CACHE_IMAGES
) {
543 print " " ; batch_edit_cbox ( "cache_images" , "cache_images_l" );
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' ). " \" >
561 if ( $subop == "editSave" ||
$subop == "batchEditSave" ) {
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" ]);
567 $feed_id = db_escape_string ( $_POST [ "id" ]); /* editSave */
568 $feed_ids = db_escape_string ( $_POST [ "ids" ]); /* batchEditSave */
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 $private = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "private" ]));
573 $rtl_content = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "rtl_content" ]));
574 $include_in_digest = checkbox_to_sql_bool (
575 db_escape_string ( $_POST [ "include_in_digest" ]));
576 $cache_images = checkbox_to_sql_bool (
577 db_escape_string ( $_POST [ "cache_images" ]));
578 $update_method = ( int ) db_escape_string ( $_POST [ "update_method" ]);
580 $always_display_enclosures = checkbox_to_sql_bool (
581 db_escape_string ( $_POST [ "always_display_enclosures" ]));
583 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
584 if ( $cat_id && $cat_id != 0 ) {
585 $category_qpart = "cat_id = ' $cat_id '," ;
586 $category_qpart_nocomma = "cat_id = ' $cat_id '" ;
588 $category_qpart = 'cat_id = NULL,' ;
589 $category_qpart_nocomma = 'cat_id = NULL' ;
592 $category_qpart = "" ;
593 $category_qpart_nocomma = "" ;
596 if ( SIMPLEPIE_CACHE_IMAGES
) {
597 $cache_images_qpart = "cache_images = $cache_images ," ;
599 $cache_images_qpart = "" ;
602 if ( $subop == "editSave" ) {
604 $result = db_query ( $link , "UPDATE ttrss_feeds SET
606 title = ' $feed_title ', feed_url = ' $feed_link ',
607 update_interval = ' $upd_intl ',
608 purge_interval = ' $purge_intl ',
609 auth_login = ' $auth_login ',
610 auth_pass = ' $auth_pass ',
612 rtl_content = $rtl_content ,
614 include_in_digest = $include_in_digest ,
615 always_display_enclosures = $always_display_enclosures ,
616 update_method = ' $update_method '
617 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
619 } else if ( $subop == "batchEditSave" ) {
620 $feed_data = array ();
622 foreach ( array_keys ( $_POST ) as $k ) {
623 if ( $k != "op" && $k != "subop" && $k != "ids" ) {
624 $feed_data [ $k ] = $_POST [ $k ];
628 db_query ( $link , "BEGIN" );
630 foreach ( array_keys ( $feed_data ) as $k ) {
636 $qpart = "title = ' $feed_title '" ;
640 $qpart = "feed_url = ' $feed_link '" ;
643 case "update_interval" :
644 $qpart = "update_interval = ' $upd_intl '" ;
647 case "purge_interval" :
648 $qpart = "purge_interval = ' $purge_intl '" ;
652 $qpart = "auth_login = ' $auth_login '" ;
656 $qpart = "auth_pass = ' $auth_pass '" ;
660 $qpart = "private = ' $private '" ;
663 case "include_in_digest" :
664 $qpart = "include_in_digest = ' $include_in_digest '" ;
667 case "always_display_enclosures" :
668 $qpart = "always_display_enclosures = ' $always_display_enclosures '" ;
672 $qpart = "cache_images = ' $cache_images '" ;
676 $qpart = "rtl_content = ' $rtl_content '" ;
679 case "update_method" :
680 $qpart = "update_method = ' $update_method '" ;
684 $qpart = $category_qpart_nocomma ;
691 "UPDATE ttrss_feeds SET $qpart WHERE id IN ( $feed_ids )
692 AND owner_uid = " . $_SESSION [ "uid" ]);
697 db_query ( $link , "COMMIT" );
702 if ( $subop == "remove" ) {
704 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
706 foreach ( $ids as $id ) {
707 remove_feed ( $link , $id , $_SESSION [ "uid" ]);
713 if ( $subop == "clear" ) {
714 $id = db_escape_string ( $_REQUEST [ "id" ]);
715 clear_feed_articles ( $link , $id );
718 if ( $subop == "rescore" ) {
719 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
721 foreach ( $ids as $id ) {
723 $filters = load_filters ( $link , $id , $_SESSION [ "uid" ], 6 );
725 $result = db_query ( $link , "SELECT
726 title, content, link, ref_id, author," .
727 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
729 ttrss_user_entries, ttrss_entries
730 WHERE ref_id = id AND feed_id = ' $id ' AND
731 owner_uid = " . $_SESSION [ 'uid' ]. "
736 while ( $line = db_fetch_assoc ( $result )) {
738 $tags = get_article_tags ( $link , $line [ "ref_id" ]);
740 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
741 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
742 $line [ 'author' ], $tags );
744 $new_score = calculate_article_score ( $article_filters );
746 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
748 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
751 foreach ( array_keys ( $scores ) as $s ) {
753 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ',
755 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
756 } else if ( $s < - 500 ) {
757 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ',
759 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
761 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
762 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
767 print __ ( "All done." );
771 if ( $subop == "rescoreAll" ) {
773 $result = db_query ( $link ,
774 "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION [ 'uid' ]);
776 while ( $feed_line = db_fetch_assoc ( $result )) {
778 $id = $feed_line [ "id" ];
780 $filters = load_filters ( $link , $id , $_SESSION [ "uid" ], 6 );
782 $tmp_result = db_query ( $link , "SELECT
783 title, content, link, ref_id, author," .
784 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
786 ttrss_user_entries, ttrss_entries
787 WHERE ref_id = id AND feed_id = ' $id ' AND
788 owner_uid = " . $_SESSION [ 'uid' ]. "
793 while ( $line = db_fetch_assoc ( $tmp_result )) {
795 $tags = get_article_tags ( $link , $line [ "ref_id" ]);
797 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
798 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
799 $line [ 'author' ], $tags );
801 $new_score = calculate_article_score ( $article_filters );
803 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
805 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
808 foreach ( array_keys ( $scores ) as $s ) {
810 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ',
812 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
814 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
815 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
820 print __ ( "All done." );
824 if ( $subop == "add" ) {
826 $feed_url = db_escape_string ( trim ( $_REQUEST [ "feed_url" ]));
827 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
828 $p_from = db_escape_string ( $_REQUEST [ "from" ]);
830 /* only read authentication information from POST */
832 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
833 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
835 if ( $p_from != 'tt-rss' ) {
838 <title>Tiny Tiny RSS</title>
839 <link rel= \" stylesheet \" type= \" text/css \" href= \" utility.css \" >
842 <img class= \" floatingLogo \" src= \" images/ttrss_logo.png \"
843 alt= \" Tiny Tiny RSS \" />
844 <h1>Subscribe to feed...</h1>" ;
847 $rc = subscribe_to_feed ( $link , $feed_url , $cat_id , $auth_login , $auth_pass );
851 print_notice ( T_sprintf ( "Subscribed to <b> %s </b>." , $feed_url ));
854 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>." , $feed_url ));
857 print_warning ( T_sprintf ( "Already subscribed to <b> %s </b>." , $feed_url ));
861 if ( $p_from != 'tt-rss' ) {
862 $tt_uri = ( $_SERVER [ 'HTTPS' ] != "on" ?
'http://' : 'https://' ) . $_SERVER [ 'HTTP_HOST' ] . preg_replace ( '/backend\.php.*$/' , 'tt-rss.php' , $_SERVER [ "REQUEST_URI" ]);
865 $tp_uri = ( $_SERVER [ 'HTTPS' ] != "on" ?
'http://' : 'https://' ) . $_SERVER [ 'HTTP_HOST' ] . preg_replace ( '/backend\.php.*$/' , 'prefs.php' , $_SERVER [ "REQUEST_URI" ]);
867 $result = db_query ( $link , "SELECT id FROM ttrss_feeds WHERE
868 feed_url = ' $feed_url ' AND owner_uid = " . $_SESSION [ "uid" ]);
870 $feed_id = db_fetch_result ( $result , 0 , "id" );
875 print "<form method= \" GET \" style='display: inline'
877 <input type= \" hidden \" name= \" tab \" value= \" feedConfig \" >
878 <input type= \" hidden \" name= \" subop \" value= \" editFeed \" >
879 <input type= \" hidden \" name= \" subopparam \" value= \" $feed_id\" >
880 <input type= \" submit \" value= \" " . __ ( "Edit subscription options" ). " \" >
884 print "<form style='display: inline' method= \" GET \" action= \" $tt_uri\" >
885 <input type= \" submit \" value= \" " . __ ( "Return to Tiny Tiny RSS" ). " \" >
888 print "</body></html>" ;
893 if ( $subop == "categorize" ) {
896 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
898 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
901 $cat_id_qpart = 'NULL' ;
903 $cat_id_qpart = "' $cat_id '" ;
906 db_query ( $link , "BEGIN" );
908 foreach ( $ids as $id ) {
910 db_query ( $link , "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
912 AND owner_uid = " . $_SESSION [ "uid" ]);
916 db_query ( $link , "COMMIT" );
920 if ( $subop == "editCats" ) {
922 $action = $_REQUEST [ "action" ];
924 if ( $action == "save" ) {
926 $cat_title = db_escape_string ( trim ( $_REQUEST [ "value" ]));
927 $cat_id = db_escape_string ( $_REQUEST [ "cid" ]);
929 db_query ( $link , "BEGIN" );
931 $result = db_query ( $link , "SELECT title FROM ttrss_feed_categories
932 WHERE id = ' $cat_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
934 if ( db_num_rows ( $result ) == 1 ) {
936 $old_title = db_fetch_result ( $result , 0 , "title" );
938 if ( $cat_title != "" ) {
939 $result = db_query ( $link , "UPDATE ttrss_feed_categories SET
940 title = ' $cat_title ' WHERE id = ' $cat_id ' AND
941 owner_uid = " . $_SESSION [ "uid" ]);
948 print $_REQUEST [ "value" ];
951 db_query ( $link , "COMMIT" );
957 print "<div id= \" infoBoxTitle \" >" . __ ( 'Category editor' ). "</div>" ;
959 print "<div class= \" infoBoxContents \" >" ;
962 if ( $action == "add" ) {
964 $feed_cat = db_escape_string ( trim ( $_REQUEST [ "cat" ]));
966 if (! add_feed_category ( $link , $feed_cat ))
967 print_warning ( T_sprintf ( "Category <b>$ %s </b> already exists in the database." , $feed_cat ));
971 if ( $action == "remove" ) {
973 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
975 foreach ( $ids as $id ) {
976 remove_feed_category ( $link , $id , $_SESSION [ "uid" ]);
981 <input id= \" fadd_cat \"
982 onkeypress= \" return filterCR(event, addFeedCat) \"
984 <button onclick= \" javascript:addFeedCat() \" >" .
985 __ ( 'Create category' ). "</button></div>" ;
987 $result = db_query ( $link , "SELECT title,id FROM ttrss_feed_categories
988 WHERE owner_uid = " . $_SESSION [ "uid" ]. "
993 if ( db_num_rows ( $result ) != 0 ) {
995 print __ ( 'Select:' ). "
996 <a href= \" javascript:selectPrefRows('fcat', true) \" >" . __ ( 'All' ). "</a>,
997 <a href= \" javascript:selectPrefRows('fcat', false) \" >" . __ ( 'None' ). "</a>" ;
999 print "<div class= \" prefFeedCatHolder \" >" ;
1001 print "<form id= \" feed_cat_edit_form \" onsubmit= \" return false \" >" ;
1003 print "<table width= \" 100% \" class= \" prefFeedCatList \"
1004 cellspacing= \" 0 \" id= \" prefFeedCatList \" >" ;
1008 while ( $line = db_fetch_assoc ( $result )) {
1010 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
1012 $cat_id = $line [ "id" ];
1013 $this_row_id = "id= \" FCATR- $cat_id\" " ;
1015 print "<tr class= \" $class\" $this_row_id >" ;
1017 $edit_title = htmlspecialchars ( $line [ "title" ]);
1019 print "<td width='5%' align='center'><input
1020 onclick='toggleSelectPrefRow(this, \" fcat \" );'
1021 type= \" checkbox \" id= \" FCCHK- $cat_id\" ></td>" ;
1023 print "<td><span id= \" FCATT- $cat_id\" >" .
1024 $edit_title . "</span></td>" ;
1038 print "<p>" . __ ( 'No feed categories defined.' ). "</p>" ;
1041 print "<div class='dlgButtons'>
1042 <div style='float : left'>
1043 <button onclick= \" return removeSelectedFeedCats() \" >" .
1044 __ ( 'Remove' ). "</button>
1047 print "<button onclick= \" selectTab('feedConfig') \" >" .
1048 __ ( 'Close this window' ). "</button></div>" ;
1058 set_pref ( $link , "_PREFS_ACTIVE_TAB" , "feedConfig" );
1060 $result = db_query ( $link , "SELECT COUNT(id) AS num_errors
1061 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
1063 $num_errors = db_fetch_result ( $result , 0 , "num_errors" );
1065 if ( $num_errors > 0 ) {
1067 print format_notice ( "<a href= \" javascript:showFeedsWithErrors() \" >" .
1068 __ ( 'Some feeds have update errors (click for details)' ). "</a>" );
1071 $feed_search = db_escape_string ( $_REQUEST [ "search" ]);
1073 if ( array_key_exists ( "search" , $_REQUEST )) {
1074 $_SESSION [ "prefs_feed_search" ] = $feed_search ;
1076 $feed_search = $_SESSION [ "prefs_feed_search" ];
1079 print "<div style='float : right'>
1080 <input id= \" feed_search \" size= \" 20 \" type= \" search \"
1081 onfocus= \" javascript:disableHotkeys(); \"
1082 onblur= \" javascript:enableHotkeys(); \"
1083 onchange= \" javascript:updateFeedList() \" value= \" $feed_search\" >
1084 <button onclick= \" javascript:updateFeedList() \" >" .
1085 __ ( 'Search' ). "</button>
1088 print "<button onclick= \" quickAddFeed() \" >"
1089 . __ ( 'Subscribe to feed' ). "</button> " ;
1091 print "<button onclick= \" editSelectedFeed() \" >" .
1092 __ ( 'Edit feeds' ). "</button> " ;
1094 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
1096 print "<button onclick= \" javascript:editFeedCats() \" >" .
1097 __ ( 'Edit categories' ). "</button> " ;
1100 print "<button onclick= \" javascript:removeSelectedFeeds() \" >"
1101 . __ ( 'Unsubscribe' ). "</button> " ;
1103 if ( defined ( '_ENABLE_FEED_DEBUGGING' )) {
1105 print "<select id= \" feedActionChooser \" onchange= \" feedActionChange() \" >
1106 <option value= \" facDefault \" selected>" . __ ( 'More actions...' ). "</option>" ;
1108 if ( FORCE_ARTICLE_PURGE
== 0 ) {
1110 "<option value= \" facPurge \" >" . __ ( 'Manual purge' ). "</option>" ;
1114 <option value= \" facClear \" >" . __ ( 'Clear feed data' ). "</option>
1115 <option value= \" facRescore \" >" . __ ( 'Rescore articles' ). "</option>" ;
1121 $feeds_sort = db_escape_string ( $_REQUEST [ "sort" ]);
1123 if (! $feeds_sort ||
$feeds_sort == "undefined" ) {
1124 $feeds_sort = $_SESSION [ "pref_sort_feeds" ];
1125 if (! $feeds_sort ) $feeds_sort = "title" ;
1128 $_SESSION [ "pref_sort_feeds" ] = $feeds_sort ;
1132 $feed_search = split ( " " , $feed_search );
1135 foreach ( $feed_search as $token ) {
1137 $token = trim ( $token );
1139 array_push ( $tokens , "(UPPER(F1.title) LIKE UPPER('% $token %') OR
1140 UPPER(C1.title) LIKE UPPER('% $token %') OR
1141 UPPER(F1.feed_url) LIKE UPPER('% $token %'))" );
1144 $search_qpart = "(" . join ( $tokens , " AND " ) . ") AND " ;
1150 $show_last_article_info = false ;
1151 $show_last_article_checked = "" ;
1152 $show_last_article_qpart = "" ;
1154 if ( $_REQUEST [ "slat" ] == "true" ) {
1155 $show_last_article_info = true ;
1156 $show_last_article_checked = "checked" ;
1157 $show_last_article_qpart = ", (SELECT " . SUBSTRING_FOR_DATE
. "(MAX(updated),1,16) FROM ttrss_user_entries,
1158 ttrss_entries WHERE ref_id = ttrss_entries.id
1159 AND feed_id = F1.id) AS last_article" ;
1160 } else if ( $feeds_sort == "last_article" ) {
1161 $feeds_sort = "title" ;
1164 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
1165 $order_by_qpart = "category, $feeds_sort ,title" ;
1167 $order_by_qpart = " $feeds_sort ,title" ;
1170 $result = db_query ( $link , "SELECT
1174 " . SUBSTRING_FOR_DATE
. "(F1.last_updated,1,16) AS last_updated,
1179 C1.title AS category,
1180 F1.include_in_digest
1181 $show_last_article_qpart
1184 LEFT JOIN ttrss_feed_categories AS C1
1185 ON (F1.cat_id = C1.id)
1187 $search_qpart F1.owner_uid = '" . $_SESSION [ "uid" ]. "'
1188 ORDER by $order_by_qpart " );
1190 if ( db_num_rows ( $result ) != 0 ) {
1192 // print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>";
1194 print "<p><table width= \" 100% \" cellspacing= \" 0 \"
1195 class= \" prefFeedList \" id= \" prefFeedList \" >" ;
1196 print "<tr><td class= \" selectPrompt \" colspan= \" 8 \" >" .
1197 "<div style='float : right'>" .
1198 "<input id='show_last_article_times' type='checkbox' onchange='feedlistToggleSLAT()'
1199 $show_last_article_checked ><label
1200 for='show_last_article_times'>" . __ ( 'Show last article times' ). "</label></div>" .
1202 <a href= \" javascript:selectPrefRows('feed', true) \" >" . __ ( 'All' ). "</a>,
1203 <a href= \" javascript:selectPrefRows('feed', false) \" >" . __ ( 'None' ). "</a>
1206 if (! get_pref ( $link , 'ENABLE_FEED_CATS' )) {
1207 print "<tr class= \" title \" >
1208 <td width='5%' align='center'> </td>" ;
1210 print "<td width='3%'> </td>" ;
1212 print "<td width='60%'><a href= \" javascript:updateFeedList('title') \" >" . __ ( 'Title' ). "</a></td>" ;
1214 if ( $show_last_article_info ) {
1215 print "<td width='20%' align='right'><a href= \" javascript:updateFeedList('last_article') \" >" . __ ( 'Last Article' ). "</a></td>" ;
1218 print "<td width='20%' align='right'><a href= \" javascript:updateFeedList('last_updated') \" >" . __ ( 'Updated' ). "</a></td>" ;
1225 while ( $line = db_fetch_assoc ( $result )) {
1227 $feed_id = $line [ "id" ];
1228 $cat_id = $line [ "cat_id" ];
1230 $edit_title = htmlspecialchars ( $line [ "title" ]);
1231 $edit_cat = htmlspecialchars ( $line [ "category" ]);
1233 $last_error = $line [ "last_error" ];
1235 if (! $edit_cat ) $edit_cat = __ ( "Uncategorized" );
1237 $last_updated = $line [ "last_updated" ];
1239 if (! $last_updated ) {
1240 $last_updated = "—" ;
1242 $last_updated = make_local_datetime ( $link , $last_updated , false );
1245 $last_article = $line [ "last_article" ];
1247 if (! $last_article ) {
1248 $last_article = "—" ;
1250 $last_article = make_local_datetime ( $link , $last_article , false );
1253 if ( get_pref ( $link , 'ENABLE_FEED_CATS' ) && $cur_cat_id != $cat_id ) {
1256 print "<tr><td colspan= \" 6 \" class= \" feedEditCat \" > $edit_cat </td></tr>" ;
1258 print "<tr class= \" title \" >
1259 <td width='5%'> </td>" ;
1261 print "<td width='3%'> </td>" ;
1263 print "<td width='60%'><a href= \" javascript:updateFeedList('title') \" >" . __ ( 'Title' ). "</a></td>" ;
1265 if ( $show_last_article_info ) {
1266 print "<td width='20%' align='right'>
1267 <a href= \" javascript:updateFeedList('last_article') \" >" . __ ( 'Last Article' ). "</a></td>" ;
1270 print "<td width='20%' align='right'>
1271 <a href= \" javascript:updateFeedList('last_updated') \" >" . __ ( 'Updated' ). "</a></td>" ;
1273 $cur_cat_id = $cat_id ;
1276 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
1277 $this_row_id = "id= \" FEEDR- $feed_id\" " ;
1279 print "<tr class= \" $class\" $this_row_id >" ;
1281 $icon_file = ICONS_DIR
. "/ $feed_id .ico" ;
1283 if ( file_exists ( $icon_file ) && filesize ( $icon_file ) > 0 ) {
1284 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" " . ICONS_URL
. "/ $feed_id .ico \" >" ;
1286 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" images/blank_icon.gif \" >" ;
1289 print "<td class='feedSelect'><input onclick='toggleSelectPrefRow(this, \" feed \" );'
1290 type= \" checkbox \" id= \" FRCHK-" . $line [ "id" ]. " \" ></td>" ;
1292 $onclick = "onclick='editFeed( $feed_id )' title='" . __ ( 'Click to edit' ). "'" ;
1294 print "<td $onclick class='feedIcon'> $feed_icon </td>" ;
1297 $edit_title = "<span class= \" feed_error \" > $edit_title </span>" ;
1298 $last_updated = "<span class= \" feed_error \" > $last_updated </span>" ;
1299 $last_article = "<span class= \" feed_error \" > $last_article </span>" ;
1302 print "<td $onclick >" . $edit_title . "</td>" ;
1304 if ( $show_last_article_info ) {
1305 print "<td align='right' $onclick >" .
1306 " $last_article </td>" ;
1309 print "<td $onclick align='right'> $last_updated </td>" ;
1324 if (! $feed_search ) {
1325 print_warning ( __ ( "You don't have any subscribed feeds." ));
1327 print_warning ( __ ( 'No matching feeds found.' ));
1333 print "<h3>" . __ ( 'OPML' ). "</h3>" ;
1335 /* print "<div style='float : left'>
1336 <form enctype=\"multipart/form-data\" method=\"POST\" action=\"opml.php\">
1337 ".__('File:')." <input id=\"opml_file\" name=\"opml_file\" type=\"file\">
1338 <input type=\"hidden\" name=\"op\" value=\"Import\">
1339 <button onclick=\"return validateOpmlImport();\"
1340 type=\"submit\">".__('Import')."</button>
1345 print "<p>" . __ ( "Using OPML you can export and import your feeds and Tiny Tiny RSS settings." );
1347 print "<div class= \" insensitive \" >" . __ ( "Note: Only main settings profile can be migrated using OPML." ) . "</div>" ;
1351 print "<iframe name= \" upload_iframe \"
1352 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
1354 print "<div style='float : left'>" ;
1355 print "<form style='display : block' target= \" upload_iframe \"
1356 enctype= \" multipart/form-data \" method= \" POST \"
1357 action= \" backend.php \" >
1358 <input id= \" opml_file \" name= \" opml_file \" type= \" file \" >
1359 <input type= \" hidden \" name= \" op \" value= \" dlg \" >
1360 <input type= \" hidden \" name= \" id \" value= \" importOpml \" >
1361 <button onclick= \" return opmlImport(); \"
1362 type= \" submit \" >" . __ ( 'Import' ). "</button>
1364 print "</div> " ;
1366 print "<button onclick= \" gotoExportOpml() \" >" .
1367 __ ( 'Export OPML' ). "</button>" ;
1369 print "<p>" . __ ( 'Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.' );
1371 print "<div class= \" insensitive \" >" . __ ( "Note: Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds." ) . "</div>" . "</p>" ;
1373 print "<button onclick= \" return displayDlg('pubOPMLUrl') \" >" .
1374 __ ( 'Display URL' ). "</button> " ;
1377 if ( strpos ( $_SERVER [ 'HTTP_USER_AGENT' ], "Firefox" ) !== false ) {
1379 print "<h3>" . __ ( "Firefox Integration" ) . "</h3>" ;
1381 print "<p>" . __ ( 'This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.' ) . "</p>" ;
1385 print "<button onclick='window.navigator.registerContentHandler(" .
1386 " \" application/vnd.mozilla.maybe.feed \" , " .
1387 " \" " . add_feed_url () . " \" , " . " \" Tiny Tiny RSS \" )'>" .
1388 __ ( 'Click here to register this site as a feed reader.' ) .
1394 print "<h3>" . __ ( "Subscribing via bookmarklet" ). "</h3>" ;
1396 print "<p>" . __ ( "Drag the link below to your browser toolbar, open the feed you're interested in in your browser and click on the link to subscribe to it." ) . "</p>" ;
1398 $bm_subscribe_url = str_replace ( ' %s ' , '' , add_feed_url ());
1400 $confirm_str = __ ( 'Subscribe to %s in Tiny Tiny RSS?' );
1402 $bm_url = htmlspecialchars ( "javascript:{if(confirm(' $confirm_str '.replace(' %s ',window.location.href)))window.location.href=' $bm_subscribe_url '+window.location.href}" );
1404 print "<a href= \" $bm_url\" class='visibleLink'>" . __ ( 'Subscribe in Tiny Tiny RSS' ). "</a>" ;
1406 print "<h3>" . __ ( "Published articles" ). "</h3>" ;
1408 print "<p>" . __ ( 'Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.' ). "</p>" ;
1410 $rss_url = '-2::' . htmlspecialchars ( get_self_url_prefix () .
1411 "/backend.php?op=rss&id=-2&view-mode=all_articles" );;
1413 print "<button onclick= \" return displayDlg('generatedFeed', ' $rss_url ') \" >" .
1414 __ ( 'Display URL' ). "</button> " ;
1416 print "<button onclick= \" return clearFeedAccessKeys() \" >" .
1417 __ ( 'Clear all generated URLs' ). "</button> " ;
1421 function print_feed_browser ( $link , $search , $limit , $mode = 1 ) {
1423 $owner_uid = $_SESSION [ "uid" ];
1426 $search_qpart = "AND (UPPER(feed_url) LIKE UPPER('% $search %') OR
1427 UPPER(title) LIKE UPPER('% $search %'))" ;
1433 $result = db_query ( $link , "SELECT feed_url, subscribers FROM
1434 ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
1435 WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url
1436 AND owner_uid = ' $owner_uid ') $search_qpart
1437 ORDER BY subscribers DESC LIMIT $limit " );
1438 } else if ( $mode == 2 ) {
1439 $result = db_query ( $link , "SELECT *,
1440 (SELECT COUNT(*) FROM ttrss_user_entries WHERE
1441 orig_feed_id = ttrss_archived_feeds.id) AS articles_archived
1443 ttrss_archived_feeds
1445 (SELECT COUNT(*) FROM ttrss_feeds
1446 WHERE ttrss_feeds.feed_url = ttrss_archived_feeds.feed_url AND
1447 owner_uid = ' $owner_uid ') = 0 AND
1448 owner_uid = ' $owner_uid ' $search_qpart
1449 ORDER BY id DESC LIMIT $limit " );
1454 while ( $line = db_fetch_assoc ( $result )) {
1458 $feed_url = $line [ "feed_url" ];
1459 $subscribers = $line [ "subscribers" ];
1461 $det_result = db_query ( $link , "SELECT site_url,title,id
1462 FROM ttrss_feeds WHERE feed_url = ' $feed_url ' LIMIT 1" );
1464 $details = db_fetch_assoc ( $det_result );
1466 $icon_file = ICONS_DIR
. "/" . $details [ "id" ] . ".ico" ;
1468 if ( file_exists ( $icon_file ) && filesize ( $icon_file ) > 0 ) {
1469 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" " . ICONS_URL
.
1470 "/" . $details [ "id" ]. ".ico \" >" ;
1472 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" images/blank_icon.gif \" >" ;
1475 $check_box = "<input onclick='toggleSelectListRow(this)'
1476 class='feedBrowseCB'
1477 type= \" checkbox \" id= \" FBCHK-" . $details [ "id" ] . " \" >" ;
1479 $class = ( $feedctr %
2 ) ?
"even" : "odd" ;
1481 $feed_url = htmlspecialchars ( $line [ "feed_url" ]);
1483 if ( $details [ "site_url" ]) {
1484 $site_url = "<a target= \" _blank \" href= \" " .
1485 htmlspecialchars ( $details [ "site_url" ]). " \" >
1486 <img style='border-width : 0px' src='images/www.png' alt='www'></a>" ;
1491 $feed_url = "<a target= \" _blank \" href= \" $feed_url\" ><img
1492 style='border-width : 0px; vertical-align : middle'
1493 src='images/feed-icon-12x12.png'></a>" ;
1495 print "<li title= \" " . htmlspecialchars ( $details [ "site_url" ]). " \"
1496 class=' $class ' id= \" FBROW-" . $details [ "id" ]. " \" > $check_box " .
1497 " $feed_icon $feed_url " . htmlspecialchars ( $details [ "title" ]) .
1498 " <span class='subscribers'>( $subscribers )</span>
1501 } else if ( $mode == 2 ) {
1502 $feed_url = htmlspecialchars ( $line [ "feed_url" ]);
1503 $site_url = htmlspecialchars ( $line [ "site_url" ]);
1504 $title = htmlspecialchars ( $line [ "title" ]);
1506 $icon_file = ICONS_DIR
. "/" . $line [ "id" ] . ".ico" ;
1508 if ( file_exists ( $icon_file ) && filesize ( $icon_file ) > 0 ) {
1509 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" " . ICONS_URL
.
1510 "/" . $line [ "id" ]. ".ico \" >" ;
1512 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" images/blank_icon.gif \" >" ;
1515 $check_box = "<input onclick='toggleSelectListRow(this)' class='feedBrowseCB'
1516 type= \" checkbox \" id= \" FBCHK-" . $line [ "id" ] . " \" >" ;
1518 $class = ( $feedctr %
2 ) ?
"even" : "odd" ;
1520 if ( $line [ 'articles_archived' ] > 0 ) {
1521 $archived = sprintf ( __ ( " %d archived articles" ), $line [ 'articles_archived' ]);
1522 $archived = " <span class='subscribers'>( $archived )</span>" ;
1527 if ( $line [ "site_url" ]) {
1528 $site_url = "<a target= \" _blank \" href= \" $site_url\" >
1529 <img style='border-width : 0px' src='images/www.png' alt='www'></a>" ;
1534 $feed_url = "<a target= \" _blank \" href= \" $feed_url\" ><img
1535 style='border-width : 0px; vertical-align : middle'
1536 src='images/feed-icon-12x12.png'></a>" ;
1538 print "<li title='" . $line [ 'site_url' ]. "' class=' $class '
1539 id= \" FBROW-" . $line [ "id" ]. " \" >" .
1540 $check_box . " $feed_icon $feed_url " . $title .
1541 $archived . $site_url . "</li>" ;
1549 if ( $feedctr == 0 ) {
1550 print "<li style= \" text-align : center \" ><p>" . __ ( 'No feeds found.' ). "</p></li>" ;