]>
git.wh0rd.org - tt-rss.git/blob - modules/pref-feeds.php
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 == "renamecat" ) {
19 $title = db_escape_string ( $_REQUEST [ 'title' ]);
20 $id = db_escape_string ( $_REQUEST [ 'id' ]);
23 db_query ( $link , "UPDATE ttrss_feed_categories SET
24 title = ' $title ' WHERE id = ' $id ' AND owner_uid = " . $_SESSION [ "uid" ]);
29 if ( $subop == "getfeedtree" ) {
33 $root [ 'name' ] = __ ( 'Feeds' );
34 $root [ 'items' ] = array ();
36 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
38 $result = db_query ( $link , "SELECT id, title FROM ttrss_feed_categories
39 WHERE owner_uid = " . $_SESSION [ "uid" ] . " ORDER BY order_id, title" );
41 while ( $line = db_fetch_assoc ( $result )) {
43 $cat [ 'id' ] = 'CAT:' . $line [ 'id' ];
44 $cat [ 'bare_id' ] = $feed_id ;
45 $cat [ 'name' ] = $line [ 'title' ];
46 $cat [ 'items' ] = array ();
48 $feed_result = db_query ( $link , "SELECT id, title, last_error
50 WHERE cat_id = '" . $line [ 'id' ]. "' AND owner_uid = " . $_SESSION [ "uid" ].
51 " ORDER BY order_id, title" );
53 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
55 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
56 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
57 $feed [ 'name' ] = $feed_line [ 'title' ];
58 $feed [ 'checkbox' ] = false ;
59 $feed [ 'error' ] = $feed_line [ 'last_error' ];
60 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
62 array_push ( $cat [ 'items' ], $feed );
65 array_push ( $root [ 'items' ], $cat );
68 /* Uncategorized is a special case */
73 $cat [ 'name' ] = __ ( "Uncategorized" );
74 $cat [ 'items' ] = array ();
76 $feed_result = db_query ( $link , "SELECT id, title,last_error
78 WHERE cat_id IS NULL AND owner_uid = " . $_SESSION [ "uid" ].
79 " ORDER BY order_id, title" );
81 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
83 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
84 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
85 $feed [ 'name' ] = $feed_line [ 'title' ];
86 $feed [ 'checkbox' ] = false ;
87 $feed [ 'error' ] = $feed_line [ 'last_error' ];
88 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
90 array_push ( $cat [ 'items' ], $feed );
93 array_push ( $root [ 'items' ], $cat );
95 $feed_result = db_query ( $link , "SELECT id, title, last_error
97 WHERE owner_uid = " . $_SESSION [ "uid" ].
98 " ORDER BY order_id, title" );
100 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
102 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
103 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
104 $feed [ 'name' ] = $feed_line [ 'title' ];
105 $feed [ 'checkbox' ] = false ;
106 $feed [ 'error' ] = $feed_line [ 'last_error' ];
107 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
109 array_push ( $root [ 'items' ], $feed );
114 $fl [ 'identifier' ] = 'id' ;
115 $fl [ 'label' ] = 'name' ;
116 $fl [ 'items' ] = array ( $root );
118 print json_encode ( $fl );
122 if ( $subop == "catsortreset" ) {
123 db_query ( $link , "UPDATE ttrss_feed_categories
124 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
128 if ( $subop == "feedsortreset" ) {
129 db_query ( $link , "UPDATE ttrss_feeds
130 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
134 if ( $subop == "savefeedorder" ) {
135 if ( $_POST [ 'payload' ]) {
136 file_put_contents ( "/tmp/blahblah.txt" , $_POST [ 'payload' ]);
139 $data = file_get_contents ( "/tmp/blahblah.txt" );
140 $data = json_decode ( $data , true );
142 if ( is_array ( $data ) && is_array ( $data [ 'items' ])) {
147 foreach ( $data [ 'items' ] as $item ) {
148 $data_map [ $item [ 'id' ]] =& $item [ 'items' ];
151 foreach ( $data [ 'items' ][ 0 ][ 'items' ] as $item ) {
152 $id = $item [ '_reference' ];
153 $bare_id = substr ( $id , strpos ( $id , ':' ) +
1 );
158 db_query ( $link , "UPDATE ttrss_feed_categories
159 SET order_id = ' $cat_order_id ' WHERE id = ' $bare_id ' AND
160 owner_uid = " . $_SESSION [ "uid" ]);
165 if ( is_array ( $data_map [ $id ])) {
166 foreach ( $data_map [ $id ] as $feed ) {
167 $id = $feed [ '_reference' ];
168 $bare_id = substr ( $id , strpos ( $id , ':' ) +
1 );
170 db_query ( $link , "UPDATE ttrss_feeds
171 SET order_id = ' $feed_order_id ' WHERE id = ' $bare_id ' AND
172 owner_uid = " . $_SESSION [ "uid" ]);
183 if ( $subop == "removeicon" ) {
184 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
186 $result = db_query ( $link , "SELECT id FROM ttrss_feeds
187 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
189 if ( db_num_rows ( $result ) != 0 ) {
190 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
196 if ( $subop == "uploadicon" ) {
197 $icon_file = $_FILES [ 'icon_file' ][ 'tmp_name' ];
198 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
200 if ( is_file ( $icon_file ) && $feed_id ) {
201 if ( filesize ( $icon_file ) < 20000 ) {
203 $result = db_query ( $link , "SELECT id FROM ttrss_feeds
204 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
206 if ( db_num_rows ( $result ) != 0 ) {
207 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
208 move_uploaded_file ( $icon_file , ICONS_DIR
. "/ $feed_id .ico" );
220 print "<script type= \" text/javascript \" >" ;
221 print "parent.uploadIconHandler( $rc );" ;
226 if ( $subop == "editfeed" ) {
227 header ( "Content-Type: text/xml" );
229 print "<dlg id= \" $subop\" >" ;
230 print "<title>" . __ ( 'Feed Editor' ). "</title>" ;
231 print "<content><![CDATA[" ;
233 $feed_id = db_escape_string ( $_REQUEST [ "id" ]);
235 $result = db_query ( $link ,
236 "SELECT * FROM ttrss_feeds WHERE id = ' $feed_id ' AND
237 owner_uid = " . $_SESSION [ "uid" ]);
239 $title = htmlspecialchars ( db_fetch_result ( $result ,
242 $icon_file = ICONS_DIR
. "/ $feed_id .ico" ;
244 if ( file_exists ( $icon_file ) && filesize ( $icon_file ) > 0 ) {
245 $feed_icon = "<img width= \" 16 \" height= \" 16 \"
246 src= \" " . ICONS_URL
. "/ $feed_id .ico \" >" ;
251 print "<form id= \" edit_feed_form \" onsubmit= \" return false \" >" ;
253 print "<input type= \" hidden \" name= \" id \" value= \" $feed_id\" >" ;
254 print "<input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >" ;
255 print "<input type= \" hidden \" name= \" subop \" value= \" editSave \" >" ;
257 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
258 print "<div class= \" dlgSecCont \" >" ;
262 print "<input style= \" font-size : 16px \" size= \" 40 \" onkeypress= \" return filterCR(event, feedEditSave) \"
263 name= \" title \" value= \" $title\" >" ;
267 $feed_url = db_fetch_result ( $result , 0 , "feed_url" );
268 $feed_url = htmlspecialchars ( db_fetch_result ( $result ,
273 print __ ( 'URL:' ) . " " ;
274 print "<input size= \" 40 \" onkeypress= \" return filterCR(event, feedEditSave) \"
275 name= \" feed_url \" value= \" $feed_url\" >" ;
279 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
281 $cat_id = db_fetch_result ( $result , 0 , "cat_id" );
285 print __ ( 'Place in category:' ) . " " ;
287 print_feed_cat_select ( $link , "cat_id" , $cat_id , $disabled );
292 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
293 print "<div class= \" dlgSecCont \" >" ;
295 /* Update Interval */
297 $update_interval = db_fetch_result ( $result , 0 , "update_interval" );
299 print_select_hash ( "update_interval" , $update_interval , $update_intervals );
303 $update_method = db_fetch_result ( $result , 0 , "update_method" );
305 print " " . __ ( 'using' ) . " " ;
306 print_select_hash ( "update_method" , $update_method , $update_methods );
308 $purge_interval = db_fetch_result ( $result , 0 , "purge_interval" );
310 if ( FORCE_ARTICLE_PURGE
== 0 ) {
316 print __ ( 'Article purging:' ) . " " ;
318 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals );
321 print "<input type='hidden' name='purge_interval' value=' $purge_interval '>" ;
326 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
327 print "<div class= \" dlgSecCont \" >" ;
329 $auth_login = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_login" ));
333 print "<tr><td>" . __ ( 'Login:' ) . "</td><td>" ;
335 print "<input size= \" 20 \" onkeypress= \" return filterCR(event, feedEditSave) \"
336 name= \" auth_login \" value= \" $auth_login\" >" ;
338 print "</tr><tr><td>" . __ ( "Password:" ) . "</td><td>" ;
340 $auth_pass = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_pass" ));
342 print "<input size= \" 20 \" type= \" password \" name= \" auth_pass \"
343 onkeypress= \" return filterCR(event, feedEditSave) \"
344 value= \" $auth_pass\" >" ;
346 print "</td></tr></table>" ;
349 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
350 print "<div class= \" dlgSecCont \" >" ;
352 print "<div style= \" line-height : 100% \" >" ;
354 $private = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "private" ));
357 $checked = "checked" ;
362 print "<input type= \" checkbox \" name= \" private \" id= \" private \"
363 $checked > <label for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
365 $rtl_content = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "rtl_content" ));
368 $checked = "checked" ;
373 print "<br/><input type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
374 $checked > <label for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
376 $include_in_digest = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "include_in_digest" ));
378 if ( $include_in_digest ) {
379 $checked = "checked" ;
384 print "<br/><input type= \" checkbox \" id= \" include_in_digest \"
385 name= \" include_in_digest \"
386 $checked > <label for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
389 $always_display_enclosures = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "always_display_enclosures" ));
391 if ( $always_display_enclosures ) {
392 $checked = "checked" ;
397 print "<br/><input type= \" checkbox \" id= \" always_display_enclosures \"
398 name= \" always_display_enclosures \"
399 $checked > <label for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
402 $cache_images = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "cache_images" ));
405 $checked = "checked" ;
410 if ( SIMPLEPIE_CACHE_IMAGES
) {
414 $disabled = "disabled" ;
415 $label_class = "class='insensitive'" ;
418 print "<br/><input type= \" checkbox \" id= \" cache_images \"
419 name= \" cache_images \" $disabled
420 $checked > <label $label_class for= \" cache_images \" >" .
421 __ ( 'Cache images locally' ). "</label>" ;
433 print "<div class= \" dlgSec \" >" . __ ( "Icon" ). "</div>" ;
434 print "<div class= \" dlgSecCont \" >" ;
436 print "<iframe name= \" icon_upload_iframe \"
437 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
439 print "<form style='display : block' target= \" icon_upload_iframe \"
440 enctype= \" multipart/form-data \" method= \" POST \"
441 action= \" backend.php \" >
442 <input id= \" icon_file \" size= \" 10 \" name= \" icon_file \" type= \" file \" >
443 <input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >
444 <input type= \" hidden \" name= \" feed_id \" value= \" $feed_id\" >
445 <input type= \" hidden \" name= \" subop \" value= \" uploadicon \" >
446 <button onclick= \" return uploadFeedIcon(); \"
447 type= \" submit \" >" . __ ( 'Replace' ). "</button>
448 <button onclick= \" return removeFeedIcon( $feed_id ); \"
449 type= \" submit \" >" . __ ( 'Remove' ). "</button>
454 $title = htmlspecialchars ( $title , ENT_QUOTES
);
456 print "<div class='dlgButtons'>
457 <div style= \" float : left \" >
458 <button onclick='return unsubscribeFeed( $feed_id , \" $title\" )'>" .
459 __ ( 'Unsubscribe' ). "</button>
461 <button onclick= \" return feedEditSave() \" >" . __ ( 'Save' ). "</button>
462 <button onclick= \" return feedEditCancel() \" >" . __ ( 'Cancel' ). "</button>
465 print "]]></content></dlg>" ;
470 if ( $subop == "editfeeds" ) {
472 $feed_ids = db_escape_string ( $_REQUEST [ "ids" ]);
474 header ( "Content-Type: text/xml" );
475 print "<dlg id= \" $subop\" >" ;
476 print "<title>" . __ ( 'Multiple Feed Editor' ). "</title>" ;
477 print "<content><![CDATA[" ;
479 print "<form id= \" batch_edit_feed_form \" onsubmit= \" return false \" >" ;
481 print "<input type= \" hidden \" name= \" ids \" value= \" $feed_ids\" >" ;
482 print "<input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >" ;
483 print "<input type= \" hidden \" name= \" subop \" value= \" batchEditSave \" >" ;
485 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
486 print "<div class= \" dlgSecCont \" >" ;
490 print "<input disabled style= \" font-size : 16px \" size= \" 35 \" onkeypress= \" return filterCR(event, feedEditSave) \"
491 name= \" title \" value= \" $title\" >" ;
493 batch_edit_cbox ( "title" );
499 print __ ( 'URL:' ) . " " ;
500 print "<input disabled size= \" 40 \" onkeypress= \" return filterCR(event, feedEditSave) \"
501 name= \" feed_url \" value= \" $feed_url\" >" ;
503 batch_edit_cbox ( "feed_url" );
507 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
511 print __ ( 'Place in category:' ) . " " ;
513 print_feed_cat_select ( $link , "cat_id" , $cat_id , "disabled" );
515 batch_edit_cbox ( "cat_id" );
521 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
522 print "<div class= \" dlgSecCont \" >" ;
524 /* Update Interval */
526 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
529 batch_edit_cbox ( "update_interval" );
533 print " " . __ ( 'using' ) . " " ;
534 print_select_hash ( "update_method" , $update_method , $update_methods ,
536 batch_edit_cbox ( "update_method" );
540 if ( FORCE_ARTICLE_PURGE
!= 0 ) {
544 print __ ( 'Article purging:' ) . " " ;
546 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
549 batch_edit_cbox ( "purge_interval" );
553 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
554 print "<div class= \" dlgSecCont \" >" ;
556 print __ ( 'Login:' ) . " " ;
557 print "<input disabled size= \" 15 \" onkeypress= \" return filterCR(event, feedEditSave) \"
558 name= \" auth_login \" value= \" $auth_login\" >" ;
560 batch_edit_cbox ( "auth_login" );
562 print " " . __ ( "Password:" ) . " " ;
564 print "<input disabled size= \" 15 \" type= \" password \" name= \" auth_pass \"
565 onkeypress= \" return filterCR(event, feedEditSave) \"
566 value= \" $auth_pass\" >" ;
568 batch_edit_cbox ( "auth_pass" );
571 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
572 print "<div class= \" dlgSecCont \" >" ;
574 print "<div style= \" line-height : 100% \" >" ;
576 print "<input disabled type= \" checkbox \" name= \" private \" id= \" private \"
577 $checked > <label id= \" private_l \" class='insensitive' for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
579 print " " ; batch_edit_cbox ( "private" , "private_l" );
581 print "<br/><input disabled type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
582 $checked > <label class='insensitive' id= \" rtl_content_l \" for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
584 print " " ; batch_edit_cbox ( "rtl_content" , "rtl_content_l" );
586 print "<br/><input disabled type= \" checkbox \" id= \" include_in_digest \"
587 name= \" include_in_digest \"
588 $checked > <label id= \" include_in_digest_l \" class='insensitive' for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
590 print " " ; batch_edit_cbox ( "include_in_digest" , "include_in_digest_l" );
592 print "<br/><input disabled type= \" checkbox \" id= \" always_display_enclosures \"
593 name= \" always_display_enclosures \"
594 $checked > <label id= \" always_display_enclosures_l \" class='insensitive' for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
596 print " " ; batch_edit_cbox ( "always_display_enclosures" , "always_display_enclosures_l" );
598 print "<br/><input disabled type= \" checkbox \" id= \" cache_images \"
599 name= \" cache_images \"
600 $checked > <label class='insensitive' id= \" cache_images_l \"
601 for= \" cache_images \" >" .
602 __ ( 'Cache images locally' ). "</label>" ;
605 if ( SIMPLEPIE_CACHE_IMAGES
) {
606 print " " ; batch_edit_cbox ( "cache_images" , "cache_images_l" );
614 print "<div class='dlgButtons'>
615 <input type= \" submit \" class= \" button \"
616 onclick= \" return feedsEditSave() \" value= \" " . __ ( 'Save' ). " \" >
617 <input type='submit' class='button'
618 onclick= \" return feedEditCancel() \" value= \" " . __ ( 'Cancel' ). " \" >
621 print "]]></content></dlg>" ;
626 if ( $subop == "editSave" ||
$subop == "batchEditSave" ) {
628 $feed_title = db_escape_string ( trim ( $_POST [ "title" ]));
629 $feed_link = db_escape_string ( trim ( $_POST [ "feed_url" ]));
630 $upd_intl = db_escape_string ( $_POST [ "update_interval" ]);
631 $purge_intl = db_escape_string ( $_POST [ "purge_interval" ]);
632 $feed_id = db_escape_string ( $_POST [ "id" ]); /* editSave */
633 $feed_ids = db_escape_string ( $_POST [ "ids" ]); /* batchEditSave */
634 $cat_id = db_escape_string ( $_POST [ "cat_id" ]);
635 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
636 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
637 $private = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "private" ]));
638 $rtl_content = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "rtl_content" ]));
639 $include_in_digest = checkbox_to_sql_bool (
640 db_escape_string ( $_POST [ "include_in_digest" ]));
641 $cache_images = checkbox_to_sql_bool (
642 db_escape_string ( $_POST [ "cache_images" ]));
643 $update_method = ( int ) db_escape_string ( $_POST [ "update_method" ]);
645 $always_display_enclosures = checkbox_to_sql_bool (
646 db_escape_string ( $_POST [ "always_display_enclosures" ]));
648 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
649 if ( $cat_id && $cat_id != 0 ) {
650 $category_qpart = "cat_id = ' $cat_id '," ;
651 $category_qpart_nocomma = "cat_id = ' $cat_id '" ;
653 $category_qpart = 'cat_id = NULL,' ;
654 $category_qpart_nocomma = 'cat_id = NULL' ;
657 $category_qpart = "" ;
658 $category_qpart_nocomma = "" ;
661 if ( SIMPLEPIE_CACHE_IMAGES
) {
662 $cache_images_qpart = "cache_images = $cache_images ," ;
664 $cache_images_qpart = "" ;
667 if ( $subop == "editSave" ) {
669 $result = db_query ( $link , "UPDATE ttrss_feeds SET
671 title = ' $feed_title ', feed_url = ' $feed_link ',
672 update_interval = ' $upd_intl ',
673 purge_interval = ' $purge_intl ',
674 auth_login = ' $auth_login ',
675 auth_pass = ' $auth_pass ',
677 rtl_content = $rtl_content ,
679 include_in_digest = $include_in_digest ,
680 always_display_enclosures = $always_display_enclosures ,
681 update_method = ' $update_method '
682 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
684 } else if ( $subop == "batchEditSave" ) {
685 $feed_data = array ();
687 foreach ( array_keys ( $_POST ) as $k ) {
688 if ( $k != "op" && $k != "subop" && $k != "ids" ) {
689 $feed_data [ $k ] = $_POST [ $k ];
693 db_query ( $link , "BEGIN" );
695 foreach ( array_keys ( $feed_data ) as $k ) {
701 $qpart = "title = ' $feed_title '" ;
705 $qpart = "feed_url = ' $feed_link '" ;
708 case "update_interval" :
709 $qpart = "update_interval = ' $upd_intl '" ;
712 case "purge_interval" :
713 $qpart = "purge_interval = ' $purge_intl '" ;
717 $qpart = "auth_login = ' $auth_login '" ;
721 $qpart = "auth_pass = ' $auth_pass '" ;
725 $qpart = "private = ' $private '" ;
728 case "include_in_digest" :
729 $qpart = "include_in_digest = ' $include_in_digest '" ;
732 case "always_display_enclosures" :
733 $qpart = "always_display_enclosures = ' $always_display_enclosures '" ;
737 $qpart = "cache_images = ' $cache_images '" ;
741 $qpart = "rtl_content = ' $rtl_content '" ;
744 case "update_method" :
745 $qpart = "update_method = ' $update_method '" ;
749 $qpart = $category_qpart_nocomma ;
756 "UPDATE ttrss_feeds SET $qpart WHERE id IN ( $feed_ids )
757 AND owner_uid = " . $_SESSION [ "uid" ]);
762 db_query ( $link , "COMMIT" );
767 if ( $subop == "remove" ) {
769 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
771 foreach ( $ids as $id ) {
772 remove_feed ( $link , $id , $_SESSION [ "uid" ]);
778 if ( $subop == "clear" ) {
779 $id = db_escape_string ( $_REQUEST [ "id" ]);
780 clear_feed_articles ( $link , $id );
783 if ( $subop == "rescore" ) {
784 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
786 foreach ( $ids as $id ) {
788 $filters = load_filters ( $link , $id , $_SESSION [ "uid" ], 6 );
790 $result = db_query ( $link , "SELECT
791 title, content, link, ref_id, author," .
792 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
794 ttrss_user_entries, ttrss_entries
795 WHERE ref_id = id AND feed_id = ' $id ' AND
796 owner_uid = " . $_SESSION [ 'uid' ]. "
801 while ( $line = db_fetch_assoc ( $result )) {
803 $tags = get_article_tags ( $link , $line [ "ref_id" ]);
805 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
806 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
807 $line [ 'author' ], $tags );
809 $new_score = calculate_article_score ( $article_filters );
811 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
813 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
816 foreach ( array_keys ( $scores ) as $s ) {
818 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ',
820 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
821 } else if ( $s < - 500 ) {
822 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ',
824 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
826 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
827 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
832 print __ ( "All done." );
836 if ( $subop == "rescoreAll" ) {
838 $result = db_query ( $link ,
839 "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION [ 'uid' ]);
841 while ( $feed_line = db_fetch_assoc ( $result )) {
843 $id = $feed_line [ "id" ];
845 $filters = load_filters ( $link , $id , $_SESSION [ "uid" ], 6 );
847 $tmp_result = db_query ( $link , "SELECT
848 title, content, link, ref_id, author," .
849 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
851 ttrss_user_entries, ttrss_entries
852 WHERE ref_id = id AND feed_id = ' $id ' AND
853 owner_uid = " . $_SESSION [ 'uid' ]. "
858 while ( $line = db_fetch_assoc ( $tmp_result )) {
860 $tags = get_article_tags ( $link , $line [ "ref_id" ]);
862 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
863 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
864 $line [ 'author' ], $tags );
866 $new_score = calculate_article_score ( $article_filters );
868 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
870 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
873 foreach ( array_keys ( $scores ) as $s ) {
875 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ',
877 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
879 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
880 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
885 print __ ( "All done." );
889 if ( $subop == "add" ) {
891 $feed_url = db_escape_string ( trim ( $_REQUEST [ "feed_url" ]));
892 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
893 $p_from = db_escape_string ( $_REQUEST [ "from" ]);
895 /* only read authentication information from POST */
897 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
898 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
900 if ( $p_from != 'tt-rss' ) {
903 <title>Tiny Tiny RSS</title>
904 <link rel= \" stylesheet \" type= \" text/css \" href= \" utility.css \" >
907 <img class= \" floatingLogo \" src= \" images/ttrss_logo.png \"
908 alt= \" Tiny Tiny RSS \" />
909 <h1>Subscribe to feed...</h1>" ;
912 $rc = subscribe_to_feed ( $link , $feed_url , $cat_id , $auth_login , $auth_pass );
916 print_notice ( T_sprintf ( "Subscribed to <b> %s </b>." , $feed_url ));
919 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>." , $feed_url ));
922 print_warning ( T_sprintf ( "Already subscribed to <b> %s </b>." , $feed_url ));
926 if ( $p_from != 'tt-rss' ) {
927 $tt_uri = ( $_SERVER [ 'HTTPS' ] != "on" ?
'http://' : 'https://' ) . $_SERVER [ 'HTTP_HOST' ] . preg_replace ( '/backend\.php.*$/' , 'tt-rss.php' , $_SERVER [ "REQUEST_URI" ]);
930 $tp_uri = ( $_SERVER [ 'HTTPS' ] != "on" ?
'http://' : 'https://' ) . $_SERVER [ 'HTTP_HOST' ] . preg_replace ( '/backend\.php.*$/' , 'prefs.php' , $_SERVER [ "REQUEST_URI" ]);
932 $result = db_query ( $link , "SELECT id FROM ttrss_feeds WHERE
933 feed_url = ' $feed_url ' AND owner_uid = " . $_SESSION [ "uid" ]);
935 $feed_id = db_fetch_result ( $result , 0 , "id" );
940 print "<form method= \" GET \" style='display: inline'
942 <input type= \" hidden \" name= \" tab \" value= \" feedConfig \" >
943 <input type= \" hidden \" name= \" subop \" value= \" editFeed \" >
944 <input type= \" hidden \" name= \" subopparam \" value= \" $feed_id\" >
945 <input type= \" submit \" value= \" " . __ ( "Edit subscription options" ). " \" >
949 print "<form style='display: inline' method= \" GET \" action= \" $tt_uri\" >
950 <input type= \" submit \" value= \" " . __ ( "Return to Tiny Tiny RSS" ). " \" >
953 print "</body></html>" ;
958 if ( $subop == "categorize" ) {
961 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
963 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
966 $cat_id_qpart = 'NULL' ;
968 $cat_id_qpart = "' $cat_id '" ;
971 db_query ( $link , "BEGIN" );
973 foreach ( $ids as $id ) {
975 db_query ( $link , "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
977 AND owner_uid = " . $_SESSION [ "uid" ]);
981 db_query ( $link , "COMMIT" );
985 if ( $subop == "editCats" ) {
987 $action = $_REQUEST [ "action" ];
989 if ( $action == "save" ) {
991 $cat_title = db_escape_string ( trim ( $_REQUEST [ "value" ]));
992 $cat_id = db_escape_string ( $_REQUEST [ "cid" ]);
994 db_query ( $link , "BEGIN" );
996 $result = db_query ( $link , "SELECT title FROM ttrss_feed_categories
997 WHERE id = ' $cat_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
999 if ( db_num_rows ( $result ) == 1 ) {
1001 $old_title = db_fetch_result ( $result , 0 , "title" );
1003 if ( $cat_title != "" ) {
1004 $result = db_query ( $link , "UPDATE ttrss_feed_categories SET
1005 title = ' $cat_title ' WHERE id = ' $cat_id ' AND
1006 owner_uid = " . $_SESSION [ "uid" ]);
1013 print $_REQUEST [ "value" ];
1016 db_query ( $link , "COMMIT" );
1022 header ( "Content-Type: text/xml" );
1023 print "<dlg id= \" $subop\" >" ;
1024 print "<title>" . __ ( 'Category editor' ). "</title>" ;
1025 print "<content><![CDATA[" ;
1027 if ( $action == "add" ) {
1029 $feed_cat = db_escape_string ( trim ( $_REQUEST [ "cat" ]));
1031 if (! add_feed_category ( $link , $feed_cat ))
1032 print_warning ( T_sprintf ( "Category <b>$ %s </b> already exists in the database." , $feed_cat ));
1036 if ( $action == "remove" ) {
1038 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
1040 foreach ( $ids as $id ) {
1041 remove_feed_category ( $link , $id , $_SESSION [ "uid" ]);
1046 <input id= \" fadd_cat \"
1047 onkeypress= \" return filterCR(event, addFeedCat) \"
1049 <button onclick= \" addFeedCat() \" >" .
1050 __ ( 'Create category' ). "</button></div>" ;
1052 $result = db_query ( $link , "SELECT title,id FROM ttrss_feed_categories
1053 WHERE owner_uid = " . $_SESSION [ "uid" ]. "
1058 if ( db_num_rows ( $result ) != 0 ) {
1060 print __ ( 'Select:' ). "
1061 <a href= \" # \" onclick= \" selectTableRows('prefFeedCatList', 'all') \" >" . __ ( 'All' ). "</a>,
1062 <a href= \" # \" onclick= \" selectTableRows('prefFeedCatList', 'none') \" >" . __ ( 'None' ). "</a>" ;
1064 print "<div class= \" prefFeedCatHolder \" >" ;
1066 print "<form id= \" feed_cat_edit_form \" onsubmit= \" return false \" >" ;
1068 print "<table width= \" 100% \" class= \" prefFeedCatList \"
1069 cellspacing= \" 0 \" id= \" prefFeedCatList \" >" ;
1073 while ( $line = db_fetch_assoc ( $result )) {
1075 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
1077 $cat_id = $line [ "id" ];
1078 $this_row_id = "id= \" FCATR- $cat_id\" " ;
1080 print "<tr class= \" $class\" $this_row_id >" ;
1082 $edit_title = htmlspecialchars ( $line [ "title" ]);
1084 print "<td width='5%' align='center'><input
1085 onclick='toggleSelectRow(this);'
1086 type= \" checkbox \" id= \" FCCHK- $cat_id\" ></td>" ;
1088 print "<td><span id= \" FCATT- $cat_id\" >" .
1089 $edit_title . "</span></td>" ;
1103 print "<p>" . __ ( 'No feed categories defined.' ). "</p>" ;
1106 print "<div class='dlgButtons'>
1107 <div style='float : left'>
1108 <button onclick= \" return removeSelectedFeedCats() \" >" .
1109 __ ( 'Remove' ). "</button>
1112 print "<button onclick= \" selectTab('feedConfig') \" >" .
1113 __ ( 'Close this window' ). "</button></div>" ;
1115 print "]]></content></dlg>" ;
1123 print "<div dojoType= \" dijit.layout.AccordionContainer \" region= \" center \" >" ;
1124 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Feeds' ). " \" >" ;
1126 set_pref ( $link , "_PREFS_ACTIVE_TAB" , "feedConfig" );
1128 $result = db_query ( $link , "SELECT COUNT(id) AS num_errors
1129 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
1131 $num_errors = db_fetch_result ( $result , 0 , "num_errors" );
1133 if ( $num_errors > 0 ) {
1135 $error_button = "<button dojoType= \" dijit.form.Button \"
1136 onclick= \" showFeedsWithErrors \" id= \" errorButton \" >" .
1137 __ ( "Feeds with errors" ) . "</button>" ;
1139 // print format_notice("<a href=\"javascript:showFeedsWithErrors()\">".
1140 // __('Some feeds have update errors (click for details)')."</a>");
1143 $feed_search = db_escape_string ( $_REQUEST [ "search" ]);
1145 if ( array_key_exists ( "search" , $_REQUEST )) {
1146 $_SESSION [ "prefs_feed_search" ] = $feed_search ;
1148 $feed_search = $_SESSION [ "prefs_feed_search" ];
1151 print "<div dojoType= \" dijit.Toolbar \" >" ;
1154 print "<div style='float : right'>
1155 <input id=\"feed_search\" size=\"20\" type=\"search\"
1156 onfocus=\"disableHotkeys();\"
1157 onblur=\"enableHotkeys();\"
1158 onchange=\"updateFeedList()\" value=\"$feed_search\">
1159 <button onclick=\"updateFeedList()\">".
1160 __('Search')."</button>
1163 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1164 "<span>" . __ ( 'Select' ). "</span>" ;
1165 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1166 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(true) \"
1167 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
1168 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(false) \"
1169 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
1170 print "</div></div>" ;
1172 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1173 "<span>" . __ ( 'Feeds' ). "</span>" ;
1174 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1175 print "<div onclick= \" quickAddFeed() \"
1176 dojoType= \" dijit.MenuItem \" >" . __ ( 'Subscribe to feed' ). "</div>" ;
1177 print "<div onclick= \" editSelectedFeed() \"
1178 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit selected feeds' ). "</div>" ;
1179 print "<div onclick= \" resetFeedOrder() \"
1180 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1181 print "</div></div>" ;
1183 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
1184 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1185 "<span>" . __ ( 'Categories' ). "</span>" ;
1186 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1187 print "<div onclick= \" editFeedCats() \"
1188 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit categories' ). "</div>" ;
1189 print "<div onclick= \" resetCatOrder() \"
1190 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1191 print "</div></div>" ;
1195 print $error_button ;
1197 print "<button dojoType= \" dijit.form.Button \" onclick= \" removeSelectedFeeds() \" >"
1198 . __ ( 'Unsubscribe' ). "</button dojoType= \" dijit.form.Button \" > " ;
1200 if ( defined ( '_ENABLE_FEED_DEBUGGING' )) {
1202 print "<select id= \" feedActionChooser \" onchange= \" feedActionChange() \" >
1203 <option value= \" facDefault \" selected>" . __ ( 'More actions...' ). "</option>" ;
1205 if ( FORCE_ARTICLE_PURGE
== 0 ) {
1207 "<option value= \" facPurge \" >" . __ ( 'Manual purge' ). "</option>" ;
1211 <option value= \" facClear \" >" . __ ( 'Clear feed data' ). "</option>
1212 <option value= \" facRescore \" >" . __ ( 'Rescore articles' ). "</option>" ;
1218 print "</div>" ; # toolbar
1220 print "<div id= \" feedlistLoading \" >
1221 <img src='images/indicator_tiny.gif'>" .
1222 __ ( "Loading, please wait..." ). "</div>" ;
1224 print "<div dojoType= \" fox.PrefFeedStore \" jsId= \" feedStore \"
1225 url= \" backend.php?op=pref-feeds&subop=getfeedtree \" >
1227 <div dojoType= \" lib.CheckBoxStoreModel \" jsId= \" feedModel \" store= \" feedStore \"
1228 query= \" {id:'root'} \" rootId= \" root \" rootLabel= \" Feeds \"
1229 childrenAttrs= \" items \" checkboxStrict= \" false \" checkboxAll= \" false \" >
1231 <div dojoType= \" fox.PrefFeedTree \" id= \" feedTree \"
1232 dndController= \" dijit.tree.dndSource \"
1233 betweenThreshold= \" 5 \"
1234 model= \" feedModel \" openOnClick= \" false \" >
1235 <script type= \" dojo/method \" event= \" onClick \" args= \" item \" >
1236 var id = String(item.id);
1237 var bare_id = id.substr(id.indexOf(':')+1);
1239 if (id.match('FEED:')) {
1240 editFeed(bare_id, event);
1241 } else if (id.match('CAT:')) {
1242 editCat(bare_id, item, event);
1245 <script type= \" dojo/method \" event= \" onLoad \" args= \" item \" >
1246 Element.hide( \" feedlistLoading \" );
1250 print "<div dojoType= \" dijit.Tooltip \" connectId= \" feedTree \" position= \" below \" >
1251 <b>Hint:</b> you can drag feeds and categories around.
1254 print "</div>" ; # feeds pane
1256 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'OPML' ). " \" >" ;
1258 print "<p>" . __ ( "Using OPML you can export and import your feeds and Tiny Tiny RSS settings." );
1260 print "<div class= \" insensitive \" >" . __ ( "Note: Only main settings profile can be migrated using OPML." ) . "</div>" ;
1264 print "<iframe name= \" upload_iframe \"
1265 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
1267 print "<div style='float : left'>" ;
1268 print "<form style='display : block' target= \" upload_iframe \"
1269 enctype= \" multipart/form-data \" method= \" POST \"
1270 action= \" backend.php \" >
1271 <input id= \" opml_file \" name= \" opml_file \" type= \" file \" >
1272 <input type= \" hidden \" name= \" op \" value= \" dlg \" >
1273 <input type= \" hidden \" name= \" id \" value= \" importOpml \" >
1274 <button onclick= \" return opmlImport(); \"
1275 type= \" submit \" >" . __ ( 'Import' ). "</button>
1277 print "</div> " ;
1279 print "<button onclick= \" gotoExportOpml() \" >" . __ ( 'Export OPML' ). "</button>" ;
1281 print "<p>" . __ ( 'Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.' );
1283 print "<div class= \" insensitive \" >" . __ ( "Note: Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds." ) . "</div>" . "</p>" ;
1285 print "<button onclick= \" return displayDlg('pubOPMLUrl') \" >" .
1286 __ ( 'Display URL' ). "</button> " ;
1289 print "</div>" ; # pane
1291 if ( strpos ( $_SERVER [ 'HTTP_USER_AGENT' ], "Firefox" ) !== false ) {
1293 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Firefox integration' ). " \" >" ;
1295 print "<p>" . __ ( 'This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.' ) . "</p>" ;
1299 print "<button onclick='window.navigator.registerContentHandler(" .
1300 " \" application/vnd.mozilla.maybe.feed \" , " .
1301 " \" " . add_feed_url () . " \" , " . " \" Tiny Tiny RSS \" )'>" .
1302 __ ( 'Click here to register this site as a feed reader.' ) .
1307 print "</div>" ; # pane
1310 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Subscribing using bookmarklet' ). " \" >" ;
1312 print "<p>" . __ ( "Drag the link below to your browser toolbar, open the feed you're interested in in your browser and click on the link to subscribe to it." ) . "</p>" ;
1314 $bm_subscribe_url = str_replace ( ' %s ' , '' , add_feed_url ());
1316 $confirm_str = __ ( 'Subscribe to %s in Tiny Tiny RSS?' );
1318 $bm_url = htmlspecialchars ( "javascript:{if(confirm(' $confirm_str '.replace(' %s ',window.location.href)))window.location.href=' $bm_subscribe_url '+window.location.href}" );
1320 print "<a href= \" $bm_url\" class='visibleLink'>" . __ ( 'Subscribe in Tiny Tiny RSS' ). "</a>" ;
1322 print "</div>" ; #pane
1324 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Published articles and generated feeds' ). " \" >" ;
1326 print "<p>" . __ ( 'Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.' ). "</p>" ;
1328 $rss_url = '-2::' . htmlspecialchars ( get_self_url_prefix () .
1329 "/backend.php?op=rss&id=-2&view-mode=all_articles" );;
1331 print "<button onclick= \" return displayDlg('generatedFeed', ' $rss_url ') \" >" .
1332 __ ( 'Display URL' ). "</button> " ;
1334 print "<button onclick= \" return clearFeedAccessKeys() \" >" .
1335 __ ( 'Clear all generated URLs' ). "</button> " ;
1337 print "</div>" ; #pane
1338 print "</div>" ; #container
1342 function print_feed_browser ( $link , $search , $limit , $mode = 1 ) {
1344 $owner_uid = $_SESSION [ "uid" ];
1347 $search_qpart = "AND (UPPER(feed_url) LIKE UPPER('% $search %') OR
1348 UPPER(title) LIKE UPPER('% $search %'))" ;
1354 $result = db_query ( $link , "SELECT feed_url, subscribers FROM
1355 ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
1356 WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url
1357 AND owner_uid = ' $owner_uid ') $search_qpart
1358 ORDER BY subscribers DESC LIMIT $limit " );
1359 } else if ( $mode == 2 ) {
1360 $result = db_query ( $link , "SELECT *,
1361 (SELECT COUNT(*) FROM ttrss_user_entries WHERE
1362 orig_feed_id = ttrss_archived_feeds.id) AS articles_archived
1364 ttrss_archived_feeds
1366 (SELECT COUNT(*) FROM ttrss_feeds
1367 WHERE ttrss_feeds.feed_url = ttrss_archived_feeds.feed_url AND
1368 owner_uid = ' $owner_uid ') = 0 AND
1369 owner_uid = ' $owner_uid ' $search_qpart
1370 ORDER BY id DESC LIMIT $limit " );
1375 while ( $line = db_fetch_assoc ( $result )) {
1379 $feed_url = $line [ "feed_url" ];
1380 $subscribers = $line [ "subscribers" ];
1382 $det_result = db_query ( $link , "SELECT site_url,title,id
1383 FROM ttrss_feeds WHERE feed_url = ' $feed_url ' LIMIT 1" );
1385 $details = db_fetch_assoc ( $det_result );
1387 $icon_file = ICONS_DIR
. "/" . $details [ "id" ] . ".ico" ;
1389 if ( file_exists ( $icon_file ) && filesize ( $icon_file ) > 0 ) {
1390 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" " . ICONS_URL
.
1391 "/" . $details [ "id" ]. ".ico \" >" ;
1393 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" images/blank_icon.gif \" >" ;
1396 $check_box = "<input onclick='toggleSelectListRow(this)'
1397 class='feedBrowseCB'
1398 type= \" checkbox \" id= \" FBCHK-" . $details [ "id" ] . " \" >" ;
1400 $class = ( $feedctr %
2 ) ?
"even" : "odd" ;
1402 $feed_url = htmlspecialchars ( $line [ "feed_url" ]);
1404 if ( $details [ "site_url" ]) {
1405 $site_url = "<a target= \" _blank \" href= \" " .
1406 htmlspecialchars ( $details [ "site_url" ]). " \" >
1407 <img style='border-width : 0px' src='images/www.png' alt='www'></a>" ;
1412 $feed_url = "<a target= \" _blank \" href= \" $feed_url\" ><img
1413 style='border-width : 0px; vertical-align : middle'
1414 src='images/feed-icon-12x12.png'></a>" ;
1416 print "<li title= \" " . htmlspecialchars ( $details [ "site_url" ]). " \"
1417 class=' $class ' id= \" FBROW-" . $details [ "id" ]. " \" > $check_box " .
1418 " $feed_icon $feed_url " . htmlspecialchars ( $details [ "title" ]) .
1419 " <span class='subscribers'>( $subscribers )</span>
1422 } else if ( $mode == 2 ) {
1423 $feed_url = htmlspecialchars ( $line [ "feed_url" ]);
1424 $site_url = htmlspecialchars ( $line [ "site_url" ]);
1425 $title = htmlspecialchars ( $line [ "title" ]);
1427 $icon_file = ICONS_DIR
. "/" . $line [ "id" ] . ".ico" ;
1429 if ( file_exists ( $icon_file ) && filesize ( $icon_file ) > 0 ) {
1430 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" " . ICONS_URL
.
1431 "/" . $line [ "id" ]. ".ico \" >" ;
1433 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" images/blank_icon.gif \" >" ;
1436 $check_box = "<input onclick='toggleSelectListRow(this)' class='feedBrowseCB'
1437 type= \" checkbox \" id= \" FBCHK-" . $line [ "id" ] . " \" >" ;
1439 $class = ( $feedctr %
2 ) ?
"even" : "odd" ;
1441 if ( $line [ 'articles_archived' ] > 0 ) {
1442 $archived = sprintf ( __ ( " %d archived articles" ), $line [ 'articles_archived' ]);
1443 $archived = " <span class='subscribers'>( $archived )</span>" ;
1448 if ( $line [ "site_url" ]) {
1449 $site_url = "<a target= \" _blank \" href= \" $site_url\" >
1450 <img style='border-width : 0px' src='images/www.png' alt='www'></a>" ;
1455 $feed_url = "<a target= \" _blank \" href= \" $feed_url\" ><img
1456 style='border-width : 0px; vertical-align : middle'
1457 src='images/feed-icon-12x12.png'></a>" ;
1459 print "<li title='" . $line [ 'site_url' ]. "' class=' $class '
1460 id= \" FBROW-" . $line [ "id" ]. " \" >" .
1461 $check_box . " $feed_icon $feed_url " . $title .
1462 $archived . $site_url . "</li>" ;
1470 if ( $feedctr == 0 ) {
1471 print "<li style= \" text-align : center \" ><p>" . __ ( 'No feeds found.' ). "</p></li>" ;