]>
git.wh0rd.org - tt-rss.git/blob - classes/pref/feeds.php
ca6fffde08cce40fc2124499aed4cf46d06150e2
2 class Pref_Feeds
extends Handler_Protected
{
3 public static $feed_languages = array ( "English" , "Danish" , "Dutch" , "Finnish" , "French" , "German" , "Hungarian" , "Italian" , "Norwegian" ,
4 "Portuguese" , "Russian" , "Spanish" , "Swedish" , "Turkish" , "Simple" );
6 function csrf_ignore ( $method ) {
7 $csrf_ignored = array ( "index" , "getfeedtree" , "add" , "editcats" , "editfeed" ,
8 "savefeedorder" , "uploadicon" , "feedswitherrors" , "inactivefeeds" ,
11 return array_search ( $method , $csrf_ignored ) !== false ;
14 function batch_edit_cbox ( $elem , $label = false ) {
15 print "<input type= \" checkbox \" title= \" " . __ ( "Check to enable field" ). " \"
16 onchange= \" dijit.byId('feedEditDlg').toggleField(this, ' $elem ', ' $label ') \" >" ;
19 function renamecat () {
20 $title = $_REQUEST [ 'title' ];
21 $id = $_REQUEST [ 'id' ];
24 $sth = $this -> pdo
-> prepare ( "UPDATE ttrss_feed_categories SET
25 title = ? WHERE id = ? AND owner_uid = ?" );
26 $sth -> execute ([ $title , $id , $_SESSION [ 'uid' ]]);
31 private function get_category_items ( $cat_id ) {
33 if ( $_REQUEST [ 'mode' ] != 2 )
34 $search = $_SESSION [ "prefs_feed_search" ];
38 // first one is set by API
39 $show_empty_cats = $_REQUEST [ 'force_show_empty' ] ||
40 ( $_REQUEST [ 'mode' ] != 2 && ! $search );
44 $sth = $this -> pdo
-> prepare ( "SELECT id, title FROM ttrss_feed_categories
45 WHERE owner_uid = ? AND parent_cat = ? ORDER BY order_id, title" );
46 $sth -> execute ([ $_SESSION [ 'uid' ], $cat_id ]);
48 while ( $line = $sth -> fetch ()) {
51 $cat [ 'id' ] = 'CAT:' . $line [ 'id' ];
52 $cat [ 'bare_id' ] = ( int ) $line [ 'id' ];
53 $cat [ 'name' ] = $line [ 'title' ];
54 $cat [ 'items' ] = array ();
55 $cat [ 'checkbox' ] = false ;
56 $cat [ 'type' ] = 'category' ;
58 $cat [ 'child_unread' ] = 0 ;
59 $cat [ 'auxcounter' ] = 0 ;
60 $cat [ 'parent_id' ] = $cat_id ;
62 $cat [ 'items' ] = $this -> get_category_items ( $line [ 'id' ]);
64 $num_children = $this -> calculate_children_count ( $cat );
65 $cat [ 'param' ] = vsprintf ( _ngettext ( '( %d feed)' , '( %d feeds)' , ( int ) $num_children ), $num_children );
67 if ( $num_children > 0 ||
$show_empty_cats )
68 array_push ( $items , $cat );
72 $fsth = $this -> pdo
-> prepare ( "SELECT id, title, last_error,
73 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
75 WHERE cat_id = :cat AND
77 (:search = '' OR (LOWER(title) LIKE :search OR LOWER(feed_url) LIKE :search))
78 ORDER BY order_id, title" );
80 $fsth -> execute ([ ":cat" => $cat_id , ":uid" => $_SESSION [ 'uid' ], ":search" => $search ?
"% $search %" : "" ]);
82 while ( $feed_line = $fsth -> fetch ()) {
84 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
85 $feed [ 'bare_id' ] = ( int ) $feed_line [ 'id' ];
86 $feed [ 'auxcounter' ] = 0 ;
87 $feed [ 'name' ] = $feed_line [ 'title' ];
88 $feed [ 'checkbox' ] = false ;
90 $feed [ 'error' ] = $feed_line [ 'last_error' ];
91 $feed [ 'icon' ] = Feeds
:: getFeedIcon ( $feed_line [ 'id' ]);
92 $feed [ 'param' ] = make_local_datetime (
93 $feed_line [ 'last_updated' ], true );
95 array_push ( $items , $feed );
101 function getfeedtree () {
102 print json_encode ( $this -> makefeedtree ());
105 function makefeedtree () {
107 if ( $_REQUEST [ 'mode' ] != 2 )
108 $search = $_SESSION [ "prefs_feed_search" ];
112 if ( $search ) $search_qpart = " AND LOWER(title) LIKE LOWER('% $search %')" ;
115 $root [ 'id' ] = 'root' ;
116 $root [ 'name' ] = __ ( 'Feeds' );
117 $root [ 'items' ] = array ();
118 $root [ 'type' ] = 'category' ;
120 $enable_cats = get_pref ( 'ENABLE_FEED_CATS' );
122 if ( $_REQUEST [ 'mode' ] == 2 ) {
125 $cat = $this -> feedlist_init_cat (- 1 );
127 $cat [ 'items' ] = array ();
130 foreach ( array (- 4 , - 3 , - 1 , - 2 , 0 , - 6 ) as $i ) {
131 array_push ( $cat [ 'items' ], $this -> feedlist_init_feed ( $i ));
134 /* Plugin feeds for -1 */
136 $feeds = PluginHost
:: getInstance ()-> get_feeds (- 1 );
139 foreach ( $feeds as $feed ) {
140 $feed_id = PluginHost
:: pfeed_to_feed_id ( $feed [ 'id' ]);
143 $item [ 'id' ] = 'FEED:' . $feed_id ;
144 $item [ 'bare_id' ] = ( int ) $feed_id ;
145 $item [ 'auxcounter' ] = 0 ;
146 $item [ 'name' ] = $feed [ 'title' ];
147 $item [ 'checkbox' ] = false ;
149 $item [ 'icon' ] = $feed [ 'icon' ];
152 $item [ 'unread' ] = 0 ; //$feed['sender']->get_unread($feed['id']);
153 $item [ 'type' ] = 'feed' ;
155 array_push ( $cat [ 'items' ], $item );
160 array_push ( $root [ 'items' ], $cat );
162 $root [ 'items' ] = array_merge ( $root [ 'items' ], $cat [ 'items' ]);
165 $result = db_query ( "SELECT * FROM
166 ttrss_labels2 WHERE owner_uid = " . $_SESSION [ 'uid' ]. " ORDER by caption" );
168 if ( db_num_rows ( $result ) > 0 ) {
170 if ( get_pref ( 'ENABLE_FEED_CATS' )) {
171 $cat = $this -> feedlist_init_cat (- 2 );
173 $cat [ 'items' ] = array ();
176 while ( $line = db_fetch_assoc ( $result )) {
178 $label_id = Labels
:: label_to_feed_id ( $line [ 'id' ]);
180 $feed = $this -> feedlist_init_feed ( $label_id , false , 0 );
182 $feed [ 'fg_color' ] = $line [ 'fg_color' ];
183 $feed [ 'bg_color' ] = $line [ 'bg_color' ];
185 array_push ( $cat [ 'items' ], $feed );
189 array_push ( $root [ 'items' ], $cat );
191 $root [ 'items' ] = array_merge ( $root [ 'items' ], $cat [ 'items' ]);
197 $show_empty_cats = $_REQUEST [ 'force_show_empty' ] ||
198 ( $_REQUEST [ 'mode' ] != 2 && ! $search );
200 $result = db_query ( "SELECT id, title FROM ttrss_feed_categories
201 WHERE owner_uid = " . $_SESSION [ "uid" ] . " AND parent_cat IS NULL ORDER BY order_id, title" );
203 while ( $line = db_fetch_assoc ( $result )) {
205 $cat [ 'id' ] = 'CAT:' . $line [ 'id' ];
206 $cat [ 'bare_id' ] = ( int ) $line [ 'id' ];
207 $cat [ 'auxcounter' ] = 0 ;
208 $cat [ 'name' ] = $line [ 'title' ];
209 $cat [ 'items' ] = array ();
210 $cat [ 'checkbox' ] = false ;
211 $cat [ 'type' ] = 'category' ;
213 $cat [ 'child_unread' ] = 0 ;
215 $cat [ 'items' ] = $this -> get_category_items ( $line [ 'id' ]);
217 $num_children = $this -> calculate_children_count ( $cat );
218 $cat [ 'param' ] = vsprintf ( _ngettext ( '( %d feed)' , '( %d feeds)' , ( int ) $num_children ), $num_children );
220 if ( $num_children > 0 ||
$show_empty_cats )
221 array_push ( $root [ 'items' ], $cat );
223 $root [ 'param' ] +
= count ( $cat [ 'items' ]);
226 /* Uncategorized is a special case */
229 $cat [ 'id' ] = 'CAT:0' ;
231 $cat [ 'auxcounter' ] = 0 ;
232 $cat [ 'name' ] = __ ( "Uncategorized" );
233 $cat [ 'items' ] = array ();
234 $cat [ 'type' ] = 'category' ;
235 $cat [ 'checkbox' ] = false ;
237 $cat [ 'child_unread' ] = 0 ;
239 $feed_result = db_query ( "SELECT id, title,last_error,
240 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
242 WHERE cat_id IS NULL AND owner_uid = " . $_SESSION [ "uid" ].
243 " $search_qpart ORDER BY order_id, title" );
245 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
247 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
248 $feed [ 'bare_id' ] = ( int ) $feed_line [ 'id' ];
249 $feed [ 'auxcounter' ] = 0 ;
250 $feed [ 'name' ] = $feed_line [ 'title' ];
251 $feed [ 'checkbox' ] = false ;
252 $feed [ 'error' ] = $feed_line [ 'last_error' ];
253 $feed [ 'icon' ] = Feeds
:: getFeedIcon ( $feed_line [ 'id' ]);
254 $feed [ 'param' ] = make_local_datetime (
255 $feed_line [ 'last_updated' ], true );
257 $feed [ 'type' ] = 'feed' ;
259 array_push ( $cat [ 'items' ], $feed );
262 $cat [ 'param' ] = vsprintf ( _ngettext ( '( %d feed)' , '( %d feeds)' , count ( $cat [ 'items' ])), count ( $cat [ 'items' ]));
264 if ( count ( $cat [ 'items' ]) > 0 ||
$show_empty_cats )
265 array_push ( $root [ 'items' ], $cat );
267 $num_children = $this -> calculate_children_count ( $root );
268 $root [ 'param' ] = vsprintf ( _ngettext ( '( %d feed)' , '( %d feeds)' , ( int ) $num_children ), $num_children );
271 $feed_result = db_query ( "SELECT id, title, last_error,
272 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
274 WHERE owner_uid = " . $_SESSION [ "uid" ].
275 " $search_qpart ORDER BY order_id, title" );
277 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
279 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
280 $feed [ 'bare_id' ] = ( int ) $feed_line [ 'id' ];
281 $feed [ 'auxcounter' ] = 0 ;
282 $feed [ 'name' ] = $feed_line [ 'title' ];
283 $feed [ 'checkbox' ] = false ;
284 $feed [ 'error' ] = $feed_line [ 'last_error' ];
285 $feed [ 'icon' ] = Feeds
:: getFeedIcon ( $feed_line [ 'id' ]);
286 $feed [ 'param' ] = make_local_datetime (
287 $feed_line [ 'last_updated' ], true );
289 $feed [ 'type' ] = 'feed' ;
291 array_push ( $root [ 'items' ], $feed );
294 $root [ 'param' ] = vsprintf ( _ngettext ( '( %d feed)' , '( %d feeds)' , count ( $cat [ 'items' ])), count ( $cat [ 'items' ]));
298 $fl [ 'identifier' ] = 'id' ;
299 $fl [ 'label' ] = 'name' ;
301 if ( $_REQUEST [ 'mode' ] != 2 ) {
302 $fl [ 'items' ] = array ( $root );
304 $fl [ 'items' ] = $root [ 'items' ];
310 function catsortreset () {
311 db_query ( "UPDATE ttrss_feed_categories
312 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
316 function feedsortreset () {
317 db_query ( "UPDATE ttrss_feeds
318 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
322 private function process_category_order (& $data_map , $item_id , $parent_id = false , $nest_level = 0 ) {
323 $debug = isset ( $_REQUEST [ "debug" ]);
326 for ( $i = 0 ; $i < $nest_level ; $i ++
)
329 if ( $debug ) _debug ( " $prefix C: $item_id P: $parent_id " );
331 $bare_item_id = substr ( $item_id , strpos ( $item_id , ':' ) +
1 );
333 if ( $item_id != 'root' ) {
334 if ( $parent_id && $parent_id != 'root' ) {
335 $parent_bare_id = substr ( $parent_id , strpos ( $parent_id , ':' ) +
1 );
336 $parent_qpart = $parent_bare_id ;
338 $parent_qpart = 'NULL' ;
341 db_query ( "UPDATE ttrss_feed_categories
342 SET parent_cat = $parent_qpart WHERE id = ' $bare_item_id ' AND
343 owner_uid = " . $_SESSION [ "uid" ]);
348 $cat = $data_map [ $item_id ];
350 if ( $cat && is_array ( $cat )) {
351 foreach ( $cat as $item ) {
352 $id = $item [ '_reference' ];
353 $bare_id = substr ( $id , strpos ( $id , ':' ) +
1 );
355 if ( $debug ) _debug ( " $prefix [ $order_id ] $id / $bare_id " );
357 if ( $item [ '_reference' ]) {
359 if ( strpos ( $id , "FEED" ) === 0 ) {
361 $cat_id = ( $item_id != "root" ) ?
362 $bare_item_id : "NULL" ;
364 $cat_qpart = ( $cat_id != 0 ) ?
"cat_id = ' $cat_id '" :
367 db_query ( "UPDATE ttrss_feeds
368 SET order_id = $order_id , $cat_qpart
369 WHERE id = ' $bare_id ' AND
370 owner_uid = " . $_SESSION [ "uid" ]);
372 } else if ( strpos ( $id , "CAT:" ) === 0 ) {
373 $this -> process_category_order ( $data_map , $item [ '_reference' ], $item_id ,
376 if ( $item_id != 'root' ) {
377 $parent_qpart = $bare_id ;
379 $parent_qpart = 'NULL' ;
382 db_query ( "UPDATE ttrss_feed_categories
383 SET order_id = ' $order_id ' WHERE id = ' $bare_id ' AND
384 owner_uid = " . $_SESSION [ "uid" ]);
393 function savefeedorder () {
394 $data = json_decode ( $_POST [ 'payload' ], true );
396 #file_put_contents("/tmp/saveorder.json", $_POST['payload']);
397 #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true);
399 if (! is_array ( $data [ 'items' ]))
400 $data [ 'items' ] = json_decode ( $data [ 'items' ], true );
402 # print_r($data['items']);
404 if ( is_array ( $data ) && is_array ( $data [ 'items' ])) {
410 foreach ( $data [ 'items' ] as $item ) {
412 # if ($item['id'] != 'root') {
413 if ( is_array ( $item [ 'items' ])) {
414 if ( isset ( $item [ 'items' ][ '_reference' ])) {
415 $data_map [ $item [ 'id' ]] = array ( $item [ 'items' ]);
417 $data_map [ $item [ 'id' ]] = $item [ 'items' ];
420 if ( $item [ 'id' ] == 'root' ) {
421 $root_item = $item [ 'id' ];
425 $this -> process_category_order ( $data_map , $root_item );
427 /* foreach ($data['items'][0]['items'] as $item) {
428 $id = $item['_reference'];
429 $bare_id = substr($id, strpos($id, ':')+1);
434 db_query("UPDATE ttrss_feed_categories
435 SET order_id = '$cat_order_id' WHERE id = '$bare_id' AND
436 owner_uid = " . $_SESSION["uid"]);
441 if (is_array($data_map[$id])) {
442 foreach ($data_map[$id] as $feed) {
443 $id = $feed['_reference'];
444 $feed_id = substr($id, strpos($id, ':')+1);
447 $cat_query = "cat_id = '$bare_id'";
449 $cat_query = "cat_id = NULL";
451 db_query("UPDATE ttrss_feeds
452 SET order_id = '$feed_order_id',
454 WHERE id = '$feed_id' AND
455 owner_uid = " . $_SESSION["uid"]);
466 function removeicon () {
467 $feed_id = $_REQUEST [ "feed_id" ];
469 $result = db_query ( "SELECT id FROM ttrss_feeds
470 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
472 if ( db_num_rows ( $result ) != 0 ) {
473 @unlink
( ICONS_DIR
. "/ $feed_id .ico" );
475 db_query ( "UPDATE ttrss_feeds SET favicon_avg_color = NULL
476 where id = ' $feed_id '" );
482 function uploadicon () {
483 header ( "Content-type: text/html" );
487 if ( is_uploaded_file ( $_FILES [ 'icon_file' ][ 'tmp_name' ])) {
488 $tmp_file = tempnam ( CACHE_DIR
. '/upload' , 'icon' );
490 $result = move_uploaded_file ( $_FILES [ 'icon_file' ][ 'tmp_name' ],
500 $icon_file = $tmp_file ;
501 $feed_id = $_REQUEST [ "feed_id" ];
503 if ( is_file ( $icon_file ) && $feed_id ) {
504 if ( filesize ( $icon_file ) < 65535 ) {
506 $result = db_query ( "SELECT id FROM ttrss_feeds
507 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
509 if ( db_num_rows ( $result ) != 0 ) {
510 @unlink
( ICONS_DIR
. "/ $feed_id .ico" );
511 if ( rename ( $icon_file , ICONS_DIR
. "/ $feed_id .ico" )) {
512 db_query ( "UPDATE ttrss_feeds SET
513 favicon_avg_color = ''
514 WHERE id = ' $feed_id '" );
530 print "<script type= \" text/javascript \" >" ;
531 print "parent.uploadIconHandler( $rc );" ;
536 function editfeed () {
537 global $purge_intervals ;
538 global $update_intervals ;
540 print '<div dojoType="dijit.layout.TabContainer" style="height : 450px">
541 <div dojoType="dijit.layout.ContentPane" title="' . __ ( 'General' ). '">' ;
543 $feed_id = $_REQUEST [ "id" ];
546 "SELECT * FROM ttrss_feeds WHERE id = ' $feed_id ' AND
547 owner_uid = " . $_SESSION [ "uid" ]);
549 $auth_pass_encrypted = sql_bool_to_bool ( db_fetch_result ( $result , 0 ,
550 "auth_pass_encrypted" ));
552 $title = htmlspecialchars ( db_fetch_result ( $result ,
555 print_hidden ( "id" , " $feed_id " );
556 print_hidden ( "op" , "pref-feeds" );
557 print_hidden ( "method" , "editSave" );
559 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
560 print "<div class= \" dlgSecCont \" >" ;
564 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
565 placeHolder= \" " . __ ( "Feed Title" ). " \"
566 style= \" font-size : 16px; width: 20em \" name= \" title \" value= \" $title\" >" ;
570 $feed_url = db_fetch_result ( $result , 0 , "feed_url" );
571 $feed_url = htmlspecialchars ( db_fetch_result ( $result ,
576 print __ ( 'URL:' ) . " " ;
577 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
578 placeHolder= \" " . __ ( "Feed URL" ). " \"
579 regExp='^(http|https)://.*' style= \" width : 20em \"
580 name= \" feed_url \" value= \" $feed_url\" >" ;
582 $last_error = db_fetch_result ( $result , 0 , "last_error" );
585 print " <img src= \" images/error.png \" alt= \" (error) \"
586 style= \" vertical-align : middle \"
587 title= \" " . htmlspecialchars ( $last_error ). " \" >" ;
593 if ( get_pref ( 'ENABLE_FEED_CATS' )) {
595 $cat_id = db_fetch_result ( $result , 0 , "cat_id" );
599 print __ ( 'Place in category:' ) . " " ;
601 print_feed_cat_select ( "cat_id" , $cat_id ,
602 'dojoType="dijit.form.Select"' );
605 /* FTS Stemming Language */
607 if ( DB_TYPE
== "pgsql" ) {
608 $feed_language = db_fetch_result ( $result , 0 , "feed_language" );
612 print __ ( 'Language:' ) . " " ;
613 print_select ( "feed_language" , $feed_language , $this :: $feed_languages ,
614 'dojoType="dijit.form.Select"' );
619 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
620 print "<div class= \" dlgSecCont \" >" ;
622 /* Update Interval */
624 $update_interval = db_fetch_result ( $result , 0 , "update_interval" );
626 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
627 'dojoType="dijit.form.Select"' );
631 $purge_interval = db_fetch_result ( $result , 0 , "purge_interval" );
634 print __ ( 'Article purging:' ) . " " ;
636 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
637 'dojoType="dijit.form.Select" ' .
638 (( FORCE_ARTICLE_PURGE
== 0 ) ?
"" : 'disabled="1"' ));
642 $auth_login = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_login" ));
643 $auth_pass = db_fetch_result ( $result , 0 , "auth_pass" );
645 if ( $auth_pass_encrypted && function_exists ( "mcrypt_decrypt" )) {
646 require_once "crypt.php" ;
647 $auth_pass = decrypt_string ( $auth_pass );
650 $auth_pass = htmlspecialchars ( $auth_pass );
651 $auth_enabled = $auth_login !== '' ||
$auth_pass !== '' ;
653 $auth_style = $auth_enabled ?
'' : 'display: none' ;
654 print "<div id='feedEditDlg_loginContainer' style=' $auth_style '>" ;
655 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
656 print "<div class= \" dlgSecCont \" >" ;
658 print "<input dojoType= \" dijit.form.TextBox \" id= \" feedEditDlg_login \"
659 placeHolder= \" " . __ ( "Login" ). " \"
660 autocomplete= \" new-password \"
661 name= \" auth_login \" value= \" $auth_login\" ><hr/>" ;
664 print "<input dojoType= \" dijit.form.TextBox \" type= \" password \" name= \" auth_pass \"
665 autocomplete= \" new-password \"
666 placeHolder= \" " . __ ( "Password" ). " \"
667 value= \" $auth_pass\" >" ;
669 print "<div dojoType= \" dijit.Tooltip \" connectId= \" feedEditDlg_login \" position= \" below \" >
670 " . __ ( '<b>Hint:</b> you need to fill in your login information if your feed requires authentication, except for Twitter feeds.' ). "
673 print "</div></div>" ;
675 $auth_checked = $auth_enabled ?
'checked' : '' ;
676 print "<div style= \" clear : both \" >
677 <input type= \" checkbox \" $auth_checked name= \" need_auth \" dojoType= \" dijit.form.CheckBox \" id= \" feedEditDlg_loginCheck \"
678 onclick='checkboxToggleElement(this, \" feedEditDlg_loginContainer \" )'>
679 <label for= \" feedEditDlg_loginCheck \" >" .
680 __ ( 'This feed requires authentication.' ). "</div>" ;
682 print '</div><div dojoType="dijit.layout.ContentPane" title="' . __ ( 'Options' ). '">' ;
684 //print "<div class=\"dlgSec\">".__("Options")."</div>";
685 print "<div class= \" dlgSecSimple \" >" ;
687 $private = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "private" ));
690 $checked = "checked= \" 1 \" " ;
695 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" private \" id= \" private \"
696 $checked > <label for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
698 $include_in_digest = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "include_in_digest" ));
700 if ( $include_in_digest ) {
701 $checked = "checked= \" 1 \" " ;
706 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" include_in_digest \"
707 name= \" include_in_digest \"
708 $checked > <label for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
711 $always_display_enclosures = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "always_display_enclosures" ));
713 if ( $always_display_enclosures ) {
714 $checked = "checked" ;
719 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" always_display_enclosures \"
720 name= \" always_display_enclosures \"
721 $checked > <label for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
723 $hide_images = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "hide_images" ));
726 $checked = "checked= \" 1 \" " ;
731 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" hide_images \"
733 $checked > <label for= \" hide_images \" >" .
734 __ ( 'Do not embed images' ). "</label>" ;
736 $cache_images = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "cache_images" ));
739 $checked = "checked= \" 1 \" " ;
744 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" cache_images \"
745 name= \" cache_images \"
746 $checked > <label for= \" cache_images \" >" .
747 __ ( 'Cache media' ). "</label>" ;
749 $mark_unread_on_update = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "mark_unread_on_update" ));
751 if ( $mark_unread_on_update ) {
752 $checked = "checked" ;
757 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" mark_unread_on_update \"
758 name= \" mark_unread_on_update \"
759 $checked > <label for= \" mark_unread_on_update \" >" . __ ( 'Mark updated articles as unread' ). "</label>" ;
763 print '</div><div dojoType="dijit.layout.ContentPane" title="' . __ ( 'Icon' ). '">' ;
767 print "<div class= \" dlgSecSimple \" >" ;
769 print "<iframe name= \" icon_upload_iframe \"
770 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
772 print "<form style='display : block' target= \" icon_upload_iframe \"
773 enctype= \" multipart/form-data \" method= \" POST \"
774 action= \" backend.php \" >
775 <input id= \" icon_file \" size= \" 10 \" name= \" icon_file \" type= \" file \" >
776 <input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >
777 <input type= \" hidden \" name= \" feed_id \" value= \" $feed_id\" >
778 <input type= \" hidden \" name= \" method \" value= \" uploadicon \" ><p>
779 <button class= \"\" dojoType= \" dijit.form.Button \" onclick= \" return uploadFeedIcon(); \"
780 type= \" submit \" >" . __ ( 'Replace' ). "</button>
781 <button class= \"\" dojoType= \" dijit.form.Button \" onclick= \" return removeFeedIcon( $feed_id ); \"
782 type= \" submit \" >" . __ ( 'Remove' ). "</button>
787 print '</div><div dojoType="dijit.layout.ContentPane" title="' . __ ( 'Plugins' ). '">' ;
789 PluginHost
:: getInstance ()-> run_hooks ( PluginHost
:: HOOK_PREFS_EDIT_FEED
,
790 "hook_prefs_edit_feed" , $feed_id );
793 print "</div></div>" ;
795 $title = htmlspecialchars ( $title , ENT_QUOTES
);
797 print "<div class='dlgButtons'>
798 <div style= \" float : left \" >
799 <button class= \" danger \" dojoType= \" dijit.form.Button \" onclick='return unsubscribeFeed( $feed_id , \" $title\" )'>" .
800 __ ( 'Unsubscribe' ). "</button>" ;
804 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedEditDlg').execute() \" >" . __ ( 'Save' ). "</button>
805 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedEditDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
812 function editfeeds () {
813 global $purge_intervals ;
814 global $update_intervals ;
816 $feed_ids = $_REQUEST [ "ids" ];
818 print_notice ( "Enable the options you wish to apply using checkboxes on the right:" );
822 print_hidden ( "ids" , " $feed_ids " );
823 print_hidden ( "op" , "pref-feeds" );
824 print_hidden ( "method" , "batchEditSave" );
826 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
827 print "<div class= \" dlgSecCont \" >" ;
831 if ( get_pref ( 'ENABLE_FEED_CATS' )) {
833 print __ ( 'Place in category:' ) . " " ;
835 print_feed_cat_select ( "cat_id" , false ,
836 'disabled="1" dojoType="dijit.form.Select"' );
838 $this -> batch_edit_cbox ( "cat_id" );
842 /* FTS Stemming Language */
844 if ( DB_TYPE
== "pgsql" ) {
847 print __ ( 'Language:' ) . " " ;
848 print_select ( "feed_language" , "" , $this :: $feed_languages ,
849 'disabled="1" dojoType="dijit.form.Select"' );
851 $this -> batch_edit_cbox ( "feed_language" );
856 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
857 print "<div class= \" dlgSecCont \" >" ;
859 /* Update Interval */
861 print_select_hash ( "update_interval" , "" , $update_intervals ,
862 'disabled="1" dojoType="dijit.form.Select"' );
864 $this -> batch_edit_cbox ( "update_interval" );
868 if ( FORCE_ARTICLE_PURGE
== 0 ) {
872 print __ ( 'Article purging:' ) . " " ;
874 print_select_hash ( "purge_interval" , "" , $purge_intervals ,
875 'disabled="1" dojoType="dijit.form.Select"' );
877 $this -> batch_edit_cbox ( "purge_interval" );
881 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
882 print "<div class= \" dlgSecCont \" >" ;
884 print "<input dojoType= \" dijit.form.TextBox \"
885 placeHolder= \" " . __ ( "Login" ). " \" disabled= \" 1 \"
886 autocomplete= \" new-password \"
887 name= \" auth_login \" value= \"\" >" ;
889 $this -> batch_edit_cbox ( "auth_login" );
891 print "<hr/> <input dojoType= \" dijit.form.TextBox \" type= \" password \" name= \" auth_pass \"
892 autocomplete= \" new-password \"
893 placeHolder= \" " . __ ( "Password" ). " \" disabled= \" 1 \"
896 $this -> batch_edit_cbox ( "auth_pass" );
899 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
900 print "<div class= \" dlgSecCont \" >" ;
902 print "<input disabled= \" 1 \" type= \" checkbox \" name= \" private \" id= \" private \"
903 dojoType= \" dijit.form.CheckBox \" > <label id= \" private_l \" class='insensitive' for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
905 print " " ; $this -> batch_edit_cbox ( "private" , "private_l" );
907 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" include_in_digest \"
908 name= \" include_in_digest \"
909 dojoType= \" dijit.form.CheckBox \" > <label id= \" include_in_digest_l \" class='insensitive' for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
911 print " " ; $this -> batch_edit_cbox ( "include_in_digest" , "include_in_digest_l" );
913 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" always_display_enclosures \"
914 name= \" always_display_enclosures \"
915 dojoType= \" dijit.form.CheckBox \" > <label id= \" always_display_enclosures_l \" class='insensitive' for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
917 print " " ; $this -> batch_edit_cbox ( "always_display_enclosures" , "always_display_enclosures_l" );
919 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" hide_images \"
921 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" hide_images_l \"
922 for= \" hide_images \" >" .
923 __ ( 'Do not embed images' ). "</label>" ;
925 print " " ; $this -> batch_edit_cbox ( "hide_images" , "hide_images_l" );
927 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" cache_images \"
928 name= \" cache_images \"
929 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" cache_images_l \"
930 for= \" cache_images \" >" .
931 __ ( 'Cache media' ). "</label>" ;
933 print " " ; $this -> batch_edit_cbox ( "cache_images" , "cache_images_l" );
935 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" mark_unread_on_update \"
936 name= \" mark_unread_on_update \"
937 dojoType= \" dijit.form.CheckBox \" > <label id= \" mark_unread_on_update_l \" class='insensitive' for= \" mark_unread_on_update \" >" . __ ( 'Mark updated articles as unread' ). "</label>" ;
939 print " " ; $this -> batch_edit_cbox ( "mark_unread_on_update" , "mark_unread_on_update_l" );
943 print "<div class='dlgButtons'>
944 <button dojoType= \" dijit.form.Button \"
945 onclick= \" return dijit.byId('feedEditDlg').execute() \" >" .
946 __ ( 'Save' ). "</button>
947 <button dojoType= \" dijit.form.Button \"
948 onclick= \" return dijit.byId('feedEditDlg').hide() \" >" .
949 __ ( 'Cancel' ). "</button>
955 function batchEditSave () {
956 return $this -> editsaveops ( true );
959 function editSave () {
960 return $this -> editsaveops ( false );
963 function editsaveops ( $batch ) {
965 $feed_title = trim ( $_POST [ "title" ]);
966 $feed_link = trim ( $_POST [ "feed_url" ]);
967 $upd_intl = ( int ) $_POST [ "update_interval" ];
968 $purge_intl = ( int ) $_POST [ "purge_interval" ];
969 $feed_id = ( int ) $_POST [ "id" ]; /* editSave */
970 $feed_ids = $_POST [ "ids" ]; /* batchEditSave */
971 $cat_id = ( int ) $_POST [ "cat_id" ];
972 $auth_login = trim ( $_POST [ "auth_login" ]);
973 $auth_pass = trim ( $_POST [ "auth_pass" ]);
974 $private = checkbox_to_sql_bool ( $_POST [ "private" ]);
975 $include_in_digest = checkbox_to_sql_bool (
976 $_POST [ "include_in_digest" ]);
977 $cache_images = checkbox_to_sql_bool (
978 $_POST [ "cache_images" ]);
979 $hide_images = checkbox_to_sql_bool (
980 $_POST [ "hide_images" ]);
981 $always_display_enclosures = checkbox_to_sql_bool (
982 $_POST [ "always_display_enclosures" ]);
984 $mark_unread_on_update = checkbox_to_sql_bool (
985 $_POST [ "mark_unread_on_update" ]);
987 $feed_language = trim ( $_POST [ "feed_language" ]);
989 $auth_pass = $auth_pass ;
991 if ( get_pref ( 'ENABLE_FEED_CATS' )) {
992 if ( $cat_id && $cat_id != 0 ) {
993 $category_qpart = "cat_id = ' $cat_id '," ;
994 $category_qpart_nocomma = "cat_id = ' $cat_id '" ;
996 $category_qpart = 'cat_id = NULL,' ;
997 $category_qpart_nocomma = 'cat_id = NULL' ;
1000 $category_qpart = "" ;
1001 $category_qpart_nocomma = "" ;
1005 if ( $_POST [ "need_auth" ] !== 'on' ) {
1010 $result = db_query ( "SELECT feed_url FROM ttrss_feeds WHERE id = " . $feed_id );
1011 $orig_feed_url = db_fetch_result ( $result , 0 , "feed_url" );
1013 $reset_basic_info = $orig_feed_url != $feed_link ;
1015 db_query ( "UPDATE ttrss_feeds SET
1017 title = ' $feed_title ', feed_url = ' $feed_link ',
1018 update_interval = ' $upd_intl ',
1019 purge_interval = ' $purge_intl ',
1020 auth_login = ' $auth_login ',
1021 auth_pass = ' $auth_pass ',
1022 auth_pass_encrypted = false,
1024 cache_images = $cache_images ,
1025 hide_images = $hide_images ,
1026 include_in_digest = $include_in_digest ,
1027 always_display_enclosures = $always_display_enclosures ,
1028 mark_unread_on_update = $mark_unread_on_update ,
1029 feed_language = ' $feed_language '
1030 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
1032 if ( $reset_basic_info ) {
1033 RSSUtils
:: set_basic_feed_info ( $feed_id );
1036 PluginHost
:: getInstance ()-> run_hooks ( PluginHost
:: HOOK_PREFS_SAVE_FEED
,
1037 "hook_prefs_save_feed" , $feed_id );
1040 $feed_data = array ();
1042 foreach ( array_keys ( $_POST ) as $k ) {
1043 if ( $k != "op" && $k != "method" && $k != "ids" ) {
1044 $feed_data [ $k ] = $_POST [ $k ];
1050 foreach ( array_keys ( $feed_data ) as $k ) {
1056 $qpart = "title = ' $feed_title '" ;
1060 $qpart = "feed_url = ' $feed_link '" ;
1063 case "update_interval" :
1064 $qpart = "update_interval = ' $upd_intl '" ;
1067 case "purge_interval" :
1068 $qpart = "purge_interval = ' $purge_intl '" ;
1072 $qpart = "auth_login = ' $auth_login '" ;
1076 $qpart = "auth_pass = ' $auth_pass ', auth_pass_encrypted = false" ;
1080 $qpart = "private = $private " ;
1083 case "include_in_digest" :
1084 $qpart = "include_in_digest = $include_in_digest " ;
1087 case "always_display_enclosures" :
1088 $qpart = "always_display_enclosures = $always_display_enclosures " ;
1091 case "mark_unread_on_update" :
1092 $qpart = "mark_unread_on_update = $mark_unread_on_update " ;
1095 case "cache_images" :
1096 $qpart = "cache_images = $cache_images " ;
1100 $qpart = "hide_images = $hide_images " ;
1104 $qpart = $category_qpart_nocomma ;
1107 case "feed_language" :
1108 $qpart = "feed_language = ' $feed_language '" ;
1115 "UPDATE ttrss_feeds SET $qpart WHERE id IN ( $feed_ids )
1116 AND owner_uid = " . $_SESSION [ "uid" ]);
1128 $ids = explode ( "," , $_REQUEST [ "ids" ]);
1130 foreach ( $ids as $id ) {
1131 Pref_Feeds
:: remove_feed ( $id , $_SESSION [ "uid" ]);
1138 $id = $_REQUEST [ "id" ];
1139 $this -> clear_feed_articles ( $id );
1142 function rescore () {
1143 $ids = explode ( "," , $_REQUEST [ "ids" ]);
1145 foreach ( $ids as $id ) {
1147 $filters = load_filters ( $id , $_SESSION [ "uid" ], 6 );
1149 $result = db_query ( "SELECT
1150 title, content, link, ref_id, author," .
1151 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
1153 ttrss_user_entries, ttrss_entries
1154 WHERE ref_id = id AND feed_id = ' $id ' AND
1155 owner_uid = " . $_SESSION [ 'uid' ]. "
1160 while ( $line = db_fetch_assoc ( $result )) {
1162 $tags = Article
:: get_article_tags ( $line [ "ref_id" ]);
1164 $article_filters = RSSUtils
:: get_article_filters ( $filters , $line [ 'title' ],
1165 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
1166 $line [ 'author' ], $tags );
1168 $new_score = RSSUtils
:: calculate_article_score ( $article_filters );
1170 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
1172 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
1175 foreach ( array_keys ( $scores ) as $s ) {
1177 db_query ( "UPDATE ttrss_user_entries SET score = ' $s ',
1179 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
1180 } else if ( $s < - 500 ) {
1181 db_query ( "UPDATE ttrss_user_entries SET score = ' $s ',
1182 unread = false WHERE
1183 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
1185 db_query ( "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
1186 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
1191 print __ ( "All done." );
1195 function rescoreAll () {
1198 "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION [ 'uid' ]);
1200 while ( $feed_line = db_fetch_assoc ( $result )) {
1202 $id = $feed_line [ "id" ];
1204 $filters = load_filters ( $id , $_SESSION [ "uid" ], 6 );
1206 $tmp_result = db_query ( "SELECT
1207 title, content, link, ref_id, author," .
1208 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
1210 ttrss_user_entries, ttrss_entries
1211 WHERE ref_id = id AND feed_id = ' $id ' AND
1212 owner_uid = " . $_SESSION [ 'uid' ]. "
1217 while ( $line = db_fetch_assoc ( $tmp_result )) {
1219 $tags = Article
:: get_article_tags ( $line [ "ref_id" ]);
1221 $article_filters = RSSUtils
:: get_article_filters ( $filters , $line [ 'title' ],
1222 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
1223 $line [ 'author' ], $tags );
1225 $new_score = RSSUtils
:: calculate_article_score ( $article_filters );
1227 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
1229 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
1232 foreach ( array_keys ( $scores ) as $s ) {
1234 db_query ( "UPDATE ttrss_user_entries SET score = ' $s ',
1236 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
1238 db_query ( "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
1239 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
1244 print __ ( "All done." );
1248 function categorize () {
1249 $ids = explode ( "," , $_REQUEST [ "ids" ]);
1251 $cat_id = $_REQUEST [ "cat_id" ];
1254 $cat_id_qpart = 'NULL' ;
1256 $cat_id_qpart = "' $cat_id '" ;
1261 foreach ( $ids as $id ) {
1263 db_query ( "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
1265 AND owner_uid = " . $_SESSION [ "uid" ]);
1272 function removeCat () {
1273 $ids = explode ( "," , $_REQUEST [ "ids" ]);
1274 foreach ( $ids as $id ) {
1275 $this -> remove_feed_category ( $id , $_SESSION [ "uid" ]);
1280 $feed_cat = trim ( $_REQUEST [ "cat" ]);
1282 add_feed_category ( $feed_cat );
1287 print "<div dojoType= \" dijit.layout.AccordionContainer \" region= \" center \" >" ;
1288 print "<div id= \" pref-feeds-feeds \" dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Feeds' ). " \" >" ;
1290 $result = db_query ( "SELECT COUNT(id) AS num_errors
1291 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
1293 $num_errors = db_fetch_result ( $result , 0 , "num_errors" );
1295 if ( $num_errors > 0 ) {
1297 $error_button = "<button dojoType= \" dijit.form.Button \"
1298 onclick= \" showFeedsWithErrors() \" id= \" errorButton \" >" .
1299 __ ( "Feeds with errors" ) . "</button>" ;
1302 $inactive_button = "<button dojoType= \" dijit.form.Button \"
1303 id= \" pref_feeds_inactive_btn \"
1304 style= \" display : none \"
1305 onclick= \" showInactiveFeeds() \" >" .
1306 __ ( "Inactive feeds" ) . "</button>" ;
1308 $feed_search = $_REQUEST [ "search" ];
1310 if ( array_key_exists ( "search" , $_REQUEST )) {
1311 $_SESSION [ "prefs_feed_search" ] = $feed_search ;
1313 $feed_search = $_SESSION [ "prefs_feed_search" ];
1316 print '<div dojoType="dijit.layout.BorderContainer" gutters="false">' ;
1318 print "<div region='top' dojoType= \" dijit.Toolbar \" >" ; #toolbar
1320 print "<div style='float : right; padding-right : 4px;'>
1321 <input dojoType= \" dijit.form.TextBox \" id= \" feed_search \" size= \" 20 \" type= \" search \"
1322 value= \" $feed_search\" >
1323 <button dojoType= \" dijit.form.Button \" onclick= \" updateFeedList() \" >" .
1324 __ ( 'Search' ). "</button>
1327 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1328 "<span>" . __ ( 'Select' ). "</span>" ;
1329 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1330 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(true) \"
1331 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
1332 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(false) \"
1333 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
1334 print "</div></div>" ;
1336 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1337 "<span>" . __ ( 'Feeds' ). "</span>" ;
1338 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1339 print "<div onclick= \" quickAddFeed() \"
1340 dojoType= \" dijit.MenuItem \" >" . __ ( 'Subscribe to feed' ). "</div>" ;
1341 print "<div onclick= \" editSelectedFeed() \"
1342 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit selected feeds' ). "</div>" ;
1343 print "<div onclick= \" resetFeedOrder() \"
1344 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1345 print "<div onclick= \" batchSubscribe() \"
1346 dojoType= \" dijit.MenuItem \" >" . __ ( 'Batch subscribe' ). "</div>" ;
1347 print "<div dojoType= \" dijit.MenuItem \" onclick= \" removeSelectedFeeds() \" >"
1348 . __ ( 'Unsubscribe' ). "</div> " ;
1349 print "</div></div>" ;
1351 if ( get_pref ( 'ENABLE_FEED_CATS' )) {
1352 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1353 "<span>" . __ ( 'Categories' ). "</span>" ;
1354 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1355 print "<div onclick= \" createCategory() \"
1356 dojoType= \" dijit.MenuItem \" >" . __ ( 'Add category' ). "</div>" ;
1357 print "<div onclick= \" resetCatOrder() \"
1358 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1359 print "<div onclick= \" removeSelectedCategories() \"
1360 dojoType= \" dijit.MenuItem \" >" . __ ( 'Remove selected' ). "</div>" ;
1361 print "</div></div>" ;
1365 print $error_button ;
1366 print $inactive_button ;
1368 if ( defined ( '_ENABLE_FEED_DEBUGGING' )) {
1370 print "<select id= \" feedActionChooser \" onchange= \" feedActionChange() \" >
1371 <option value= \" facDefault \" selected>" . __ ( 'More actions...' ). "</option>" ;
1373 if ( FORCE_ARTICLE_PURGE
== 0 ) {
1375 "<option value= \" facPurge \" >" . __ ( 'Manual purge' ). "</option>" ;
1379 <option value= \" facClear \" >" . __ ( 'Clear feed data' ). "</option>
1380 <option value= \" facRescore \" >" . __ ( 'Rescore articles' ). "</option>" ;
1386 print "</div>" ; # toolbar
1389 print '<div dojoType="dijit.layout.ContentPane" region="center">' ;
1391 print "<div id= \" feedlistLoading \" >
1392 <img src='images/indicator_tiny.gif'>" .
1393 __ ( "Loading, please wait..." ). "</div>" ;
1395 print "<div dojoType= \" fox.PrefFeedStore \" jsId= \" feedStore \"
1396 url= \" backend.php?op=pref-feeds&method=getfeedtree \" >
1398 <div dojoType= \" lib.CheckBoxStoreModel \" jsId= \" feedModel \" store= \" feedStore \"
1399 query= \" {id:'root'} \" rootId= \" root \" rootLabel= \" Feeds \"
1400 childrenAttrs= \" items \" checkboxStrict= \" false \" checkboxAll= \" false \" >
1402 <div dojoType= \" fox.PrefFeedTree \" id= \" feedTree \"
1403 dndController= \" dijit.tree.dndSource \"
1404 betweenThreshold= \" 5 \"
1406 model= \" feedModel \" openOnClick= \" false \" >
1407 <script type= \" dojo/method \" event= \" onClick \" args= \" item \" >
1408 var id = String(item.id);
1409 var bare_id = id.substr(id.indexOf(':')+1);
1411 if (id.match('FEED:')) {
1413 } else if (id.match('CAT:')) {
1414 editCat(bare_id, item);
1417 <script type= \" dojo/method \" event= \" onLoad \" args= \" item \" >
1418 Element.hide( \" feedlistLoading \" );
1420 checkInactiveFeeds();
1424 # print "<div dojoType=\"dijit.Tooltip\" connectId=\"feedTree\" position=\"below\">
1425 # ".__('<b>Hint:</b> you can drag feeds and categories around.')."
1431 print "</div>" ; # feeds pane
1433 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'OPML' ). " \" >" ;
1435 print "<p>" . __ ( "Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings." ) .
1436 __ ( "Only main settings profile can be migrated using OPML." ) . "</p>" ;
1438 print "<iframe id= \" upload_iframe \"
1439 name= \" upload_iframe \" onload= \" opmlImportComplete(this) \"
1440 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
1442 print "<form name= \" opml_form \" style='display : block' target= \" upload_iframe \"
1443 enctype= \" multipart/form-data \" method= \" POST \"
1444 action= \" backend.php \" >
1445 <input id= \" opml_file \" name= \" opml_file \" type= \" file \" >
1446 <input type= \" hidden \" name= \" op \" value= \" dlg \" >
1447 <input type= \" hidden \" name= \" method \" value= \" importOpml \" >
1448 <button dojoType= \" dijit.form.Button \" onclick= \" return opmlImport(); \" type= \" submit \" >" .
1449 __ ( 'Import my OPML' ) . "</button>" ;
1453 $opml_export_filename = "TinyTinyRSS_" . date ( "Y-m-d" ). ".opml" ;
1455 print "<p>" . __ ( 'Filename:' ) .
1456 " <input type= \" text \" id= \" filename \" value= \" $opml_export_filename\" /> " .
1457 __ ( 'Include settings' ) . "<input type= \" checkbox \" id= \" settings \" checked= \" 1 \" />" ;
1459 print "</p><button dojoType= \" dijit.form.Button \"
1460 onclick= \" gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked) \" >" .
1461 __ ( 'Export OPML' ) . "</button></p></form>" ;
1465 print "<p>" . __ ( 'Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.' ) . "</p>" ;
1467 print_warning ( "Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds." );
1469 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('" . __ ( "Public OPML URL" ). "','pubOPMLUrl') \" >" .
1470 __ ( 'Display published OPML URL' ). "</button> " ;
1472 PluginHost
:: getInstance ()-> run_hooks ( PluginHost
:: HOOK_PREFS_TAB_SECTION
,
1473 "hook_prefs_tab_section" , "prefFeedsOPML" );
1475 print "</div>" ; # pane
1477 if ( strpos ( $_SERVER [ 'HTTP_USER_AGENT' ], "Firefox" ) !== false ) {
1479 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Firefox integration' ). " \" >" ;
1481 print_notice ( __ ( 'This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.' ));
1485 print "<button onclick='window.navigator.registerContentHandler(" .
1486 " \" application/vnd.mozilla.maybe.feed \" , " .
1487 " \" " . $this -> subscribe_to_feed_url () . " \" , " . " \" Tiny Tiny RSS \" )'>" .
1488 __ ( 'Click here to register this site as a feed reader.' ) .
1493 print "</div>" ; # pane
1496 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Published & shared articles / Generated feeds' ). " \" >" ;
1498 print "<p>" . __ ( 'Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.' ) . "</p>" ;
1500 $rss_url = '-2::' . htmlspecialchars ( get_self_url_prefix () .
1501 "/public.php?op=rss&id=-2&view-mode=all_articles" );;
1505 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('" . __ ( "View as RSS" ). "','generatedFeed', ' $rss_url ') \" >" .
1506 __ ( 'Display URL' ). "</button> " ;
1508 print "<button class= \" warning \" dojoType= \" dijit.form.Button \" onclick= \" return clearFeedAccessKeys() \" >" .
1509 __ ( 'Clear all generated URLs' ). "</button> " ;
1513 PluginHost
:: getInstance ()-> run_hooks ( PluginHost
:: HOOK_PREFS_TAB_SECTION
,
1514 "hook_prefs_tab_section" , "prefFeedsPublishedGenerated" );
1516 print "</div>" ; #pane
1518 PluginHost
:: getInstance ()-> run_hooks ( PluginHost
:: HOOK_PREFS_TAB
,
1519 "hook_prefs_tab" , "prefFeeds" );
1521 print "</div>" ; #container
1524 private function feedlist_init_cat ( $cat_id ) {
1526 $cat_id = ( int ) $cat_id ;
1529 $cat_unread = CCache
:: find ( $cat_id , $_SESSION [ "uid" ], true );
1530 } else if ( $cat_id == 0 ||
$cat_id == - 2 ) {
1531 $cat_unread = Feeds
:: getCategoryUnread ( $cat_id );
1534 $obj [ 'id' ] = 'CAT:' . $cat_id ;
1535 $obj [ 'items' ] = array ();
1536 $obj [ 'name' ] = Feeds
:: getCategoryTitle ( $cat_id );
1537 $obj [ 'type' ] = 'category' ;
1538 $obj [ 'unread' ] = ( int ) $cat_unread ;
1539 $obj [ 'bare_id' ] = $cat_id ;
1544 private function feedlist_init_feed ( $feed_id , $title = false , $unread = false , $error = '' , $updated = '' ) {
1546 $feed_id = ( int ) $feed_id ;
1549 $title = Feeds
:: getFeedTitle ( $feed_id , false );
1551 if ( $unread === false )
1552 $unread = getFeedUnread ( $feed_id , false );
1554 $obj [ 'id' ] = 'FEED:' . $feed_id ;
1555 $obj [ 'name' ] = $title ;
1556 $obj [ 'unread' ] = ( int ) $unread ;
1557 $obj [ 'type' ] = 'feed' ;
1558 $obj [ 'error' ] = $error ;
1559 $obj [ 'updated' ] = $updated ;
1560 $obj [ 'icon' ] = Feeds
:: getFeedIcon ( $feed_id );
1561 $obj [ 'bare_id' ] = $feed_id ;
1562 $obj [ 'auxcounter' ] = 0 ;
1567 function inactiveFeeds () {
1569 if ( DB_TYPE
== "pgsql" ) {
1570 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
1572 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
1575 $result = db_query ( "SELECT ttrss_feeds.title, ttrss_feeds.site_url,
1576 ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article
1577 FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE
1578 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
1579 ttrss_entries.id = ref_id AND
1580 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart
1581 AND ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]. " AND
1582 ttrss_user_entries.feed_id = ttrss_feeds.id AND
1583 ttrss_entries.id = ref_id
1584 GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url
1585 ORDER BY last_article" );
1587 print "<p" . __ ( "These feeds have not been updated with new content for 3 months (oldest first):" ) . "</p>" ;
1589 print "<div dojoType= \" dijit.Toolbar \" >" ;
1590 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1591 "<span>" . __ ( 'Select' ). "</span>" ;
1592 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1593 print "<div onclick= \" selectTableRows('prefInactiveFeedList', 'all') \"
1594 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
1595 print "<div onclick= \" selectTableRows('prefInactiveFeedList', 'none') \"
1596 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
1597 print "</div></div>" ;
1598 print "</div>" ; #toolbar
1600 print "<div class= \" inactiveFeedHolder \" >" ;
1602 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefInactiveFeedList \" >" ;
1606 while ( $line = db_fetch_assoc ( $result )) {
1608 $feed_id = $line [ "id" ];
1609 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
1611 # class needed for selectTableRows()
1612 print "<tr class= \" placeholder \" $this_row_id >" ;
1614 # id needed for selectTableRows()
1615 print "<td width='5%' align='center'><input
1616 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
1617 type= \" checkbox \" id= \" FUPDC- $feed_id\" ></td>" ;
1620 print "<a class= \" visibleLink \" href= \" # \" " .
1621 "title= \" " . __ ( "Click to edit feed" ). " \" " .
1622 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
1623 htmlspecialchars ( $line [ "title" ]). "</a>" ;
1625 print "</td><td class= \" insensitive \" align='right'>" ;
1626 print make_local_datetime ( $line [ 'last_article' ], false );
1636 print "<div class='dlgButtons'>" ;
1637 print "<div style='float : left'>" ;
1638 print "<button class= \" danger \" dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').removeSelected() \" >"
1639 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
1642 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').hide() \" >" .
1643 __ ( 'Close this window' ). "</button>" ;
1649 function feedsWithErrors () {
1650 $result = db_query ( "SELECT id,title,feed_url,last_error,site_url
1651 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
1653 print "<div dojoType= \" dijit.Toolbar \" >" ;
1654 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1655 "<span>" . __ ( 'Select' ). "</span>" ;
1656 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1657 print "<div onclick= \" selectTableRows('prefErrorFeedList', 'all') \"
1658 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
1659 print "<div onclick= \" selectTableRows('prefErrorFeedList', 'none') \"
1660 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
1661 print "</div></div>" ;
1662 print "</div>" ; #toolbar
1664 print "<div class= \" inactiveFeedHolder \" >" ;
1666 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefErrorFeedList \" >" ;
1670 while ( $line = db_fetch_assoc ( $result )) {
1672 $feed_id = $line [ "id" ];
1673 $this_row_id = "id= \" FERDD- $feed_id\" " ;
1675 # class needed for selectTableRows()
1676 print "<tr class= \" placeholder \" $this_row_id >" ;
1678 # id needed for selectTableRows()
1679 print "<td width='5%' align='center'><input
1680 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
1681 type= \" checkbox \" id= \" FERDC- $feed_id\" ></td>" ;
1684 print "<a class= \" visibleLink \" href= \" # \" " .
1685 "title= \" " . __ ( "Click to edit feed" ). " \" " .
1686 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
1687 htmlspecialchars ( $line [ "title" ]). "</a>: " ;
1689 print "<span class= \" insensitive \" >" ;
1690 print htmlspecialchars ( $line [ "last_error" ]);
1702 print "<div class='dlgButtons'>" ;
1703 print "<div style='float : left'>" ;
1704 print "<button class= \" danger \" dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').removeSelected() \" >"
1705 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
1708 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').hide() \" >" .
1709 __ ( 'Close this window' ). "</button>" ;
1715 * Purge a feed contents, marked articles excepted.
1717 * @param mixed $link The database connection.
1718 * @param integer $id The id of the feed to purge.
1721 private function clear_feed_articles ( $id ) {
1724 $result = db_query ( "DELETE FROM ttrss_user_entries
1725 WHERE feed_id = ' $id ' AND marked = false AND owner_uid = " . $_SESSION [ "uid" ]);
1727 $result = db_query ( "DELETE FROM ttrss_user_entries
1728 WHERE feed_id IS NULL AND marked = false AND owner_uid = " . $_SESSION [ "uid" ]);
1731 $result = db_query ( "DELETE FROM ttrss_entries WHERE
1732 (SELECT COUNT(int_id) FROM ttrss_user_entries WHERE ref_id = id) = 0" );
1734 CCache
:: update ( $id , $_SESSION [ 'uid' ]);
1735 } // function clear_feed_articles
1737 private function remove_feed_category ( $id , $owner_uid ) {
1739 db_query ( "DELETE FROM ttrss_feed_categories
1740 WHERE id = ' $id ' AND owner_uid = $owner_uid " );
1742 CCache
:: remove ( $id , $owner_uid , true );
1745 static function remove_feed ( $id , $owner_uid ) {
1749 /* save starred articles in Archived feed */
1753 /* prepare feed if necessary */
1755 $result = db_query ( "SELECT feed_url FROM ttrss_feeds WHERE id = $id
1756 AND owner_uid = $owner_uid " );
1758 $feed_url = db_fetch_result ( $result , 0 , "feed_url" );
1760 $result = db_query ( "SELECT id FROM ttrss_archived_feeds
1761 WHERE feed_url = ' $feed_url ' AND owner_uid = $owner_uid " );
1763 if ( db_num_rows ( $result ) == 0 ) {
1764 $result = db_query ( "SELECT MAX(id) AS id FROM ttrss_archived_feeds" );
1765 $new_feed_id = ( int ) db_fetch_result ( $result , 0 , "id" ) +
1 ;
1767 db_query ( "INSERT INTO ttrss_archived_feeds
1768 (id, owner_uid, title, feed_url, site_url)
1769 SELECT $new_feed_id , owner_uid, title, feed_url, site_url from ttrss_feeds
1772 $archive_id = $new_feed_id ;
1774 $archive_id = db_fetch_result ( $result , 0 , "id" );
1777 db_query ( "UPDATE ttrss_user_entries SET feed_id = NULL,
1778 orig_feed_id = ' $archive_id ' WHERE feed_id = ' $id ' AND
1779 marked = true AND owner_uid = $owner_uid " );
1781 /* Remove access key for the feed */
1783 db_query ( "DELETE FROM ttrss_access_keys WHERE
1784 feed_id = ' $id ' AND owner_uid = $owner_uid " );
1786 /* remove the feed */
1788 db_query ( "DELETE FROM ttrss_feeds
1789 WHERE id = ' $id ' AND owner_uid = $owner_uid " );
1793 if ( file_exists ( ICONS_DIR
. "/ $id .ico" )) {
1794 unlink ( ICONS_DIR
. "/ $id .ico" );
1797 CCache
:: remove ( $id , $owner_uid );
1800 Labels
:: remove ( Labels
:: feed_to_label_id ( $id ), $owner_uid );
1801 //CCache::remove($id, $owner_uid); don't think labels are cached
1805 function batchSubscribe () {
1806 print_hidden ( "op" , "pref-feeds" );
1807 print_hidden ( "method" , "batchaddfeeds" );
1809 print "<table width='100%'><tr><td>
1810 " . __ ( "Add one valid RSS feed per line (no feed detection is done)" ). "
1811 </td><td align='right'>" ;
1812 if ( get_pref ( 'ENABLE_FEED_CATS' )) {
1813 print __ ( 'Place in category:' ) . " " ;
1814 print_feed_cat_select ( "cat" , false , 'dojoType="dijit.form.Select"' );
1816 print "</td></tr><tr><td colspan='2'>" ;
1818 style='font-size : 12px; width : 98%; height: 200px;'
1819 placeHolder= \" " . __ ( "Feeds to subscribe, One per line" ). " \"
1820 dojoType= \" dijit.form.SimpleTextarea \" required= \" 1 \" name= \" feeds \" ></textarea>" ;
1822 print "</td></tr><tr><td colspan='2'>" ;
1824 print "<div id='feedDlg_loginContainer' style='display : none'>
1826 " <input dojoType= \" dijit.form.TextBox \" name='login' \"
1827 placeHolder= \" " . __ ( "Login" ). " \"
1828 style= \" width : 10em; \" > " .
1830 placeHolder= \" " . __ ( "Password" ). " \"
1831 dojoType= \" dijit.form.TextBox \" type='password'
1832 autocomplete= \" new-password \"
1833 style= \" width : 10em; \" name='pass' \" >" .
1836 print "</td></tr><tr><td colspan='2'>" ;
1838 print "<div style= \" clear : both \" >
1839 <input type= \" checkbox \" name= \" need_auth \" dojoType= \" dijit.form.CheckBox \" id= \" feedDlg_loginCheck \"
1840 onclick='checkboxToggleElement(this, \" feedDlg_loginContainer \" )'>
1841 <label for= \" feedDlg_loginCheck \" >" .
1842 __ ( 'Feeds require authentication.' ). "</div>" ;
1846 print "</td></tr></table>" ;
1848 print "<div class= \" dlgButtons \" >
1849 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('batchSubDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
1850 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('batchSubDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
1854 function batchAddFeeds () {
1855 $cat_id = $_REQUEST [ 'cat' ];
1856 $feeds = explode ( " \n " , $_REQUEST [ 'feeds' ]);
1857 $login = $_REQUEST [ 'login' ];
1858 $pass = trim ( $_REQUEST [ 'pass' ]);
1860 foreach ( $feeds as $feed ) {
1861 $feed = trim ( $feed );
1863 if ( validate_feed_url ( $feed )) {
1867 if ( $cat_id == "0" ||
! $cat_id ) {
1868 $cat_qpart = "NULL" ;
1870 $cat_qpart = "' $cat_id '" ;
1874 "SELECT id FROM ttrss_feeds
1875 WHERE feed_url = ' $feed ' AND owner_uid = " . $_SESSION [ "uid" ]);
1879 if ( db_num_rows ( $result ) == 0 ) {
1881 "INSERT INTO ttrss_feeds
1882 (owner_uid,feed_url,title,cat_id,auth_login,auth_pass,update_method,auth_pass_encrypted)
1883 VALUES ('" . $_SESSION [ "uid" ]. "', ' $feed ',
1884 '[Unknown]', $cat_qpart , ' $login ', ' $pass ', 0, false)" );
1892 function regenOPMLKey () {
1893 $this -> update_feed_access_key ( 'OPML:Publish' ,
1894 false , $_SESSION [ "uid" ]);
1896 $new_link = Opml
:: opml_publish_url ();
1898 print json_encode ( array ( "link" => $new_link ));
1901 function regenFeedKey () {
1902 $feed_id = $_REQUEST [ 'id' ];
1903 $is_cat = $_REQUEST [ 'is_cat' ] == "true" ;
1905 $new_key = $this -> update_feed_access_key ( $feed_id , $is_cat );
1907 print json_encode ( array ( "link" => $new_key ));
1911 private function update_feed_access_key ( $feed_id , $is_cat , $owner_uid = false ) {
1912 if (! $owner_uid ) $owner_uid = $_SESSION [ "uid" ];
1914 $sql_is_cat = bool_to_sql_bool ( $is_cat );
1916 $result = db_query ( "SELECT access_key FROM ttrss_access_keys
1917 WHERE feed_id = ' $feed_id ' AND is_cat = $sql_is_cat
1918 AND owner_uid = " . $owner_uid );
1920 if ( db_num_rows ( $result ) == 1 ) {
1921 $key = uniqid_short ();
1923 db_query ( "UPDATE ttrss_access_keys SET access_key = ' $key '
1924 WHERE feed_id = ' $feed_id ' AND is_cat = $sql_is_cat
1925 AND owner_uid = " . $owner_uid );
1930 return get_feed_access_key ( $feed_id , $is_cat , $owner_uid );
1935 function clearKeys () {
1936 db_query ( "DELETE FROM ttrss_access_keys WHERE
1937 owner_uid = " . $_SESSION [ "uid" ]);
1940 private function calculate_children_count ( $cat ) {
1943 foreach ( $cat [ 'items' ] as $child ) {
1944 if ( $child [ 'type' ] == 'category' ) {
1945 $c +
= $this -> calculate_children_count ( $child );
1954 function getinactivefeeds () {
1955 if ( DB_TYPE
== "pgsql" ) {
1956 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
1958 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
1961 $result = db_query ( "SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE
1962 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
1963 ttrss_entries.id = ref_id AND
1964 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart AND
1965 ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]);
1967 print ( int ) db_fetch_result ( $result , 0 , "num_inactive" );
1970 static function subscribe_to_feed_url () {
1971 $url_path = get_self_url_prefix () .
1972 "/public.php?op=subscribe&feed_url= %s " ;