]>
git.wh0rd.org - tt-rss.git/blob - classes/pref_feeds.php
2 class Pref_Feeds
extends Protected_Handler
{
4 function csrf_ignore ( $method ) {
5 $csrf_ignored = array ( "index" , "getfeedtree" , "add" , "editcats" , "editfeed" ,
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 "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" ids \" value= \" $feed_ids\" >" ;
548 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-feeds \" >" ;
549 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" batchEditSave \" >" ;
551 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
552 print "<div class= \" dlgSecCont \" >" ;
556 print "<input dojoType= \" dijit.form.ValidationTextBox \"
557 disabled= \" 1 \" style= \" font-size : 16px; width : 20em; \" required= \" 1 \"
558 name= \" title \" value= \" $title\" >" ;
560 $this -> batch_edit_cbox ( "title" );
566 print __ ( 'URL:' ) . " " ;
567 print "<input dojoType= \" dijit.form.ValidationTextBox \" disabled= \" 1 \"
568 required= \" 1 \" regExp='^(http|https)://.*' style= \" width : 20em \"
569 name= \" feed_url \" value= \" $feed_url\" >" ;
571 $this -> batch_edit_cbox ( "feed_url" );
575 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
579 print __ ( 'Place in category:' ) . " " ;
581 print_feed_cat_select ( $this -> link
, "cat_id" , $cat_id ,
582 'disabled="1" dojoType="dijit.form.Select"' );
584 $this -> batch_edit_cbox ( "cat_id" );
590 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
591 print "<div class= \" dlgSecCont \" >" ;
593 /* Update Interval */
595 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
596 'disabled="1" dojoType="dijit.form.Select"' );
598 $this -> batch_edit_cbox ( "update_interval" );
602 print " " . __ ( 'using' ) . " " ;
603 print_select_hash ( "update_method" , $update_method , $update_methods ,
604 'disabled="1" dojoType="dijit.form.Select"' );
605 $this -> batch_edit_cbox ( "update_method" );
609 if ( FORCE_ARTICLE_PURGE
== 0 ) {
613 print __ ( 'Article purging:' ) . " " ;
615 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
616 'disabled="1" dojoType="dijit.form.Select"' );
618 $this -> batch_edit_cbox ( "purge_interval" );
622 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
623 print "<div class= \" dlgSecCont \" >" ;
625 print "<input dojoType= \" dijit.form.TextBox \"
626 placeHolder= \" " . __ ( "Login" ). " \" disabled= \" 1 \"
627 name= \" auth_login \" value= \" $auth_login\" >" ;
629 $this -> batch_edit_cbox ( "auth_login" );
631 print "<br/><input dojoType= \" dijit.form.TextBox \" type= \" password \" name= \" auth_pass \"
632 placeHolder= \" " . __ ( "Password" ). " \" disabled= \" 1 \"
633 value= \" $auth_pass\" >" ;
635 $this -> batch_edit_cbox ( "auth_pass" );
638 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
639 print "<div class= \" dlgSecCont \" >" ;
641 print "<input disabled= \" 1 \" type= \" checkbox \" name= \" private \" id= \" private \"
642 dojoType= \" dijit.form.CheckBox \" > <label id= \" private_l \" class='insensitive' for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
644 print " " ; $this -> batch_edit_cbox ( "private" , "private_l" );
646 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
647 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" rtl_content_l \" for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
649 print " " ; $this -> batch_edit_cbox ( "rtl_content" , "rtl_content_l" );
651 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" include_in_digest \"
652 name= \" include_in_digest \"
653 dojoType= \" dijit.form.CheckBox \" > <label id= \" include_in_digest_l \" class='insensitive' for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
655 print " " ; $this -> batch_edit_cbox ( "include_in_digest" , "include_in_digest_l" );
657 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" always_display_enclosures \"
658 name= \" always_display_enclosures \"
659 dojoType= \" dijit.form.CheckBox \" > <label id= \" always_display_enclosures_l \" class='insensitive' for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
661 print " " ; $this -> batch_edit_cbox ( "always_display_enclosures" , "always_display_enclosures_l" );
663 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" cache_images \"
664 name= \" cache_images \"
665 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" cache_images_l \"
666 for= \" cache_images \" >" .
667 __ ( 'Cache images locally' ). "</label>" ;
669 print " " ; $this -> batch_edit_cbox ( "cache_images" , "cache_images_l" );
671 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" mark_unread_on_update \"
672 name= \" mark_unread_on_update \"
673 dojoType= \" dijit.form.CheckBox \" > <label id= \" mark_unread_on_update_l \" class='insensitive' for= \" mark_unread_on_update \" >" . __ ( 'Mark updated articles as unread' ). "</label>" ;
675 print " " ; $this -> batch_edit_cbox ( "mark_unread_on_update" , "mark_unread_on_update_l" );
677 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" update_on_checksum_change \"
678 name= \" update_on_checksum_change \"
679 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>" ;
681 print " " ; $this -> batch_edit_cbox ( "update_on_checksum_change" , "update_on_checksum_change_l" );
685 print "<div class='dlgButtons'>
686 <button dojoType= \" dijit.form.Button \"
687 onclick= \" return dijit.byId('feedEditDlg').execute() \" >" .
688 __ ( 'Save' ). "</button>
689 <button dojoType= \" dijit.form.Button \"
690 onclick= \" return dijit.byId('feedEditDlg').hide() \" >" .
691 __ ( 'Cancel' ). "</button>
697 function batchEditSave () {
698 return $this -> editsaveops ( true );
701 function editSave () {
702 return $this -> editsaveops ( false );
705 function editsaveops ( $batch ) {
707 $feed_title = db_escape_string ( trim ( $_POST [ "title" ]));
708 $feed_link = db_escape_string ( trim ( $_POST [ "feed_url" ]));
709 $upd_intl = ( int ) db_escape_string ( $_POST [ "update_interval" ]);
710 $purge_intl = ( int ) db_escape_string ( $_POST [ "purge_interval" ]);
711 $feed_id = ( int ) db_escape_string ( $_POST [ "id" ]); /* editSave */
712 $feed_ids = db_escape_string ( $_POST [ "ids" ]); /* batchEditSave */
713 $cat_id = ( int ) db_escape_string ( $_POST [ "cat_id" ]);
714 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
715 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
716 $private = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "private" ]));
717 $rtl_content = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "rtl_content" ]));
718 $include_in_digest = checkbox_to_sql_bool (
719 db_escape_string ( $_POST [ "include_in_digest" ]));
720 $cache_images = checkbox_to_sql_bool (
721 db_escape_string ( $_POST [ "cache_images" ]));
722 $update_method = ( int ) db_escape_string ( $_POST [ "update_method" ]);
724 $always_display_enclosures = checkbox_to_sql_bool (
725 db_escape_string ( $_POST [ "always_display_enclosures" ]));
727 $mark_unread_on_update = checkbox_to_sql_bool (
728 db_escape_string ( $_POST [ "mark_unread_on_update" ]));
730 $update_on_checksum_change = checkbox_to_sql_bool (
731 db_escape_string ( $_POST [ "update_on_checksum_change" ]));
733 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
734 if ( $cat_id && $cat_id != 0 ) {
735 $category_qpart = "cat_id = ' $cat_id '," ;
736 $category_qpart_nocomma = "cat_id = ' $cat_id '" ;
738 $category_qpart = 'cat_id = NULL,' ;
739 $category_qpart_nocomma = 'cat_id = NULL' ;
742 $category_qpart = "" ;
743 $category_qpart_nocomma = "" ;
746 $cache_images_qpart = "cache_images = $cache_images ," ;
750 $result = db_query ( $this -> link
, "UPDATE ttrss_feeds SET
752 title = ' $feed_title ', feed_url = ' $feed_link ',
753 update_interval = ' $upd_intl ',
754 purge_interval = ' $purge_intl ',
755 auth_login = ' $auth_login ',
756 auth_pass = ' $auth_pass ',
758 rtl_content = $rtl_content ,
760 include_in_digest = $include_in_digest ,
761 always_display_enclosures = $always_display_enclosures ,
762 mark_unread_on_update = $mark_unread_on_update ,
763 update_on_checksum_change = $update_on_checksum_change ,
764 update_method = ' $update_method '
765 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
768 $feed_data = array ();
770 foreach ( array_keys ( $_POST ) as $k ) {
771 if ( $k != "op" && $k != "method" && $k != "ids" ) {
772 $feed_data [ $k ] = $_POST [ $k ];
776 db_query ( $this -> link
, "BEGIN" );
778 foreach ( array_keys ( $feed_data ) as $k ) {
784 $qpart = "title = ' $feed_title '" ;
788 $qpart = "feed_url = ' $feed_link '" ;
791 case "update_interval" :
792 $qpart = "update_interval = ' $upd_intl '" ;
795 case "purge_interval" :
796 $qpart = "purge_interval = ' $purge_intl '" ;
800 $qpart = "auth_login = ' $auth_login '" ;
804 $qpart = "auth_pass = ' $auth_pass '" ;
808 $qpart = "private = ' $private '" ;
811 case "include_in_digest" :
812 $qpart = "include_in_digest = ' $include_in_digest '" ;
815 case "always_display_enclosures" :
816 $qpart = "always_display_enclosures = ' $always_display_enclosures '" ;
819 case "mark_unread_on_update" :
820 $qpart = "mark_unread_on_update = ' $mark_unread_on_update '" ;
823 case "update_on_checksum_change" :
824 $qpart = "update_on_checksum_change = ' $update_on_checksum_change '" ;
828 $qpart = "cache_images = ' $cache_images '" ;
832 $qpart = "rtl_content = ' $rtl_content '" ;
835 case "update_method" :
836 $qpart = "update_method = ' $update_method '" ;
840 $qpart = $category_qpart_nocomma ;
846 db_query ( $this -> link
,
847 "UPDATE ttrss_feeds SET $qpart WHERE id IN ( $feed_ids )
848 AND owner_uid = " . $_SESSION [ "uid" ]);
853 db_query ( $this -> link
, "COMMIT" );
858 function resetPubSub () {
860 $ids = db_escape_string ( $_REQUEST [ "ids" ]);
862 db_query ( $this -> link
, "UPDATE ttrss_feeds SET pubsub_state = 0 WHERE id IN ( $ids )
863 AND owner_uid = " . $_SESSION [ "uid" ]);
870 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
872 foreach ( $ids as $id ) {
873 remove_feed ( $this -> link
, $id , $_SESSION [ "uid" ]);
880 $id = db_escape_string ( $_REQUEST [ "id" ]);
881 clear_feed_articles ( $this -> link
, $id );
885 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
887 foreach ( $ids as $id ) {
889 $filters = load_filters ( $this -> link
, $id , $_SESSION [ "uid" ], 6 );
891 $result = db_query ( $this -> link
, "SELECT
892 title, content, link, ref_id, author," .
893 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
895 ttrss_user_entries, ttrss_entries
896 WHERE ref_id = id AND feed_id = ' $id ' AND
897 owner_uid = " . $_SESSION [ 'uid' ]. "
902 while ( $line = db_fetch_assoc ( $result )) {
904 $tags = get_article_tags ( $this -> link
, $line [ "ref_id" ]);
906 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
907 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
908 $line [ 'author' ], $tags );
910 $new_score = calculate_article_score ( $article_filters );
912 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
914 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
917 foreach ( array_keys ( $scores ) as $s ) {
919 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
921 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
922 } else if ( $s < - 500 ) {
923 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
925 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
927 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
928 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
933 print __ ( "All done." );
937 function rescoreAll () {
939 $result = db_query ( $this -> link
,
940 "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION [ 'uid' ]);
942 while ( $feed_line = db_fetch_assoc ( $result )) {
944 $id = $feed_line [ "id" ];
946 $filters = load_filters ( $this -> link
, $id , $_SESSION [ "uid" ], 6 );
948 $tmp_result = db_query ( $this -> link
, "SELECT
949 title, content, link, ref_id, author," .
950 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
952 ttrss_user_entries, ttrss_entries
953 WHERE ref_id = id AND feed_id = ' $id ' AND
954 owner_uid = " . $_SESSION [ 'uid' ]. "
959 while ( $line = db_fetch_assoc ( $tmp_result )) {
961 $tags = get_article_tags ( $this -> link
, $line [ "ref_id" ]);
963 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
964 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
965 $line [ 'author' ], $tags );
967 $new_score = calculate_article_score ( $article_filters );
969 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
971 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
974 foreach ( array_keys ( $scores ) as $s ) {
976 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
978 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
980 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
981 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
986 print __ ( "All done." );
991 $feed_url = db_escape_string ( trim ( $_REQUEST [ "feed_url" ]));
992 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
993 $p_from = db_escape_string ( $_REQUEST [ "from" ]);
995 /* only read authentication information from POST */
997 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
998 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
1000 if ( $p_from != 'tt-rss' ) {
1001 header ( 'Content-Type: text/html; charset=utf-8' );
1004 <title>Tiny Tiny RSS</title>
1005 <link rel= \" stylesheet \" type= \" text/css \" href= \" utility.css \" >
1006 <meta http-equiv= \" Content-Type \" content= \" text/html; charset=utf-8 \" />
1009 <img class= \" floatingLogo \" src= \" images/ttrss_logo.png \"
1010 alt= \" Tiny Tiny RSS \" />
1011 <h1>Subscribe to feed...</h1>" ;
1014 $rc = subscribe_to_feed ( $this -> link
, $feed_url , $cat_id , $auth_login , $auth_pass );
1018 print_notice ( T_sprintf ( "Subscribed to <b> %s </b>." , $feed_url ));
1021 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>." , $feed_url ));
1024 print_error ( T_sprintf ( "No feeds found in <b> %s </b>." , $feed_url ));
1027 print_warning ( T_sprintf ( "Already subscribed to <b> %s </b>." , $feed_url ));
1030 print_notice ( __ ( "Multiple feed URLs found." ));
1032 $feed_urls = get_feeds_from_html ( $feed_url );
1035 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>.<br>Can't download the Feed URL." , $feed_url ));
1039 if ( $p_from != 'tt-rss' ) {
1043 print "<form action= \" backend.php \" >" ;
1044 print "<input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >" ;
1045 print "<input type= \" hidden \" name= \" quiet \" value= \" 1 \" >" ;
1046 print "<input type= \" hidden \" name= \" method \" value= \" add \" >" ;
1048 print "<select name= \" feed_url \" >" ;
1050 foreach ( $feed_urls as $url => $name ) {
1051 $url = htmlspecialchars ( $url );
1052 $name = htmlspecialchars ( $name );
1054 print "<option value= \" $url\" > $name </option>" ;
1057 print "<input type= \" submit \" value= \" " . __ ( "Subscribe to selected feed" ).
1063 $tp_uri = get_self_url_prefix () . "/prefs.php" ;
1064 $tt_uri = get_self_url_prefix ();
1067 $result = db_query ( $this -> link
, "SELECT id FROM ttrss_feeds WHERE
1068 feed_url = ' $feed_url ' AND owner_uid = " . $_SESSION [ "uid" ]);
1070 $feed_id = db_fetch_result ( $result , 0 , "id" );
1077 print "<form method= \" GET \" style='display: inline'
1079 <input type= \" hidden \" name= \" tab \" value= \" feedConfig \" >
1080 <input type= \" hidden \" name= \" method \" value= \" editFeed \" >
1081 <input type= \" hidden \" name= \" methodparam \" value= \" $feed_id\" >
1082 <input type= \" submit \" value= \" " . __ ( "Edit subscription options" ). " \" >
1086 print "<form style='display: inline' method= \" GET \" action= \" $tt_uri\" >
1087 <input type= \" submit \" value= \" " . __ ( "Return to Tiny Tiny RSS" ). " \" >
1090 print "</body></html>" ;
1095 function categorize () {
1096 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
1098 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
1101 $cat_id_qpart = 'NULL' ;
1103 $cat_id_qpart = "' $cat_id '" ;
1106 db_query ( $this -> link
, "BEGIN" );
1108 foreach ( $ids as $id ) {
1110 db_query ( $this -> link
, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
1112 AND owner_uid = " . $_SESSION [ "uid" ]);
1116 db_query ( $this -> link
, "COMMIT" );
1119 function editCats () {
1121 $action = $_REQUEST [ "action" ];
1123 if ( $action == "save" ) {
1125 $cat_title = db_escape_string ( trim ( $_REQUEST [ "value" ]));
1126 $cat_id = db_escape_string ( $_REQUEST [ "cid" ]);
1128 db_query ( $this -> link
, "BEGIN" );
1130 $result = db_query ( $this -> link
, "SELECT title FROM ttrss_feed_categories
1131 WHERE id = ' $cat_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
1133 if ( db_num_rows ( $result ) == 1 ) {
1135 $old_title = db_fetch_result ( $result , 0 , "title" );
1137 if ( $cat_title != "" ) {
1138 $result = db_query ( $this -> link
, "UPDATE ttrss_feed_categories SET
1139 title = ' $cat_title ' WHERE id = ' $cat_id ' AND
1140 owner_uid = " . $_SESSION [ "uid" ]);
1147 print $_REQUEST [ "value" ];
1150 db_query ( $this -> link
, "COMMIT" );
1156 if ( $action == "add" ) {
1158 $feed_cat = db_escape_string ( trim ( $_REQUEST [ "cat" ]));
1160 if (! add_feed_category ( $this -> link
, $feed_cat ))
1161 print_warning ( T_sprintf ( "Category <b>$ %s </b> already exists in the database." , $feed_cat ));
1165 if ( $action == "remove" ) {
1167 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
1169 foreach ( $ids as $id ) {
1170 remove_feed_category ( $this -> link
, $id , $_SESSION [ "uid" ]);
1174 print "<div dojoType= \" dijit.Toolbar \" >
1175 <input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \" name= \" newcat \" >
1176 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').addCategory() \" >" .
1177 __ ( 'Create category' ). "</button></div>" ;
1179 $result = db_query ( $this -> link
, "SELECT title,id FROM ttrss_feed_categories
1180 WHERE owner_uid = " . $_SESSION [ "uid" ]. "
1183 if ( db_num_rows ( $result ) != 0 ) {
1185 print "<div class= \" prefFeedCatHolder \" >" ;
1187 print "<table width= \" 100% \" class= \" prefFeedCatList \"
1188 cellspacing= \" 0 \" id= \" prefFeedCatList \" >" ;
1192 while ( $line = db_fetch_assoc ( $result )) {
1194 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
1196 $cat_id = $line [ "id" ];
1197 $this_row_id = "id= \" FCATR- $cat_id\" " ;
1199 print "<tr class= \"\" $this_row_id >" ;
1201 $edit_title = htmlspecialchars ( $line [ "title" ]);
1203 print "<td width='5%' align='center'><input
1204 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
1205 type= \" checkbox \" ></td>" ;
1209 print "<span dojoType= \" dijit.InlineEditBox \"
1210 width= \" 300px \" autoSave= \" false \"
1211 cat-id= \" $cat_id\" >" . $edit_title .
1212 "<script type= \" dojo/method \" event= \" onChange \" args= \" item \" >
1216 content: {op: 'pref-feeds', method: 'editCats',
1219 cid: this.srcNodeRef.getAttribute('cat-id')},
1220 load: function(response) {
1221 elem.attr('value', response);
1237 print "<p>" . __ ( 'No feed categories defined.' ). "</p>" ;
1240 print "<div class='dlgButtons'>
1241 <div style='float : left'>
1242 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').removeSelected() \" >" .
1243 __ ( 'Remove selected categories' ). "</button>
1246 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').hide() \" >" .
1247 __ ( 'Close this window' ). "</button></div>" ;
1255 print "<div dojoType= \" dijit.layout.AccordionContainer \" region= \" center \" >" ;
1256 print "<div id= \" pref-feeds-feeds \" dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Feeds' ). " \" >" ;
1258 $result = db_query ( $this -> link
, "SELECT COUNT(id) AS num_errors
1259 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
1261 $num_errors = db_fetch_result ( $result , 0 , "num_errors" );
1263 if ( $num_errors > 0 ) {
1265 $error_button = "<button dojoType= \" dijit.form.Button \"
1266 onclick= \" showFeedsWithErrors() \" id= \" errorButton \" >" .
1267 __ ( "Feeds with errors" ) . "</button>" ;
1270 if ( DB_TYPE
== "pgsql" ) {
1271 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
1273 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
1276 $result = db_query ( $this -> link
, "SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE
1277 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
1278 ttrss_entries.id = ref_id AND
1279 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart AND
1280 ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]);
1282 $num_inactive = db_fetch_result ( $result , 0 , "num_inactive" );
1284 if ( $num_inactive > 0 ) {
1285 $inactive_button = "<button dojoType= \" dijit.form.Button \"
1286 onclick= \" showInactiveFeeds() \" >" .
1287 __ ( "Inactive feeds" ) . "</button>" ;
1290 $feed_search = db_escape_string ( $_REQUEST [ "search" ]);
1292 if ( array_key_exists ( "search" , $_REQUEST )) {
1293 $_SESSION [ "prefs_feed_search" ] = $feed_search ;
1295 $feed_search = $_SESSION [ "prefs_feed_search" ];
1298 print '<div dojoType="dijit.layout.BorderContainer" gutters="false">' ;
1300 print "<div region='top' dojoType= \" dijit.Toolbar \" >" ; #toolbar
1302 print "<div style='float : right; padding-right : 4px;'>
1303 <input dojoType= \" dijit.form.TextBox \" id= \" feed_search \" size= \" 20 \" type= \" search \"
1304 value= \" $feed_search\" >
1305 <button dojoType= \" dijit.form.Button \" onclick= \" updateFeedList() \" >" .
1306 __ ( 'Search' ). "</button>
1309 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1310 "<span>" . __ ( 'Select' ). "</span>" ;
1311 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1312 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(true) \"
1313 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
1314 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(false) \"
1315 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
1316 print "</div></div>" ;
1318 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1319 "<span>" . __ ( 'Feeds' ). "</span>" ;
1320 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1321 print "<div onclick= \" quickAddFeed() \"
1322 dojoType= \" dijit.MenuItem \" >" . __ ( 'Subscribe to feed' ). "</div>" ;
1323 print "<div onclick= \" editSelectedFeed() \"
1324 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit selected feeds' ). "</div>" ;
1325 print "<div onclick= \" resetFeedOrder() \"
1326 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1327 print "<div onclick= \" batchSubscribe() \"
1328 dojoType= \" dijit.MenuItem \" >" . __ ( 'Batch subscribe' ). "</div>" ;
1329 print "</div></div>" ;
1331 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
1332 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1333 "<span>" . __ ( 'Categories' ). "</span>" ;
1334 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1335 print "<div onclick= \" editFeedCats() \"
1336 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit categories' ). "</div>" ;
1337 print "<div onclick= \" toggleHiddenFeedCats() \"
1338 dojoType= \" dijit.MenuItem \" >" . __ ( '(Un)hide empty categories' ). "</div>" ;
1339 print "<div onclick= \" resetCatOrder() \"
1340 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1341 print "</div></div>" ;
1345 print $error_button ;
1346 print $inactive_button ;
1348 print "<button dojoType= \" dijit.form.Button \" onclick= \" removeSelectedFeeds() \" >"
1349 . __ ( 'Unsubscribe' ). "</button dojoType= \" dijit.form.Button \" > " ;
1351 if ( defined ( '_ENABLE_FEED_DEBUGGING' )) {
1353 print "<select id= \" feedActionChooser \" onchange= \" feedActionChange() \" >
1354 <option value= \" facDefault \" selected>" . __ ( 'More actions...' ). "</option>" ;
1356 if ( FORCE_ARTICLE_PURGE
== 0 ) {
1358 "<option value= \" facPurge \" >" . __ ( 'Manual purge' ). "</option>" ;
1362 <option value= \" facClear \" >" . __ ( 'Clear feed data' ). "</option>
1363 <option value= \" facRescore \" >" . __ ( 'Rescore articles' ). "</option>" ;
1369 print "</div>" ; # toolbar
1372 print '<div dojoType="dijit.layout.ContentPane" region="center">' ;
1374 print "<div id= \" feedlistLoading \" >
1375 <img src='images/indicator_tiny.gif'>" .
1376 __ ( "Loading, please wait..." ). "</div>" ;
1378 print "<div dojoType= \" fox.PrefFeedStore \" jsId= \" feedStore \"
1379 url= \" backend.php?op=pref-feeds&method=getfeedtree \" >
1381 <div dojoType= \" lib.CheckBoxStoreModel \" jsId= \" feedModel \" store= \" feedStore \"
1382 query= \" {id:'root'} \" rootId= \" root \" rootLabel= \" Feeds \"
1383 childrenAttrs= \" items \" checkboxStrict= \" false \" checkboxAll= \" false \" >
1385 <div dojoType= \" fox.PrefFeedTree \" id= \" feedTree \"
1386 dndController= \" dijit.tree.dndSource \"
1387 betweenThreshold= \" 5 \"
1388 model= \" feedModel \" openOnClick= \" false \" >
1389 <script type= \" dojo/method \" event= \" onClick \" args= \" item \" >
1390 var id = String(item.id);
1391 var bare_id = id.substr(id.indexOf(':')+1);
1393 if (id.match('FEED:')) {
1395 } else if (id.match('CAT:')) {
1396 editCat(bare_id, item);
1399 <script type= \" dojo/method \" event= \" onLoad \" args= \" item \" >
1400 Element.hide( \" feedlistLoading \" );
1404 print "<div dojoType= \" dijit.Tooltip \" connectId= \" feedTree \" position= \" below \" >
1405 " . __ ( '<b>Hint:</b> you can drag feeds and categories around.' ). "
1411 print "</div>" ; # feeds pane
1413 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Import and export' ). " \" >" ;
1415 print "<h3>" . __ ( "OPML" ) . "</h3>" ;
1417 print "<p>" . __ ( "Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings." ) . " " ;
1419 print __ ( "Only main settings profile can be migrated using OPML." ) . "</p>" ;
1421 print "<iframe id= \" upload_iframe \"
1422 name= \" upload_iframe \" onload= \" opmlImportComplete(this) \"
1423 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
1425 print "<form name= \" opml_form \" style='display : block' target= \" upload_iframe \"
1426 enctype= \" multipart/form-data \" method= \" POST \"
1427 action= \" backend.php \" >
1428 <input id= \" opml_file \" name= \" opml_file \" type= \" file \" >
1429 <input type= \" hidden \" name= \" op \" value= \" dlg \" >
1430 <input type= \" hidden \" name= \" method \" value= \" importOpml \" >
1431 <button dojoType= \" dijit.form.Button \" onclick= \" return opmlImport(); \" type= \" submit \" >" .
1432 __ ( 'Import my OPML' ) . "</button>" ;
1436 print "<p>" . __ ( 'Filename:' ) .
1437 " <input type= \" text \" id= \" filename \" value= \" TinyTinyRSS.opml \" /> " .
1438 __ ( 'Include settings' ) . "<input type= \" checkbox \" id= \" settings \" checked= \" 1 \" />" ;
1440 print "</p><button dojoType= \" dijit.form.Button \"
1441 onclick= \" gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked) \" >" .
1442 __ ( 'Export OPML' ) . "</button></p></form>" ;
1446 print "<p>" . __ ( 'Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.' ) . " " ;
1448 print __ ( "Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds." ) . "</p>" ;
1450 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('pubOPMLUrl') \" >" .
1451 __ ( 'Display published OPML URL' ). "</button> " ;
1454 print "<h3>" . __ ( "Article archive" ) . "</h3>" ;
1456 print "<p>" . __ ( "You can export and import your Starred and Archived articles for safekeeping or when migrating between tt-rss instances." ) . "</p>" ;
1458 print "<button dojoType= \" dijit.form.Button \" onclick= \" return exportData() \" >" .
1459 __ ( 'Export my data' ). "</button> " ;
1463 print "<iframe id= \" data_upload_iframe \"
1464 name= \" data_upload_iframe \" onload= \" dataImportComplete(this) \"
1465 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
1467 print "<form name= \" import_form \" style='display : block' target= \" data_upload_iframe \"
1468 enctype= \" multipart/form-data \" method= \" POST \"
1469 action= \" backend.php \" >
1470 <input id= \" export_file \" name= \" export_file \" type= \" file \" >
1471 <input type= \" hidden \" name= \" op \" value= \" dlg \" >
1472 <input type= \" hidden \" name= \" method \" value= \" dataimport \" >
1473 <button dojoType= \" dijit.form.Button \" onclick= \" return importData(); \" type= \" submit \" >" .
1474 __ ( 'Import' ) . "</button>" ;
1477 print "</div>" ; # pane
1479 if ( strpos ( $_SERVER [ 'HTTP_USER_AGENT' ], "Firefox" ) !== false ) {
1481 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Firefox integration' ). " \" >" ;
1483 print "<p>" . __ ( 'This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.' ) . "</p>" ;
1487 print "<button onclick='window.navigator.registerContentHandler(" .
1488 " \" application/vnd.mozilla.maybe.feed \" , " .
1489 " \" " . add_feed_url () . " \" , " . " \" Tiny Tiny RSS \" )'>" .
1490 __ ( 'Click here to register this site as a feed reader.' ) .
1495 print "</div>" ; # pane
1498 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Subscribing using bookmarklet' ). " \" >" ;
1500 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>" ;
1502 $bm_subscribe_url = str_replace ( ' %s ' , '' , add_feed_url ());
1504 $confirm_str = __ ( 'Subscribe to %s in Tiny Tiny RSS?' );
1506 $bm_url = htmlspecialchars ( "javascript:{if(confirm(' $confirm_str '.replace(' %s ',window.location.href)))window.location.href=' $bm_subscribe_url '+window.location.href}" );
1508 print "<a href= \" $bm_url\" class='bookmarklet'>" . __ ( 'Subscribe in Tiny Tiny RSS' ). "</a>" ;
1510 print "</div>" ; #pane
1512 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Published & shared articles / Generated feeds' ). " \" >" ;
1514 print "<h3>" . __ ( "Published articles and generated feeds" ) . "</h3>" ;
1516 print "<p>" . __ ( 'Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.' ). "</p>" ;
1518 $rss_url = '-2::' . htmlspecialchars ( get_self_url_prefix () .
1519 "/public.php?op=rss&id=-2&view-mode=all_articles" );;
1521 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('generatedFeed', ' $rss_url ') \" >" .
1522 __ ( 'Display URL' ). "</button> " ;
1524 print "<button dojoType= \" dijit.form.Button \" onclick= \" return clearFeedAccessKeys() \" >" .
1525 __ ( 'Clear all generated URLs' ). "</button> " ;
1527 print "<h3>" . __ ( "Articles shared by URL" ) . "</h3>" ;
1529 print "<p>" . __ ( "You can disable all articles shared by unique URLs here." ) . "</p>" ;
1531 print "<button dojoType= \" dijit.form.Button \" onclick= \" return clearArticleAccessKeys() \" >" .
1532 __ ( 'Unshare all articles' ). "</button> " ;
1534 print "</div>" ; #pane
1536 if ( defined ( 'CONSUMER_KEY' ) && CONSUMER_KEY
!= '' ) {
1538 print "<div id= \" pref-feeds-twitter \" dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Twitter' ). " \" >" ;
1540 $result = db_query ( $this -> link
, "SELECT COUNT(*) AS cid FROM ttrss_users
1541 WHERE twitter_oauth IS NOT NULL AND twitter_oauth != '' AND
1542 id = " . $_SESSION [ 'uid' ]);
1544 $is_registered = db_fetch_result ( $result , 0 , "cid" ) != 0 ;
1546 if (! $is_registered ) {
1547 print_notice ( __ ( 'Before you can update your Twitter feeds, you must register this instance of Tiny Tiny RSS with Twitter.com.' ));
1549 print_notice ( __ ( 'You have been successfully registered with Twitter.com and should be able to access your Twitter feeds.' ));
1552 print "<button dojoType= \" dijit.form.Button \" onclick= \" window.location.href = 'twitter.php?op=register' \" >" .
1553 __ ( "Register with Twitter.com" ). "</button>" ;
1557 print "<button dojoType= \" dijit.form.Button \"
1558 onclick= \" return clearTwitterCredentials() \" >" .
1559 __ ( "Clear stored credentials" ). "</button>" ;
1561 print "</div>" ; # pane
1565 print "</div>" ; #container