]>
git.wh0rd.org - tt-rss.git/blob - classes/pref_feeds.php
da454b48a070aa853cfb5d8ccaaf52dce27b7ee3
2 class Pref_Feeds
extends Protected_Handler
{
4 function csrf_ignore ( $method ) {
5 $csrf_ignored = array ( "index" , "getfeedtree" , "add" , "editcats" , "editfeed" ,
6 "savefeedorder" , "uploadicon" );
8 return array_search ( $method , $csrf_ignored ) !== false ;
11 function batch_edit_cbox ( $elem , $label = false ) {
12 print "<input type= \" checkbox \" title= \" " . __ ( "Check to enable field" ). " \"
13 onchange= \" dijit.byId('feedEditDlg').toggleField(this, ' $elem ', ' $label ') \" >" ;
16 function renamecat () {
17 $title = db_escape_string ( $_REQUEST [ 'title' ]);
18 $id = db_escape_string ( $_REQUEST [ 'id' ]);
21 db_query ( $this -> link
, "UPDATE ttrss_feed_categories SET
22 title = ' $title ' WHERE id = ' $id ' AND owner_uid = " . $_SESSION [ "uid" ]);
27 function remtwitterinfo () {
29 db_query ( $this -> link
, "UPDATE ttrss_users SET twitter_oauth = NULL
30 WHERE id = " . $_SESSION [ 'uid' ]);
35 function getfeedtree () {
37 $search = $_SESSION [ "prefs_feed_search" ];
39 if ( $search ) $search_qpart = " AND LOWER(title) LIKE LOWER('% $search %')" ;
43 $root [ 'name' ] = __ ( 'Feeds' );
44 $root [ 'items' ] = array ();
45 $root [ 'type' ] = 'category' ;
47 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
48 $show_empty_cats = get_pref ( $this -> link
, '_PREFS_SHOW_EMPTY_CATS' );
50 $result = db_query ( $this -> link
, "SELECT id, title FROM ttrss_feed_categories
51 WHERE owner_uid = " . $_SESSION [ "uid" ] . " ORDER BY order_id, title" );
53 while ( $line = db_fetch_assoc ( $result )) {
55 $cat [ 'id' ] = 'CAT:' . $line [ 'id' ];
56 $cat [ 'bare_id' ] = $feed_id ;
57 $cat [ 'name' ] = $line [ 'title' ];
58 $cat [ 'items' ] = array ();
59 $cat [ 'checkbox' ] = false ;
60 $cat [ 'type' ] = 'category' ;
62 $feed_result = db_query ( $this -> link
, "SELECT id, title, last_error,
63 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
65 WHERE cat_id = '" . $line [ 'id' ]. "' AND owner_uid = " . $_SESSION [ "uid" ].
66 " $search_qpart ORDER BY order_id, title" );
68 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
70 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
71 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
72 $feed [ 'name' ] = $feed_line [ 'title' ];
73 $feed [ 'checkbox' ] = false ;
74 $feed [ 'error' ] = $feed_line [ 'last_error' ];
75 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
76 $feed [ 'param' ] = make_local_datetime ( $this -> link
,
77 $feed_line [ 'last_updated' ], true );
79 array_push ( $cat [ 'items' ], $feed );
82 $cat [ 'param' ] = T_sprintf ( '( %d feeds)' , count ( $cat [ 'items' ]));
84 if ( count ( $cat [ 'items' ]) > 0 ||
$show_empty_cats )
85 array_push ( $root [ 'items' ], $cat );
87 $root [ 'param' ] +
= count ( $cat [ 'items' ]);
90 /* Uncategorized is a special case */
95 $cat [ 'name' ] = __ ( "Uncategorized" );
96 $cat [ 'items' ] = array ();
97 $cat [ 'type' ] = 'category' ;
98 $cat [ 'checkbox' ] = false ;
100 $feed_result = db_query ( $this -> link
, "SELECT id, title,last_error,
101 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
103 WHERE cat_id IS NULL AND owner_uid = " . $_SESSION [ "uid" ].
104 " $search_qpart ORDER BY order_id, title" );
106 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
108 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
109 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
110 $feed [ 'name' ] = $feed_line [ 'title' ];
111 $feed [ 'checkbox' ] = false ;
112 $feed [ 'error' ] = $feed_line [ 'last_error' ];
113 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
114 $feed [ 'param' ] = make_local_datetime ( $this -> link
,
115 $feed_line [ 'last_updated' ], true );
117 array_push ( $cat [ 'items' ], $feed );
120 $cat [ 'param' ] = T_sprintf ( '( %d feeds)' , count ( $cat [ 'items' ]));
122 if ( count ( $cat [ 'items' ]) > 0 ||
$show_empty_cats )
123 array_push ( $root [ 'items' ], $cat );
125 $root [ 'param' ] +
= count ( $cat [ 'items' ]);
126 $root [ 'param' ] = T_sprintf ( '( %d feeds)' , $root [ 'param' ]);
129 $feed_result = db_query ( $this -> link
, "SELECT id, title, last_error,
130 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
132 WHERE owner_uid = " . $_SESSION [ "uid" ].
133 " $search_qpart ORDER BY order_id, title" );
135 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
137 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
138 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
139 $feed [ 'name' ] = $feed_line [ 'title' ];
140 $feed [ 'checkbox' ] = false ;
141 $feed [ 'error' ] = $feed_line [ 'last_error' ];
142 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
143 $feed [ 'param' ] = make_local_datetime ( $this -> link
,
144 $feed_line [ 'last_updated' ], true );
146 array_push ( $root [ 'items' ], $feed );
149 $root [ 'param' ] = T_sprintf ( '( %d feeds)' , count ( $root [ 'items' ]));
154 $fl [ 'identifier' ] = 'id' ;
155 $fl [ 'label' ] = 'name' ;
156 $fl [ 'items' ] = array ( $root );
158 print json_encode ( $fl );
162 function catsortreset () {
163 db_query ( $this -> link
, "UPDATE ttrss_feed_categories
164 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
168 function feedsortreset () {
169 db_query ( $this -> link
, "UPDATE ttrss_feeds
170 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
174 function togglehiddenfeedcats () {
175 set_pref ( $this -> link
, '_PREFS_SHOW_EMPTY_CATS' ,
176 ( get_pref ( $this -> link
, '_PREFS_SHOW_EMPTY_CATS' ) ?
'false' : 'true' ));
179 function savefeedorder () {
180 $data = json_decode ( $_POST [ 'payload' ], true );
182 if ( is_array ( $data ) && is_array ( $data [ 'items' ])) {
187 foreach ( $data [ 'items' ] as $item ) {
189 if ( $item [ 'id' ] != 'root' ) {
190 if ( is_array ( $item [ 'items' ])) {
191 if ( isset ( $item [ 'items' ][ '_reference' ])) {
192 $data_map [ $item [ 'id' ]] = array ( $item [ 'items' ]);
194 $data_map [ $item [ 'id' ]] =& $item [ 'items' ];
200 foreach ( $data [ 'items' ][ 0 ][ 'items' ] as $item ) {
201 $id = $item [ '_reference' ];
202 $bare_id = substr ( $id , strpos ( $id , ':' ) +
1 );
207 db_query ( $this -> link
, "UPDATE ttrss_feed_categories
208 SET order_id = ' $cat_order_id ' WHERE id = ' $bare_id ' AND
209 owner_uid = " . $_SESSION [ "uid" ]);
214 if ( is_array ( $data_map [ $id ])) {
215 foreach ( $data_map [ $id ] as $feed ) {
216 $id = $feed [ '_reference' ];
217 $feed_id = substr ( $id , strpos ( $id , ':' ) +
1 );
220 $cat_query = "cat_id = ' $bare_id '" ;
222 $cat_query = "cat_id = NULL" ;
224 db_query ( $this -> link
, "UPDATE ttrss_feeds
225 SET order_id = ' $feed_order_id ',
227 WHERE id = ' $feed_id ' AND
228 owner_uid = " . $_SESSION [ "uid" ]);
239 function removeicon () {
240 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
242 $result = db_query ( $this -> link
, "SELECT id FROM ttrss_feeds
243 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
245 if ( db_num_rows ( $result ) != 0 ) {
246 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
252 function uploadicon () {
253 $icon_file = $_FILES [ 'icon_file' ][ 'tmp_name' ];
254 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
256 if ( is_file ( $icon_file ) && $feed_id ) {
257 if ( filesize ( $icon_file ) < 20000 ) {
259 $result = db_query ( $this -> link
, "SELECT id FROM ttrss_feeds
260 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
262 if ( db_num_rows ( $result ) != 0 ) {
263 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
264 move_uploaded_file ( $icon_file , ICONS_DIR
. "/ $feed_id .ico" );
276 print "<script type= \" text/javascript \" >" ;
277 print "parent.uploadIconHandler( $rc );" ;
282 function editfeed () {
283 global $purge_intervals ;
284 global $update_intervals ;
285 global $update_methods ;
287 $feed_id = db_escape_string ( $_REQUEST [ "id" ]);
289 $result = db_query ( $this -> link
,
290 "SELECT * FROM ttrss_feeds WHERE id = ' $feed_id ' AND
291 owner_uid = " . $_SESSION [ "uid" ]);
293 $title = htmlspecialchars ( db_fetch_result ( $result ,
296 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $feed_id\" >" ;
297 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-feeds \" >" ;
298 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" editSave \" >" ;
300 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
301 print "<div class= \" dlgSecCont \" >" ;
305 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
306 placeHolder= \" " . __ ( "Feed Title" ). " \"
307 style= \" font-size : 16px; width: 20em \" name= \" title \" value= \" $title\" >" ;
311 $feed_url = db_fetch_result ( $result , 0 , "feed_url" );
312 $feed_url = htmlspecialchars ( db_fetch_result ( $result ,
317 print __ ( 'URL:' ) . " " ;
318 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
319 placeHolder= \" " . __ ( "Feed URL" ). " \"
320 regExp='^(http|https)://.*' style= \" width : 20em \"
321 name= \" feed_url \" value= \" $feed_url\" >" ;
323 $last_error = db_fetch_result ( $result , 0 , "last_error" );
326 print " <span title= \" " . htmlspecialchars ( $last_error ). " \"
327 class= \" feed_error \" >(error)</span>" ;
333 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
335 $cat_id = db_fetch_result ( $result , 0 , "cat_id" );
339 print __ ( 'Place in category:' ) . " " ;
341 print_feed_cat_select ( $this -> link
, "cat_id" , $cat_id ,
342 'dojoType="dijit.form.Select"' );
347 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
348 print "<div class= \" dlgSecCont \" >" ;
350 /* Update Interval */
352 $update_interval = db_fetch_result ( $result , 0 , "update_interval" );
354 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
355 'dojoType="dijit.form.Select"' );
359 $update_method = db_fetch_result ( $result , 0 , "update_method" ,
360 'dojoType="dijit.form.Select"' );
362 print " " . __ ( 'using' ) . " " ;
363 print_select_hash ( "update_method" , $update_method , $update_methods ,
364 'dojoType="dijit.form.Select"' );
366 $purge_interval = db_fetch_result ( $result , 0 , "purge_interval" );
372 print __ ( 'Article purging:' ) . " " ;
374 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
375 'dojoType="dijit.form.Select" ' .
376 (( FORCE_ARTICLE_PURGE
== 0 ) ?
"" : 'disabled="1"' ));
379 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
380 print "<div class= \" dlgSecCont \" >" ;
382 $auth_login = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_login" ));
384 print "<input dojoType= \" dijit.form.TextBox \" id= \" feedEditDlg_login \"
385 placeHolder= \" " . __ ( "Login" ). " \"
386 name= \" auth_login \" value= \" $auth_login\" ><hr/>" ;
388 $auth_pass = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_pass" ));
390 print "<input dojoType= \" dijit.form.TextBox \" type= \" password \" name= \" auth_pass \"
391 placeHolder= \" " . __ ( "Password" ). " \"
392 value= \" $auth_pass\" >" ;
394 print "<div dojoType= \" dijit.Tooltip \" connectId= \" feedEditDlg_login \" position= \" below \" >
395 " . __ ( '<b>Hint:</b> you need to fill in your login information if your feed requires authentication, except for Twitter feeds.' ). "
399 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
400 print "<div class= \" dlgSecCont \" >" ;
402 $private = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "private" ));
405 $checked = "checked= \" 1 \" " ;
410 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" private \" id= \" private \"
411 $checked > <label for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
413 $rtl_content = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "rtl_content" ));
416 $checked = "checked= \" 1 \" " ;
421 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
422 $checked > <label for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
424 $include_in_digest = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "include_in_digest" ));
426 if ( $include_in_digest ) {
427 $checked = "checked= \" 1 \" " ;
432 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" include_in_digest \"
433 name= \" include_in_digest \"
434 $checked > <label for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
437 $always_display_enclosures = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "always_display_enclosures" ));
439 if ( $always_display_enclosures ) {
440 $checked = "checked" ;
445 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" always_display_enclosures \"
446 name= \" always_display_enclosures \"
447 $checked > <label for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
450 $cache_images = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "cache_images" ));
453 $checked = "checked= \" 1 \" " ;
458 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" cache_images \"
459 name= \" cache_images \"
460 $checked > <label for= \" cache_images \" >" .
461 __ ( 'Cache images locally' ). "</label>" ;
463 $mark_unread_on_update = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "mark_unread_on_update" ));
465 if ( $mark_unread_on_update ) {
466 $checked = "checked" ;
471 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" mark_unread_on_update \"
472 name= \" mark_unread_on_update \"
473 $checked > <label for= \" mark_unread_on_update \" >" . __ ( 'Mark updated articles as unread' ). "</label>" ;
475 $update_on_checksum_change = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "update_on_checksum_change" ));
477 if ( $update_on_checksum_change ) {
478 $checked = "checked" ;
483 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" update_on_checksum_change \"
484 name= \" update_on_checksum_change \"
485 $checked > <label for= \" update_on_checksum_change \" >" . __ ( 'Mark posts as updated on content change' ). "</label>" ;
491 print "<div class= \" dlgSec \" >" . __ ( "Icon" ). "</div>" ;
492 print "<div class= \" dlgSecCont \" >" ;
494 print "<iframe name= \" icon_upload_iframe \"
495 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
497 print "<form style='display : block' target= \" icon_upload_iframe \"
498 enctype= \" multipart/form-data \" method= \" POST \"
499 action= \" backend.php \" >
500 <input id= \" icon_file \" size= \" 10 \" name= \" icon_file \" type= \" file \" >
501 <input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >
502 <input type= \" hidden \" name= \" feed_id \" value= \" $feed_id\" >
503 <input type= \" hidden \" name= \" method \" value= \" uploadicon \" >
504 <button dojoType= \" dijit.form.Button \" onclick= \" return uploadFeedIcon(); \"
505 type= \" submit \" >" . __ ( 'Replace' ). "</button>
506 <button dojoType= \" dijit.form.Button \" onclick= \" return removeFeedIcon( $feed_id ); \"
507 type= \" submit \" >" . __ ( 'Remove' ). "</button>
512 $title = htmlspecialchars ( $title , ENT_QUOTES
);
514 print "<div class='dlgButtons'>
515 <div style= \" float : left \" >
516 <button dojoType= \" dijit.form.Button \" onclick='return unsubscribeFeed( $feed_id , \" $title\" )'>" .
517 __ ( 'Unsubscribe' ). "</button>" ;
519 if ( PUBSUBHUBBUB_ENABLED
) {
520 $pubsub_state = db_fetch_result ( $result , 0 , "pubsub_state" );
521 $pubsub_btn_disabled = ( $pubsub_state == 2 ) ?
"" : "disabled= \" 1 \" " ;
523 print "<button dojoType= \" dijit.form.Button \" id= \" pubsubReset_Btn \" $pubsub_btn_disabled
524 onclick='return resetPubSub( $feed_id , \" $title\" )'>" . __ ( 'Resubscribe to push updates' ).
530 print "<div dojoType= \" dijit.Tooltip \" connectId= \" pubsubReset_Btn \" position= \" below \" >" .
531 __ ( 'Resets PubSubHubbub subscription status for push-enabled feeds.' ). "</div>" ;
533 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedEditDlg').execute() \" >" . __ ( 'Save' ). "</button>
534 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedEditDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
540 function editfeeds () {
541 global $purge_intervals ;
542 global $update_intervals ;
543 global $update_methods ;
545 $feed_ids = db_escape_string ( $_REQUEST [ "ids" ]);
547 print "<div class= \" dialogNotice \" >" . __ ( "Enable the options you wish to apply using checkboxes on the right:" ) . "</div>" ;
549 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" ids \" value= \" $feed_ids\" >" ;
550 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-feeds \" >" ;
551 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" batchEditSave \" >" ;
553 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
554 print "<div class= \" dlgSecCont \" >" ;
558 print "<input dojoType= \" dijit.form.ValidationTextBox \"
559 disabled= \" 1 \" style= \" font-size : 16px; width : 20em; \" required= \" 1 \"
560 name= \" title \" value= \" $title\" >" ;
562 $this -> batch_edit_cbox ( "title" );
568 print __ ( 'URL:' ) . " " ;
569 print "<input dojoType= \" dijit.form.ValidationTextBox \" disabled= \" 1 \"
570 required= \" 1 \" regExp='^(http|https)://.*' style= \" width : 20em \"
571 name= \" feed_url \" value= \" $feed_url\" >" ;
573 $this -> batch_edit_cbox ( "feed_url" );
577 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
581 print __ ( 'Place in category:' ) . " " ;
583 print_feed_cat_select ( $this -> link
, "cat_id" , $cat_id ,
584 'disabled="1" dojoType="dijit.form.Select"' );
586 $this -> batch_edit_cbox ( "cat_id" );
592 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
593 print "<div class= \" dlgSecCont \" >" ;
595 /* Update Interval */
597 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
598 'disabled="1" dojoType="dijit.form.Select"' );
600 $this -> batch_edit_cbox ( "update_interval" );
604 print " " . __ ( 'using' ) . " " ;
605 print_select_hash ( "update_method" , $update_method , $update_methods ,
606 'disabled="1" dojoType="dijit.form.Select"' );
607 $this -> batch_edit_cbox ( "update_method" );
611 if ( FORCE_ARTICLE_PURGE
== 0 ) {
615 print __ ( 'Article purging:' ) . " " ;
617 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
618 'disabled="1" dojoType="dijit.form.Select"' );
620 $this -> batch_edit_cbox ( "purge_interval" );
624 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
625 print "<div class= \" dlgSecCont \" >" ;
627 print "<input dojoType= \" dijit.form.TextBox \"
628 placeHolder= \" " . __ ( "Login" ). " \" disabled= \" 1 \"
629 name= \" auth_login \" value= \" $auth_login\" >" ;
631 $this -> batch_edit_cbox ( "auth_login" );
633 print "<br/><input dojoType= \" dijit.form.TextBox \" type= \" password \" name= \" auth_pass \"
634 placeHolder= \" " . __ ( "Password" ). " \" disabled= \" 1 \"
635 value= \" $auth_pass\" >" ;
637 $this -> batch_edit_cbox ( "auth_pass" );
640 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
641 print "<div class= \" dlgSecCont \" >" ;
643 print "<input disabled= \" 1 \" type= \" checkbox \" name= \" private \" id= \" private \"
644 dojoType= \" dijit.form.CheckBox \" > <label id= \" private_l \" class='insensitive' for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
646 print " " ; $this -> batch_edit_cbox ( "private" , "private_l" );
648 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
649 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" rtl_content_l \" for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
651 print " " ; $this -> batch_edit_cbox ( "rtl_content" , "rtl_content_l" );
653 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" include_in_digest \"
654 name= \" include_in_digest \"
655 dojoType= \" dijit.form.CheckBox \" > <label id= \" include_in_digest_l \" class='insensitive' for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
657 print " " ; $this -> batch_edit_cbox ( "include_in_digest" , "include_in_digest_l" );
659 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" always_display_enclosures \"
660 name= \" always_display_enclosures \"
661 dojoType= \" dijit.form.CheckBox \" > <label id= \" always_display_enclosures_l \" class='insensitive' for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
663 print " " ; $this -> batch_edit_cbox ( "always_display_enclosures" , "always_display_enclosures_l" );
665 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" cache_images \"
666 name= \" cache_images \"
667 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" cache_images_l \"
668 for= \" cache_images \" >" .
669 __ ( 'Cache images locally' ). "</label>" ;
671 print " " ; $this -> batch_edit_cbox ( "cache_images" , "cache_images_l" );
673 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" mark_unread_on_update \"
674 name= \" mark_unread_on_update \"
675 dojoType= \" dijit.form.CheckBox \" > <label id= \" mark_unread_on_update_l \" class='insensitive' for= \" mark_unread_on_update \" >" . __ ( 'Mark updated articles as unread' ). "</label>" ;
677 print " " ; $this -> batch_edit_cbox ( "mark_unread_on_update" , "mark_unread_on_update_l" );
679 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" update_on_checksum_change \"
680 name= \" update_on_checksum_change \"
681 dojoType= \" dijit.form.CheckBox \" > <label id= \" update_on_checksum_change_l \" class='insensitive' for= \" update_on_checksum_change \" >" . __ ( 'Mark posts as updated on content change' ). "</label>" ;
683 print " " ; $this -> batch_edit_cbox ( "update_on_checksum_change" , "update_on_checksum_change_l" );
687 print "<div class='dlgButtons'>
688 <button dojoType= \" dijit.form.Button \"
689 onclick= \" return dijit.byId('feedEditDlg').execute() \" >" .
690 __ ( 'Save' ). "</button>
691 <button dojoType= \" dijit.form.Button \"
692 onclick= \" return dijit.byId('feedEditDlg').hide() \" >" .
693 __ ( 'Cancel' ). "</button>
699 function batchEditSave () {
700 return $this -> editsaveops ( true );
703 function editSave () {
704 return $this -> editsaveops ( false );
707 function editsaveops ( $batch ) {
709 $feed_title = db_escape_string ( trim ( $_POST [ "title" ]));
710 $feed_link = db_escape_string ( trim ( $_POST [ "feed_url" ]));
711 $upd_intl = ( int ) db_escape_string ( $_POST [ "update_interval" ]);
712 $purge_intl = ( int ) db_escape_string ( $_POST [ "purge_interval" ]);
713 $feed_id = ( int ) db_escape_string ( $_POST [ "id" ]); /* editSave */
714 $feed_ids = db_escape_string ( $_POST [ "ids" ]); /* batchEditSave */
715 $cat_id = ( int ) db_escape_string ( $_POST [ "cat_id" ]);
716 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
717 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
718 $private = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "private" ]));
719 $rtl_content = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "rtl_content" ]));
720 $include_in_digest = checkbox_to_sql_bool (
721 db_escape_string ( $_POST [ "include_in_digest" ]));
722 $cache_images = checkbox_to_sql_bool (
723 db_escape_string ( $_POST [ "cache_images" ]));
724 $update_method = ( int ) db_escape_string ( $_POST [ "update_method" ]);
726 $always_display_enclosures = checkbox_to_sql_bool (
727 db_escape_string ( $_POST [ "always_display_enclosures" ]));
729 $mark_unread_on_update = checkbox_to_sql_bool (
730 db_escape_string ( $_POST [ "mark_unread_on_update" ]));
732 $update_on_checksum_change = checkbox_to_sql_bool (
733 db_escape_string ( $_POST [ "update_on_checksum_change" ]));
735 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
736 if ( $cat_id && $cat_id != 0 ) {
737 $category_qpart = "cat_id = ' $cat_id '," ;
738 $category_qpart_nocomma = "cat_id = ' $cat_id '" ;
740 $category_qpart = 'cat_id = NULL,' ;
741 $category_qpart_nocomma = 'cat_id = NULL' ;
744 $category_qpart = "" ;
745 $category_qpart_nocomma = "" ;
748 $cache_images_qpart = "cache_images = $cache_images ," ;
752 $result = db_query ( $this -> link
, "UPDATE ttrss_feeds SET
754 title = ' $feed_title ', feed_url = ' $feed_link ',
755 update_interval = ' $upd_intl ',
756 purge_interval = ' $purge_intl ',
757 auth_login = ' $auth_login ',
758 auth_pass = ' $auth_pass ',
760 rtl_content = $rtl_content ,
762 include_in_digest = $include_in_digest ,
763 always_display_enclosures = $always_display_enclosures ,
764 mark_unread_on_update = $mark_unread_on_update ,
765 update_on_checksum_change = $update_on_checksum_change ,
766 update_method = ' $update_method '
767 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
770 $feed_data = array ();
772 foreach ( array_keys ( $_POST ) as $k ) {
773 if ( $k != "op" && $k != "method" && $k != "ids" ) {
774 $feed_data [ $k ] = $_POST [ $k ];
778 db_query ( $this -> link
, "BEGIN" );
780 foreach ( array_keys ( $feed_data ) as $k ) {
786 $qpart = "title = ' $feed_title '" ;
790 $qpart = "feed_url = ' $feed_link '" ;
793 case "update_interval" :
794 $qpart = "update_interval = ' $upd_intl '" ;
797 case "purge_interval" :
798 $qpart = "purge_interval = ' $purge_intl '" ;
802 $qpart = "auth_login = ' $auth_login '" ;
806 $qpart = "auth_pass = ' $auth_pass '" ;
810 $qpart = "private = $private " ;
813 case "include_in_digest" :
814 $qpart = "include_in_digest = $include_in_digest " ;
817 case "always_display_enclosures" :
818 $qpart = "always_display_enclosures = $always_display_enclosures " ;
821 case "mark_unread_on_update" :
822 $qpart = "mark_unread_on_update = $mark_unread_on_update " ;
825 case "update_on_checksum_change" :
826 $qpart = "update_on_checksum_change = $update_on_checksum_change " ;
830 $qpart = "cache_images = $cache_images " ;
834 $qpart = "rtl_content = $rtl_content " ;
837 case "update_method" :
838 $qpart = "update_method = ' $update_method '" ;
842 $qpart = $category_qpart_nocomma ;
848 db_query ( $this -> link
,
849 "UPDATE ttrss_feeds SET $qpart WHERE id IN ( $feed_ids )
850 AND owner_uid = " . $_SESSION [ "uid" ]);
855 db_query ( $this -> link
, "COMMIT" );
860 function resetPubSub () {
862 $ids = db_escape_string ( $_REQUEST [ "ids" ]);
864 db_query ( $this -> link
, "UPDATE ttrss_feeds SET pubsub_state = 0 WHERE id IN ( $ids )
865 AND owner_uid = " . $_SESSION [ "uid" ]);
872 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
874 foreach ( $ids as $id ) {
875 remove_feed ( $this -> link
, $id , $_SESSION [ "uid" ]);
882 $id = db_escape_string ( $_REQUEST [ "id" ]);
883 clear_feed_articles ( $this -> link
, $id );
887 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
889 foreach ( $ids as $id ) {
891 $filters = load_filters ( $this -> link
, $id , $_SESSION [ "uid" ], 6 );
893 $result = db_query ( $this -> link
, "SELECT
894 title, content, link, ref_id, author," .
895 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
897 ttrss_user_entries, ttrss_entries
898 WHERE ref_id = id AND feed_id = ' $id ' AND
899 owner_uid = " . $_SESSION [ 'uid' ]. "
904 while ( $line = db_fetch_assoc ( $result )) {
906 $tags = get_article_tags ( $this -> link
, $line [ "ref_id" ]);
908 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
909 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
910 $line [ 'author' ], $tags );
912 $new_score = calculate_article_score ( $article_filters );
914 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
916 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
919 foreach ( array_keys ( $scores ) as $s ) {
921 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
923 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
924 } else if ( $s < - 500 ) {
925 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
927 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
929 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
930 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
935 print __ ( "All done." );
939 function rescoreAll () {
941 $result = db_query ( $this -> link
,
942 "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION [ 'uid' ]);
944 while ( $feed_line = db_fetch_assoc ( $result )) {
946 $id = $feed_line [ "id" ];
948 $filters = load_filters ( $this -> link
, $id , $_SESSION [ "uid" ], 6 );
950 $tmp_result = db_query ( $this -> link
, "SELECT
951 title, content, link, ref_id, author," .
952 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
954 ttrss_user_entries, ttrss_entries
955 WHERE ref_id = id AND feed_id = ' $id ' AND
956 owner_uid = " . $_SESSION [ 'uid' ]. "
961 while ( $line = db_fetch_assoc ( $tmp_result )) {
963 $tags = get_article_tags ( $this -> link
, $line [ "ref_id" ]);
965 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
966 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
967 $line [ 'author' ], $tags );
969 $new_score = calculate_article_score ( $article_filters );
971 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
973 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
976 foreach ( array_keys ( $scores ) as $s ) {
978 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
980 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
982 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
983 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
988 print __ ( "All done." );
993 $feed_url = db_escape_string ( trim ( $_REQUEST [ "feed_url" ]));
994 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
995 $p_from = db_escape_string ( $_REQUEST [ "from" ]);
997 /* only read authentication information from POST */
999 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
1000 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
1002 if ( $p_from != 'tt-rss' ) {
1003 header ( 'Content-Type: text/html; charset=utf-8' );
1006 <title>Tiny Tiny RSS</title>
1007 <link rel= \" stylesheet \" type= \" text/css \" href= \" utility.css \" >
1008 <meta http-equiv= \" Content-Type \" content= \" text/html; charset=utf-8 \" />
1011 <img class= \" floatingLogo \" src= \" images/ttrss_logo.png \"
1012 alt= \" Tiny Tiny RSS \" />
1013 <h1>Subscribe to feed...</h1>" ;
1016 $rc = subscribe_to_feed ( $this -> link
, $feed_url , $cat_id , $auth_login , $auth_pass );
1020 print_notice ( T_sprintf ( "Subscribed to <b> %s </b>." , $feed_url ));
1023 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>." , $feed_url ));
1026 print_error ( T_sprintf ( "No feeds found in <b> %s </b>." , $feed_url ));
1029 print_warning ( T_sprintf ( "Already subscribed to <b> %s </b>." , $feed_url ));
1032 print_notice ( __ ( "Multiple feed URLs found." ));
1034 $feed_urls = get_feeds_from_html ( $feed_url );
1037 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>.<br>Can't download the Feed URL." , $feed_url ));
1041 if ( $p_from != 'tt-rss' ) {
1045 print "<form action= \" backend.php \" >" ;
1046 print "<input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >" ;
1047 print "<input type= \" hidden \" name= \" quiet \" value= \" 1 \" >" ;
1048 print "<input type= \" hidden \" name= \" method \" value= \" add \" >" ;
1050 print "<select name= \" feed_url \" >" ;
1052 foreach ( $feed_urls as $url => $name ) {
1053 $url = htmlspecialchars ( $url );
1054 $name = htmlspecialchars ( $name );
1056 print "<option value= \" $url\" > $name </option>" ;
1059 print "<input type= \" submit \" value= \" " . __ ( "Subscribe to selected feed" ).
1065 $tp_uri = get_self_url_prefix () . "/prefs.php" ;
1066 $tt_uri = get_self_url_prefix ();
1069 $result = db_query ( $this -> link
, "SELECT id FROM ttrss_feeds WHERE
1070 feed_url = ' $feed_url ' AND owner_uid = " . $_SESSION [ "uid" ]);
1072 $feed_id = db_fetch_result ( $result , 0 , "id" );
1079 print "<form method= \" GET \" style='display: inline'
1081 <input type= \" hidden \" name= \" tab \" value= \" feedConfig \" >
1082 <input type= \" hidden \" name= \" method \" value= \" editFeed \" >
1083 <input type= \" hidden \" name= \" methodparam \" value= \" $feed_id\" >
1084 <input type= \" submit \" value= \" " . __ ( "Edit subscription options" ). " \" >
1088 print "<form style='display: inline' method= \" GET \" action= \" $tt_uri\" >
1089 <input type= \" submit \" value= \" " . __ ( "Return to Tiny Tiny RSS" ). " \" >
1092 print "</body></html>" ;
1097 function categorize () {
1098 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
1100 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
1103 $cat_id_qpart = 'NULL' ;
1105 $cat_id_qpart = "' $cat_id '" ;
1108 db_query ( $this -> link
, "BEGIN" );
1110 foreach ( $ids as $id ) {
1112 db_query ( $this -> link
, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
1114 AND owner_uid = " . $_SESSION [ "uid" ]);
1118 db_query ( $this -> link
, "COMMIT" );
1121 function editCats () {
1123 $action = $_REQUEST [ "action" ];
1125 if ( $action == "save" ) {
1127 $cat_title = db_escape_string ( trim ( $_REQUEST [ "value" ]));
1128 $cat_id = db_escape_string ( $_REQUEST [ "cid" ]);
1130 db_query ( $this -> link
, "BEGIN" );
1132 $result = db_query ( $this -> link
, "SELECT title FROM ttrss_feed_categories
1133 WHERE id = ' $cat_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
1135 if ( db_num_rows ( $result ) == 1 ) {
1137 $old_title = db_fetch_result ( $result , 0 , "title" );
1139 if ( $cat_title != "" ) {
1140 $result = db_query ( $this -> link
, "UPDATE ttrss_feed_categories SET
1141 title = ' $cat_title ' WHERE id = ' $cat_id ' AND
1142 owner_uid = " . $_SESSION [ "uid" ]);
1149 print $_REQUEST [ "value" ];
1152 db_query ( $this -> link
, "COMMIT" );
1158 if ( $action == "add" ) {
1160 $feed_cat = db_escape_string ( trim ( $_REQUEST [ "cat" ]));
1162 if (! add_feed_category ( $this -> link
, $feed_cat ))
1163 print_warning ( T_sprintf ( "Category <b>$ %s </b> already exists in the database." , $feed_cat ));
1167 if ( $action == "remove" ) {
1169 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
1171 foreach ( $ids as $id ) {
1172 remove_feed_category ( $this -> link
, $id , $_SESSION [ "uid" ]);
1176 print "<div dojoType= \" dijit.Toolbar \" >" ;
1178 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1179 "<span>" . __ ( 'Select' ). "</span>" ;
1180 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1181 print "<div onclick= \" selectTableRows('prefFeedCatList', 'all') \"
1182 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
1183 print "<div onclick= \" selectTableRows('prefFeedCatList', 'none') \"
1184 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
1185 print "</div></div>" ;
1187 print "<div style='float : right'>" ;
1189 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \" name= \" newcat \" >
1190 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').addCategory() \" >" .
1191 __ ( 'Create category' ). "</button></div>" ;
1195 $result = db_query ( $this -> link
, "SELECT c.title, c.id,COUNT(f.*) AS count
1196 FROM ttrss_feed_categories AS c LEFT JOIN ttrss_feeds AS f ON
1198 WHERE c.owner_uid = " . $_SESSION [ "uid" ]. "
1199 GROUP BY c.title, c.id ORDER BY title" );
1201 if ( db_num_rows ( $result ) != 0 ) {
1203 print "<div class= \" prefFeedCatHolder \" >" ;
1205 print "<table width= \" 100% \" class= \" prefFeedCatList \"
1206 cellspacing= \" 0 \" id= \" prefFeedCatList \" >" ;
1210 while ( $line = db_fetch_assoc ( $result )) {
1212 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
1214 $cat_id = $line [ "id" ];
1215 $this_row_id = "id= \" FCATR- $cat_id\" " ;
1217 print "<tr class= \" placeholder \" $this_row_id >" ;
1219 $edit_title = htmlspecialchars ( $line [ "title" ]);
1221 print "<td width='5%' align='center'><input id= \" FCATC- $cat_id\"
1222 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
1223 type= \" checkbox \" ></td>" ;
1227 print "<span dojoType= \" dijit.InlineEditBox \"
1228 width= \" 300px \" autoSave= \" false \"
1229 cat-id= \" $cat_id\" >" . $edit_title .
1230 "<script type= \" dojo/method \" event= \" onChange \" args= \" item \" >
1234 content: {op: 'pref-feeds', method: 'editCats',
1237 cid: this.srcNodeRef.getAttribute('cat-id')},
1238 load: function(response) {
1239 elem.attr('value', response);
1246 print "<td align='right' class='insensitive'>" ;
1247 echo T_sprintf ( " %d feeds" , $line [ 'count' ]);
1257 print "<p>" . __ ( 'No feed categories defined.' ). "</p>" ;
1260 print "<div class='dlgButtons'>
1261 <div style='float : left'>
1262 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').removeSelected() \" >" .
1263 __ ( 'Remove selected categories' ). "</button>
1266 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').hide() \" >" .
1267 __ ( 'Close this window' ). "</button></div>" ;
1275 print "<div dojoType= \" dijit.layout.AccordionContainer \" region= \" center \" >" ;
1276 print "<div id= \" pref-feeds-feeds \" dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Feeds' ). " \" >" ;
1278 $result = db_query ( $this -> link
, "SELECT COUNT(id) AS num_errors
1279 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
1281 $num_errors = db_fetch_result ( $result , 0 , "num_errors" );
1283 if ( $num_errors > 0 ) {
1285 $error_button = "<button dojoType= \" dijit.form.Button \"
1286 onclick= \" showFeedsWithErrors() \" id= \" errorButton \" >" .
1287 __ ( "Feeds with errors" ) . "</button>" ;
1290 if ( DB_TYPE
== "pgsql" ) {
1291 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
1293 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
1296 $result = db_query ( $this -> link
, "SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE
1297 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
1298 ttrss_entries.id = ref_id AND
1299 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart AND
1300 ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]);
1302 $num_inactive = db_fetch_result ( $result , 0 , "num_inactive" );
1304 if ( $num_inactive > 0 ) {
1305 $inactive_button = "<button dojoType= \" dijit.form.Button \"
1306 onclick= \" showInactiveFeeds() \" >" .
1307 __ ( "Inactive feeds" ) . "</button>" ;
1310 $feed_search = db_escape_string ( $_REQUEST [ "search" ]);
1312 if ( array_key_exists ( "search" , $_REQUEST )) {
1313 $_SESSION [ "prefs_feed_search" ] = $feed_search ;
1315 $feed_search = $_SESSION [ "prefs_feed_search" ];
1318 print '<div dojoType="dijit.layout.BorderContainer" gutters="false">' ;
1320 print "<div region='top' dojoType= \" dijit.Toolbar \" >" ; #toolbar
1322 print "<div style='float : right; padding-right : 4px;'>
1323 <input dojoType= \" dijit.form.TextBox \" id= \" feed_search \" size= \" 20 \" type= \" search \"
1324 value= \" $feed_search\" >
1325 <button dojoType= \" dijit.form.Button \" onclick= \" updateFeedList() \" >" .
1326 __ ( 'Search' ). "</button>
1329 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1330 "<span>" . __ ( 'Select' ). "</span>" ;
1331 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1332 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(true) \"
1333 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
1334 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(false) \"
1335 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
1336 print "</div></div>" ;
1338 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1339 "<span>" . __ ( 'Feeds' ). "</span>" ;
1340 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1341 print "<div onclick= \" quickAddFeed() \"
1342 dojoType= \" dijit.MenuItem \" >" . __ ( 'Subscribe to feed' ). "</div>" ;
1343 print "<div onclick= \" editSelectedFeed() \"
1344 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit selected feeds' ). "</div>" ;
1345 print "<div onclick= \" resetFeedOrder() \"
1346 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1347 print "<div onclick= \" batchSubscribe() \"
1348 dojoType= \" dijit.MenuItem \" >" . __ ( 'Batch subscribe' ). "</div>" ;
1349 print "</div></div>" ;
1351 if ( get_pref ( $this -> link
, '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= \" editFeedCats() \"
1356 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit categories' ). "</div>" ;
1357 print "<div onclick= \" toggleHiddenFeedCats() \"
1358 dojoType= \" dijit.MenuItem \" >" . __ ( '(Un)hide empty categories' ). "</div>" ;
1359 print "<div onclick= \" resetCatOrder() \"
1360 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1361 print "</div></div>" ;
1365 print $error_button ;
1366 print $inactive_button ;
1368 print "<button dojoType= \" dijit.form.Button \" onclick= \" removeSelectedFeeds() \" >"
1369 . __ ( 'Unsubscribe' ). "</button dojoType= \" dijit.form.Button \" > " ;
1371 if ( defined ( '_ENABLE_FEED_DEBUGGING' )) {
1373 print "<select id= \" feedActionChooser \" onchange= \" feedActionChange() \" >
1374 <option value= \" facDefault \" selected>" . __ ( 'More actions...' ). "</option>" ;
1376 if ( FORCE_ARTICLE_PURGE
== 0 ) {
1378 "<option value= \" facPurge \" >" . __ ( 'Manual purge' ). "</option>" ;
1382 <option value= \" facClear \" >" . __ ( 'Clear feed data' ). "</option>
1383 <option value= \" facRescore \" >" . __ ( 'Rescore articles' ). "</option>" ;
1389 print "</div>" ; # toolbar
1392 print '<div dojoType="dijit.layout.ContentPane" region="center">' ;
1394 print "<div id= \" feedlistLoading \" >
1395 <img src='images/indicator_tiny.gif'>" .
1396 __ ( "Loading, please wait..." ). "</div>" ;
1398 print "<div dojoType= \" fox.PrefFeedStore \" jsId= \" feedStore \"
1399 url= \" backend.php?op=pref-feeds&method=getfeedtree \" >
1401 <div dojoType= \" lib.CheckBoxStoreModel \" jsId= \" feedModel \" store= \" feedStore \"
1402 query= \" {id:'root'} \" rootId= \" root \" rootLabel= \" Feeds \"
1403 childrenAttrs= \" items \" checkboxStrict= \" false \" checkboxAll= \" false \" >
1405 <div dojoType= \" fox.PrefFeedTree \" id= \" feedTree \"
1406 dndController= \" dijit.tree.dndSource \"
1407 betweenThreshold= \" 5 \"
1408 model= \" feedModel \" openOnClick= \" false \" >
1409 <script type= \" dojo/method \" event= \" onClick \" args= \" item \" >
1410 var id = String(item.id);
1411 var bare_id = id.substr(id.indexOf(':')+1);
1413 if (id.match('FEED:')) {
1415 } else if (id.match('CAT:')) {
1416 editCat(bare_id, item);
1419 <script type= \" dojo/method \" event= \" onLoad \" args= \" item \" >
1420 Element.hide( \" feedlistLoading \" );
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= \" " . __ ( 'Import and export' ). " \" >" ;
1435 print "<h3>" . __ ( "OPML" ) . "</h3>" ;
1437 print "<p>" . __ ( "Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings." ) . " " ;
1439 print __ ( "Only main settings profile can be migrated using OPML." ) . "</p>" ;
1441 print "<iframe id= \" upload_iframe \"
1442 name= \" upload_iframe \" onload= \" opmlImportComplete(this) \"
1443 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
1445 print "<form name= \" opml_form \" style='display : block' target= \" upload_iframe \"
1446 enctype= \" multipart/form-data \" method= \" POST \"
1447 action= \" backend.php \" >
1448 <input id= \" opml_file \" name= \" opml_file \" type= \" file \" >
1449 <input type= \" hidden \" name= \" op \" value= \" dlg \" >
1450 <input type= \" hidden \" name= \" method \" value= \" importOpml \" >
1451 <button dojoType= \" dijit.form.Button \" onclick= \" return opmlImport(); \" type= \" submit \" >" .
1452 __ ( 'Import my OPML' ) . "</button>" ;
1456 print "<p>" . __ ( 'Filename:' ) .
1457 " <input type= \" text \" id= \" filename \" value= \" TinyTinyRSS.opml \" /> " .
1458 __ ( 'Include settings' ) . "<input type= \" checkbox \" id= \" settings \" checked= \" 1 \" />" ;
1460 print "</p><button dojoType= \" dijit.form.Button \"
1461 onclick= \" gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked) \" >" .
1462 __ ( 'Export OPML' ) . "</button></p></form>" ;
1466 print "<p>" . __ ( 'Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.' ) . " " ;
1468 print __ ( "Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds." ) . "</p>" ;
1470 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('pubOPMLUrl') \" >" .
1471 __ ( 'Display published OPML URL' ). "</button> " ;
1474 print "<h3>" . __ ( "Article archive" ) . "</h3>" ;
1476 print "<p>" . __ ( "You can export and import your Starred and Archived articles for safekeeping or when migrating between tt-rss instances." ) . "</p>" ;
1478 print "<button dojoType= \" dijit.form.Button \" onclick= \" return exportData() \" >" .
1479 __ ( 'Export my data' ). "</button> " ;
1483 print "<iframe id= \" data_upload_iframe \"
1484 name= \" data_upload_iframe \" onload= \" dataImportComplete(this) \"
1485 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
1487 print "<form name= \" import_form \" style='display : block' target= \" data_upload_iframe \"
1488 enctype= \" multipart/form-data \" method= \" POST \"
1489 action= \" backend.php \" >
1490 <input id= \" export_file \" name= \" export_file \" type= \" file \" >
1491 <input type= \" hidden \" name= \" op \" value= \" dlg \" >
1492 <input type= \" hidden \" name= \" method \" value= \" dataimport \" >
1493 <button dojoType= \" dijit.form.Button \" onclick= \" return importData(); \" type= \" submit \" >" .
1494 __ ( 'Import' ) . "</button>" ;
1497 print "</div>" ; # pane
1499 if ( strpos ( $_SERVER [ 'HTTP_USER_AGENT' ], "Firefox" ) !== false ) {
1501 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Firefox integration' ). " \" >" ;
1503 print "<p>" . __ ( 'This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.' ) . "</p>" ;
1507 print "<button onclick='window.navigator.registerContentHandler(" .
1508 " \" application/vnd.mozilla.maybe.feed \" , " .
1509 " \" " . add_feed_url () . " \" , " . " \" Tiny Tiny RSS \" )'>" .
1510 __ ( 'Click here to register this site as a feed reader.' ) .
1515 print "</div>" ; # pane
1518 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Subscribing using bookmarklet' ). " \" >" ;
1520 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>" ;
1522 $bm_subscribe_url = str_replace ( ' %s ' , '' , add_feed_url ());
1524 $confirm_str = str_replace ( "'" , " \' " , __ ( 'Subscribe to %s in Tiny Tiny RSS?' ));
1526 $bm_url = htmlspecialchars ( "javascript:{if(confirm(' $confirm_str '.replace(' %s ',window.location.href)))window.location.href=' $bm_subscribe_url '+window.location.href}" );
1528 print "<a href= \" $bm_url\" class='bookmarklet'>" . __ ( 'Subscribe in Tiny Tiny RSS' ). "</a>" ;
1530 print "</div>" ; #pane
1532 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Published & shared articles / Generated feeds' ). " \" >" ;
1534 print "<h3>" . __ ( "Published articles and generated feeds" ) . "</h3>" ;
1536 print "<p>" . __ ( 'Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.' ). "</p>" ;
1538 $rss_url = '-2::' . htmlspecialchars ( get_self_url_prefix () .
1539 "/public.php?op=rss&id=-2&view-mode=all_articles" );;
1541 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('generatedFeed', ' $rss_url ') \" >" .
1542 __ ( 'Display URL' ). "</button> " ;
1544 print "<button dojoType= \" dijit.form.Button \" onclick= \" return clearFeedAccessKeys() \" >" .
1545 __ ( 'Clear all generated URLs' ). "</button> " ;
1547 print "<h3>" . __ ( "Articles shared by URL" ) . "</h3>" ;
1549 print "<p>" . __ ( "You can disable all articles shared by unique URLs here." ) . "</p>" ;
1551 print "<button dojoType= \" dijit.form.Button \" onclick= \" return clearArticleAccessKeys() \" >" .
1552 __ ( 'Unshare all articles' ). "</button> " ;
1554 print "</div>" ; #pane
1556 if ( defined ( 'CONSUMER_KEY' ) && CONSUMER_KEY
!= '' ) {
1558 print "<div id= \" pref-feeds-twitter \" dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Twitter' ). " \" >" ;
1560 $result = db_query ( $this -> link
, "SELECT COUNT(*) AS cid FROM ttrss_users
1561 WHERE twitter_oauth IS NOT NULL AND twitter_oauth != '' AND
1562 id = " . $_SESSION [ 'uid' ]);
1564 $is_registered = db_fetch_result ( $result , 0 , "cid" ) != 0 ;
1566 if (! $is_registered ) {
1567 print_notice ( __ ( 'Before you can update your Twitter feeds, you must register this instance of Tiny Tiny RSS with Twitter.com.' ));
1569 print_notice ( __ ( 'You have been successfully registered with Twitter.com and should be able to access your Twitter feeds.' ));
1572 print "<button dojoType= \" dijit.form.Button \" onclick= \" window.location.href = 'twitter.php?op=register' \" >" .
1573 __ ( "Register with Twitter.com" ). "</button>" ;
1577 print "<button dojoType= \" dijit.form.Button \"
1578 onclick= \" return clearTwitterCredentials() \" >" .
1579 __ ( "Clear stored credentials" ). "</button>" ;
1581 print "</div>" ; # pane
1585 print "</div>" ; #container