]>
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" );
7 return array_search ( $method , $csrf_ignored ) !== false ;
10 function batch_edit_cbox ( $elem , $label = false ) {
11 print "<input type= \" checkbox \" title= \" " . __ ( "Check to enable field" ). " \"
12 onchange= \" dijit.byId('feedEditDlg').toggleField(this, ' $elem ', ' $label ') \" >" ;
15 function renamecat () {
16 $title = db_escape_string ( $_REQUEST [ 'title' ]);
17 $id = db_escape_string ( $_REQUEST [ 'id' ]);
20 db_query ( $this -> link
, "UPDATE ttrss_feed_categories SET
21 title = ' $title ' WHERE id = ' $id ' AND owner_uid = " . $_SESSION [ "uid" ]);
26 function remtwitterinfo () {
28 db_query ( $this -> link
, "UPDATE ttrss_users SET twitter_oauth = NULL
29 WHERE id = " . $_SESSION [ 'uid' ]);
34 function getfeedtree () {
36 $search = $_SESSION [ "prefs_feed_search" ];
38 if ( $search ) $search_qpart = " AND LOWER(title) LIKE LOWER('% $search %')" ;
42 $root [ 'name' ] = __ ( 'Feeds' );
43 $root [ 'items' ] = array ();
44 $root [ 'type' ] = 'category' ;
46 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
48 $result = db_query ( $this -> link
, "SELECT id, title FROM ttrss_feed_categories
49 WHERE owner_uid = " . $_SESSION [ "uid" ] . " ORDER BY order_id, title" );
51 while ( $line = db_fetch_assoc ( $result )) {
53 $cat [ 'id' ] = 'CAT:' . $line [ 'id' ];
54 $cat [ 'bare_id' ] = $feed_id ;
55 $cat [ 'name' ] = $line [ 'title' ];
56 $cat [ 'items' ] = array ();
57 $cat [ 'checkbox' ] = false ;
58 $cat [ 'type' ] = 'category' ;
60 $feed_result = db_query ( $this -> link
, "SELECT id, title, last_error,
61 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
63 WHERE cat_id = '" . $line [ 'id' ]. "' AND owner_uid = " . $_SESSION [ "uid" ].
64 " $search_qpart ORDER BY order_id, title" );
66 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
68 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
69 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
70 $feed [ 'name' ] = $feed_line [ 'title' ];
71 $feed [ 'checkbox' ] = false ;
72 $feed [ 'error' ] = $feed_line [ 'last_error' ];
73 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
74 $feed [ 'param' ] = make_local_datetime ( $this -> link
,
75 $feed_line [ 'last_updated' ], true );
77 array_push ( $cat [ 'items' ], $feed );
80 $cat [ 'param' ] = T_sprintf ( '( %d feeds)' , count ( $cat [ 'items' ]));
82 if ( count ( $cat [ 'items' ]) > 0 )
83 array_push ( $root [ 'items' ], $cat );
85 $root [ 'param' ] +
= count ( $cat [ 'items' ]);
88 /* Uncategorized is a special case */
93 $cat [ 'name' ] = __ ( "Uncategorized" );
94 $cat [ 'items' ] = array ();
95 $cat [ 'type' ] = 'category' ;
96 $cat [ 'checkbox' ] = false ;
98 $feed_result = db_query ( $this -> link
, "SELECT id, title,last_error,
99 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
101 WHERE cat_id IS NULL AND owner_uid = " . $_SESSION [ "uid" ].
102 " $search_qpart ORDER BY order_id, title" );
104 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
106 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
107 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
108 $feed [ 'name' ] = $feed_line [ 'title' ];
109 $feed [ 'checkbox' ] = false ;
110 $feed [ 'error' ] = $feed_line [ 'last_error' ];
111 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
112 $feed [ 'param' ] = make_local_datetime ( $this -> link
,
113 $feed_line [ 'last_updated' ], true );
115 array_push ( $cat [ 'items' ], $feed );
118 $cat [ 'param' ] = T_sprintf ( '( %d feeds)' , count ( $cat [ 'items' ]));
120 if ( count ( $cat [ 'items' ]) > 0 )
121 array_push ( $root [ 'items' ], $cat );
123 $root [ 'param' ] +
= count ( $cat [ 'items' ]);
124 $root [ 'param' ] = T_sprintf ( '( %d feeds)' , $root [ 'param' ]);
127 $feed_result = db_query ( $this -> link
, "SELECT id, title, last_error,
128 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
130 WHERE owner_uid = " . $_SESSION [ "uid" ].
131 " $search_qpart ORDER BY order_id, title" );
133 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
135 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
136 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
137 $feed [ 'name' ] = $feed_line [ 'title' ];
138 $feed [ 'checkbox' ] = false ;
139 $feed [ 'error' ] = $feed_line [ 'last_error' ];
140 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
141 $feed [ 'param' ] = make_local_datetime ( $this -> link
,
142 $feed_line [ 'last_updated' ], true );
144 array_push ( $root [ 'items' ], $feed );
147 $root [ 'param' ] = T_sprintf ( '( %d feeds)' , count ( $root [ 'items' ]));
152 $fl [ 'identifier' ] = 'id' ;
153 $fl [ 'label' ] = 'name' ;
154 $fl [ 'items' ] = array ( $root );
156 print json_encode ( $fl );
160 function catsortreset () {
161 db_query ( $this -> link
, "UPDATE ttrss_feed_categories
162 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
166 function feedsortreset () {
167 db_query ( $this -> link
, "UPDATE ttrss_feeds
168 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
172 function savefeedorder () {
173 $data = json_decode ( $_POST [ 'payload' ], true );
175 if ( is_array ( $data ) && is_array ( $data [ 'items' ])) {
180 foreach ( $data [ 'items' ] as $item ) {
182 if ( $item [ 'id' ] != 'root' ) {
183 if ( is_array ( $item [ 'items' ])) {
184 if ( isset ( $item [ 'items' ][ '_reference' ])) {
185 $data_map [ $item [ 'id' ]] = array ( $item [ 'items' ]);
187 $data_map [ $item [ 'id' ]] =& $item [ 'items' ];
193 foreach ( $data [ 'items' ][ 0 ][ 'items' ] as $item ) {
194 $id = $item [ '_reference' ];
195 $bare_id = substr ( $id , strpos ( $id , ':' ) +
1 );
200 db_query ( $this -> link
, "UPDATE ttrss_feed_categories
201 SET order_id = ' $cat_order_id ' WHERE id = ' $bare_id ' AND
202 owner_uid = " . $_SESSION [ "uid" ]);
207 if ( is_array ( $data_map [ $id ])) {
208 foreach ( $data_map [ $id ] as $feed ) {
209 $id = $feed [ '_reference' ];
210 $feed_id = substr ( $id , strpos ( $id , ':' ) +
1 );
213 $cat_query = "cat_id = ' $bare_id '" ;
215 $cat_query = "cat_id = NULL" ;
217 db_query ( $this -> link
, "UPDATE ttrss_feeds
218 SET order_id = ' $feed_order_id ',
220 WHERE id = ' $feed_id ' AND
221 owner_uid = " . $_SESSION [ "uid" ]);
232 function removeicon () {
233 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
235 $result = db_query ( $this -> link
, "SELECT id FROM ttrss_feeds
236 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
238 if ( db_num_rows ( $result ) != 0 ) {
239 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
245 function uploadicon () {
246 $icon_file = $_FILES [ 'icon_file' ][ 'tmp_name' ];
247 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
249 if ( is_file ( $icon_file ) && $feed_id ) {
250 if ( filesize ( $icon_file ) < 20000 ) {
252 $result = db_query ( $this -> link
, "SELECT id FROM ttrss_feeds
253 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
255 if ( db_num_rows ( $result ) != 0 ) {
256 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
257 move_uploaded_file ( $icon_file , ICONS_DIR
. "/ $feed_id .ico" );
269 print "<script type= \" text/javascript \" >" ;
270 print "parent.uploadIconHandler( $rc );" ;
275 function editfeed () {
276 global $purge_intervals ;
277 global $update_intervals ;
278 global $update_methods ;
280 $feed_id = db_escape_string ( $_REQUEST [ "id" ]);
282 $result = db_query ( $this -> link
,
283 "SELECT * FROM ttrss_feeds WHERE id = ' $feed_id ' AND
284 owner_uid = " . $_SESSION [ "uid" ]);
286 $title = htmlspecialchars ( db_fetch_result ( $result ,
289 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $feed_id\" >" ;
290 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-feeds \" >" ;
291 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" editSave \" >" ;
293 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
294 print "<div class= \" dlgSecCont \" >" ;
298 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
299 placeHolder= \" " . __ ( "Feed Title" ). " \"
300 style= \" font-size : 16px; width: 20em \" name= \" title \" value= \" $title\" >" ;
304 $feed_url = db_fetch_result ( $result , 0 , "feed_url" );
305 $feed_url = htmlspecialchars ( db_fetch_result ( $result ,
310 print __ ( 'URL:' ) . " " ;
311 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
312 placeHolder= \" " . __ ( "Feed URL" ). " \"
313 regExp='^(http|https)://.*' style= \" width : 20em \"
314 name= \" feed_url \" value= \" $feed_url\" >" ;
316 $last_error = db_fetch_result ( $result , 0 , "last_error" );
319 print " <span title= \" " . htmlspecialchars ( $last_error ). " \"
320 class= \" feed_error \" >(error)</span>" ;
326 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
328 $cat_id = db_fetch_result ( $result , 0 , "cat_id" );
332 print __ ( 'Place in category:' ) . " " ;
334 print_feed_cat_select ( $this -> link
, "cat_id" , $cat_id ,
335 'dojoType="dijit.form.Select"' );
340 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
341 print "<div class= \" dlgSecCont \" >" ;
343 /* Update Interval */
345 $update_interval = db_fetch_result ( $result , 0 , "update_interval" );
347 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
348 'dojoType="dijit.form.Select"' );
352 $update_method = db_fetch_result ( $result , 0 , "update_method" ,
353 'dojoType="dijit.form.Select"' );
355 print " " . __ ( 'using' ) . " " ;
356 print_select_hash ( "update_method" , $update_method , $update_methods ,
357 'dojoType="dijit.form.Select"' );
359 $purge_interval = db_fetch_result ( $result , 0 , "purge_interval" );
365 print __ ( 'Article purging:' ) . " " ;
367 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
368 'dojoType="dijit.form.Select" ' .
369 (( FORCE_ARTICLE_PURGE
== 0 ) ?
"" : 'disabled="1"' ));
372 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
373 print "<div class= \" dlgSecCont \" >" ;
375 $auth_login = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_login" ));
377 print "<input dojoType= \" dijit.form.TextBox \" id= \" feedEditDlg_login \"
378 placeHolder= \" " . __ ( "Login" ). " \"
379 name= \" auth_login \" value= \" $auth_login\" ><hr/>" ;
381 $auth_pass = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_pass" ));
383 print "<input dojoType= \" dijit.form.TextBox \" type= \" password \" name= \" auth_pass \"
384 placeHolder= \" " . __ ( "Password" ). " \"
385 value= \" $auth_pass\" >" ;
387 print "<div dojoType= \" dijit.Tooltip \" connectId= \" feedEditDlg_login \" position= \" below \" >
388 " . __ ( '<b>Hint:</b> you need to fill in your login information if your feed requires authentication, except for Twitter feeds.' ). "
392 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
393 print "<div class= \" dlgSecCont \" >" ;
395 $private = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "private" ));
398 $checked = "checked= \" 1 \" " ;
403 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" private \" id= \" private \"
404 $checked > <label for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
406 $rtl_content = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "rtl_content" ));
409 $checked = "checked= \" 1 \" " ;
414 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
415 $checked > <label for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
417 $include_in_digest = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "include_in_digest" ));
419 if ( $include_in_digest ) {
420 $checked = "checked= \" 1 \" " ;
425 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" include_in_digest \"
426 name= \" include_in_digest \"
427 $checked > <label for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
430 $always_display_enclosures = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "always_display_enclosures" ));
432 if ( $always_display_enclosures ) {
433 $checked = "checked" ;
438 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" always_display_enclosures \"
439 name= \" always_display_enclosures \"
440 $checked > <label for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
443 $cache_images = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "cache_images" ));
446 $checked = "checked= \" 1 \" " ;
451 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" cache_images \"
452 name= \" cache_images \"
453 $checked > <label for= \" cache_images \" >" .
454 __ ( 'Cache images locally' ). "</label>" ;
456 $mark_unread_on_update = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "mark_unread_on_update" ));
458 if ( $mark_unread_on_update ) {
459 $checked = "checked" ;
464 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" mark_unread_on_update \"
465 name= \" mark_unread_on_update \"
466 $checked > <label for= \" mark_unread_on_update \" >" . __ ( 'Mark updated articles as unread' ). "</label>" ;
468 $update_on_checksum_change = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "update_on_checksum_change" ));
470 if ( $update_on_checksum_change ) {
471 $checked = "checked" ;
476 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" update_on_checksum_change \"
477 name= \" update_on_checksum_change \"
478 $checked > <label for= \" update_on_checksum_change \" >" . __ ( 'Mark posts as updated on content change' ). "</label>" ;
484 print "<div class= \" dlgSec \" >" . __ ( "Icon" ). "</div>" ;
485 print "<div class= \" dlgSecCont \" >" ;
487 print "<iframe name= \" icon_upload_iframe \"
488 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
490 print "<form style='display : block' target= \" icon_upload_iframe \"
491 enctype= \" multipart/form-data \" method= \" POST \"
492 action= \" backend.php \" >
493 <input id= \" icon_file \" size= \" 10 \" name= \" icon_file \" type= \" file \" >
494 <input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >
495 <input type= \" hidden \" name= \" feed_id \" value= \" $feed_id\" >
496 <input type= \" hidden \" name= \" method \" value= \" uploadicon \" >
497 <button dojoType= \" dijit.form.Button \" onclick= \" return uploadFeedIcon(); \"
498 type= \" submit \" >" . __ ( 'Replace' ). "</button>
499 <button dojoType= \" dijit.form.Button \" onclick= \" return removeFeedIcon( $feed_id ); \"
500 type= \" submit \" >" . __ ( 'Remove' ). "</button>
505 $title = htmlspecialchars ( $title , ENT_QUOTES
);
507 print "<div class='dlgButtons'>
508 <div style= \" float : left \" >
509 <button dojoType= \" dijit.form.Button \" onclick='return unsubscribeFeed( $feed_id , \" $title\" )'>" .
510 __ ( 'Unsubscribe' ). "</button>" ;
512 if ( PUBSUBHUBBUB_ENABLED
) {
513 $pubsub_state = db_fetch_result ( $result , 0 , "pubsub_state" );
514 $pubsub_btn_disabled = ( $pubsub_state == 2 ) ?
"" : "disabled= \" 1 \" " ;
516 print "<button dojoType= \" dijit.form.Button \" id= \" pubsubReset_Btn \" $pubsub_btn_disabled
517 onclick='return resetPubSub( $feed_id , \" $title\" )'>" . __ ( 'Resubscribe to push updates' ).
523 print "<div dojoType= \" dijit.Tooltip \" connectId= \" pubsubReset_Btn \" position= \" below \" >" .
524 __ ( 'Resets PubSubHubbub subscription status for push-enabled feeds.' ). "</div>" ;
526 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedEditDlg').execute() \" >" . __ ( 'Save' ). "</button>
527 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedEditDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
533 function editfeeds () {
534 global $purge_intervals ;
535 global $update_intervals ;
536 global $update_methods ;
538 $feed_ids = db_escape_string ( $_REQUEST [ "ids" ]);
540 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" ids \" value= \" $feed_ids\" >" ;
541 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-feeds \" >" ;
542 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" batchEditSave \" >" ;
544 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
545 print "<div class= \" dlgSecCont \" >" ;
549 print "<input dojoType= \" dijit.form.ValidationTextBox \"
550 disabled= \" 1 \" style= \" font-size : 16px; width : 20em; \" required= \" 1 \"
551 name= \" title \" value= \" $title\" >" ;
553 $this -> batch_edit_cbox ( "title" );
559 print __ ( 'URL:' ) . " " ;
560 print "<input dojoType= \" dijit.form.ValidationTextBox \" disabled= \" 1 \"
561 required= \" 1 \" regExp='^(http|https)://.*' style= \" width : 20em \"
562 name= \" feed_url \" value= \" $feed_url\" >" ;
564 $this -> batch_edit_cbox ( "feed_url" );
568 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
572 print __ ( 'Place in category:' ) . " " ;
574 print_feed_cat_select ( $this -> link
, "cat_id" , $cat_id ,
575 'disabled="1" dojoType="dijit.form.Select"' );
577 $this -> batch_edit_cbox ( "cat_id" );
583 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
584 print "<div class= \" dlgSecCont \" >" ;
586 /* Update Interval */
588 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
589 'disabled="1" dojoType="dijit.form.Select"' );
591 $this -> batch_edit_cbox ( "update_interval" );
595 print " " . __ ( 'using' ) . " " ;
596 print_select_hash ( "update_method" , $update_method , $update_methods ,
597 'disabled="1" dojoType="dijit.form.Select"' );
598 $this -> batch_edit_cbox ( "update_method" );
602 if ( FORCE_ARTICLE_PURGE
== 0 ) {
606 print __ ( 'Article purging:' ) . " " ;
608 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
609 'disabled="1" dojoType="dijit.form.Select"' );
611 $this -> batch_edit_cbox ( "purge_interval" );
615 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
616 print "<div class= \" dlgSecCont \" >" ;
618 print "<input dojoType= \" dijit.form.TextBox \"
619 placeHolder= \" " . __ ( "Login" ). " \" disabled= \" 1 \"
620 name= \" auth_login \" value= \" $auth_login\" >" ;
622 $this -> batch_edit_cbox ( "auth_login" );
624 print "<br/><input dojoType= \" dijit.form.TextBox \" type= \" password \" name= \" auth_pass \"
625 placeHolder= \" " . __ ( "Password" ). " \" disabled= \" 1 \"
626 value= \" $auth_pass\" >" ;
628 $this -> batch_edit_cbox ( "auth_pass" );
631 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
632 print "<div class= \" dlgSecCont \" >" ;
634 print "<input disabled= \" 1 \" type= \" checkbox \" name= \" private \" id= \" private \"
635 dojoType= \" dijit.form.CheckBox \" > <label id= \" private_l \" class='insensitive' for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
637 print " " ; $this -> batch_edit_cbox ( "private" , "private_l" );
639 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
640 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" rtl_content_l \" for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
642 print " " ; $this -> batch_edit_cbox ( "rtl_content" , "rtl_content_l" );
644 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" include_in_digest \"
645 name= \" include_in_digest \"
646 dojoType= \" dijit.form.CheckBox \" > <label id= \" include_in_digest_l \" class='insensitive' for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
648 print " " ; $this -> batch_edit_cbox ( "include_in_digest" , "include_in_digest_l" );
650 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" always_display_enclosures \"
651 name= \" always_display_enclosures \"
652 dojoType= \" dijit.form.CheckBox \" > <label id= \" always_display_enclosures_l \" class='insensitive' for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
654 print " " ; $this -> batch_edit_cbox ( "always_display_enclosures" , "always_display_enclosures_l" );
656 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" cache_images \"
657 name= \" cache_images \"
658 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" cache_images_l \"
659 for= \" cache_images \" >" .
660 __ ( 'Cache images locally' ). "</label>" ;
662 print " " ; $this -> batch_edit_cbox ( "cache_images" , "cache_images_l" );
664 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" mark_unread_on_update \"
665 name= \" mark_unread_on_update \"
666 dojoType= \" dijit.form.CheckBox \" > <label id= \" mark_unread_on_update_l \" class='insensitive' for= \" mark_unread_on_update \" >" . __ ( 'Mark updated articles as unread' ). "</label>" ;
668 print " " ; $this -> batch_edit_cbox ( "mark_unread_on_update" , "mark_unread_on_update_l" );
670 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" update_on_checksum_change \"
671 name= \" update_on_checksum_change \"
672 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>" ;
674 print " " ; $this -> batch_edit_cbox ( "update_on_checksum_change" , "update_on_checksum_change_l" );
678 print "<div class='dlgButtons'>
679 <button dojoType= \" dijit.form.Button \"
680 onclick= \" return dijit.byId('feedEditDlg').execute() \" >" .
681 __ ( 'Save' ). "</button>
682 <button dojoType= \" dijit.form.Button \"
683 onclick= \" return dijit.byId('feedEditDlg').hide() \" >" .
684 __ ( 'Cancel' ). "</button>
690 function batchEditSave () {
691 return $this -> editsaveops ( true );
694 function editSave () {
695 return $this -> editsaveops ( false );
698 function editsaveops ( $batch ) {
700 $feed_title = db_escape_string ( trim ( $_POST [ "title" ]));
701 $feed_link = db_escape_string ( trim ( $_POST [ "feed_url" ]));
702 $upd_intl = ( int ) db_escape_string ( $_POST [ "update_interval" ]);
703 $purge_intl = ( int ) db_escape_string ( $_POST [ "purge_interval" ]);
704 $feed_id = ( int ) db_escape_string ( $_POST [ "id" ]); /* editSave */
705 $feed_ids = db_escape_string ( $_POST [ "ids" ]); /* batchEditSave */
706 $cat_id = ( int ) db_escape_string ( $_POST [ "cat_id" ]);
707 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
708 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
709 $private = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "private" ]));
710 $rtl_content = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "rtl_content" ]));
711 $include_in_digest = checkbox_to_sql_bool (
712 db_escape_string ( $_POST [ "include_in_digest" ]));
713 $cache_images = checkbox_to_sql_bool (
714 db_escape_string ( $_POST [ "cache_images" ]));
715 $update_method = ( int ) db_escape_string ( $_POST [ "update_method" ]);
717 $always_display_enclosures = checkbox_to_sql_bool (
718 db_escape_string ( $_POST [ "always_display_enclosures" ]));
720 $mark_unread_on_update = checkbox_to_sql_bool (
721 db_escape_string ( $_POST [ "mark_unread_on_update" ]));
723 $update_on_checksum_change = checkbox_to_sql_bool (
724 db_escape_string ( $_POST [ "update_on_checksum_change" ]));
726 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
727 if ( $cat_id && $cat_id != 0 ) {
728 $category_qpart = "cat_id = ' $cat_id '," ;
729 $category_qpart_nocomma = "cat_id = ' $cat_id '" ;
731 $category_qpart = 'cat_id = NULL,' ;
732 $category_qpart_nocomma = 'cat_id = NULL' ;
735 $category_qpart = "" ;
736 $category_qpart_nocomma = "" ;
739 $cache_images_qpart = "cache_images = $cache_images ," ;
743 $result = db_query ( $this -> link
, "UPDATE ttrss_feeds SET
745 title = ' $feed_title ', feed_url = ' $feed_link ',
746 update_interval = ' $upd_intl ',
747 purge_interval = ' $purge_intl ',
748 auth_login = ' $auth_login ',
749 auth_pass = ' $auth_pass ',
751 rtl_content = $rtl_content ,
753 include_in_digest = $include_in_digest ,
754 always_display_enclosures = $always_display_enclosures ,
755 mark_unread_on_update = $mark_unread_on_update ,
756 update_on_checksum_change = $update_on_checksum_change ,
757 update_method = ' $update_method '
758 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
761 $feed_data = array ();
763 foreach ( array_keys ( $_POST ) as $k ) {
764 if ( $k != "op" && $k != "method" && $k != "ids" ) {
765 $feed_data [ $k ] = $_POST [ $k ];
769 db_query ( $this -> link
, "BEGIN" );
771 foreach ( array_keys ( $feed_data ) as $k ) {
777 $qpart = "title = ' $feed_title '" ;
781 $qpart = "feed_url = ' $feed_link '" ;
784 case "update_interval" :
785 $qpart = "update_interval = ' $upd_intl '" ;
788 case "purge_interval" :
789 $qpart = "purge_interval = ' $purge_intl '" ;
793 $qpart = "auth_login = ' $auth_login '" ;
797 $qpart = "auth_pass = ' $auth_pass '" ;
801 $qpart = "private = ' $private '" ;
804 case "include_in_digest" :
805 $qpart = "include_in_digest = ' $include_in_digest '" ;
808 case "always_display_enclosures" :
809 $qpart = "always_display_enclosures = ' $always_display_enclosures '" ;
812 case "mark_unread_on_update" :
813 $qpart = "mark_unread_on_update = ' $mark_unread_on_update '" ;
816 case "update_on_checksum_change" :
817 $qpart = "update_on_checksum_change = ' $update_on_checksum_change '" ;
821 $qpart = "cache_images = ' $cache_images '" ;
825 $qpart = "rtl_content = ' $rtl_content '" ;
828 case "update_method" :
829 $qpart = "update_method = ' $update_method '" ;
833 $qpart = $category_qpart_nocomma ;
839 db_query ( $this -> link
,
840 "UPDATE ttrss_feeds SET $qpart WHERE id IN ( $feed_ids )
841 AND owner_uid = " . $_SESSION [ "uid" ]);
846 db_query ( $this -> link
, "COMMIT" );
851 function resetPubSub () {
853 $ids = db_escape_string ( $_REQUEST [ "ids" ]);
855 db_query ( $this -> link
, "UPDATE ttrss_feeds SET pubsub_state = 0 WHERE id IN ( $ids )
856 AND owner_uid = " . $_SESSION [ "uid" ]);
863 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
865 foreach ( $ids as $id ) {
866 remove_feed ( $this -> link
, $id , $_SESSION [ "uid" ]);
873 $id = db_escape_string ( $_REQUEST [ "id" ]);
874 clear_feed_articles ( $this -> link
, $id );
878 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
880 foreach ( $ids as $id ) {
882 $filters = load_filters ( $this -> link
, $id , $_SESSION [ "uid" ], 6 );
884 $result = db_query ( $this -> link
, "SELECT
885 title, content, link, ref_id, author," .
886 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
888 ttrss_user_entries, ttrss_entries
889 WHERE ref_id = id AND feed_id = ' $id ' AND
890 owner_uid = " . $_SESSION [ 'uid' ]. "
895 while ( $line = db_fetch_assoc ( $result )) {
897 $tags = get_article_tags ( $this -> link
, $line [ "ref_id" ]);
899 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
900 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
901 $line [ 'author' ], $tags );
903 $new_score = calculate_article_score ( $article_filters );
905 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
907 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
910 foreach ( array_keys ( $scores ) as $s ) {
912 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
914 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
915 } else if ( $s < - 500 ) {
916 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
918 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
920 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
921 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
926 print __ ( "All done." );
930 function rescoreAll () {
932 $result = db_query ( $this -> link
,
933 "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION [ 'uid' ]);
935 while ( $feed_line = db_fetch_assoc ( $result )) {
937 $id = $feed_line [ "id" ];
939 $filters = load_filters ( $this -> link
, $id , $_SESSION [ "uid" ], 6 );
941 $tmp_result = db_query ( $this -> link
, "SELECT
942 title, content, link, ref_id, author," .
943 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
945 ttrss_user_entries, ttrss_entries
946 WHERE ref_id = id AND feed_id = ' $id ' AND
947 owner_uid = " . $_SESSION [ 'uid' ]. "
952 while ( $line = db_fetch_assoc ( $tmp_result )) {
954 $tags = get_article_tags ( $this -> link
, $line [ "ref_id" ]);
956 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
957 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
958 $line [ 'author' ], $tags );
960 $new_score = calculate_article_score ( $article_filters );
962 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
964 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
967 foreach ( array_keys ( $scores ) as $s ) {
969 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
971 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
973 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
974 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
979 print __ ( "All done." );
984 $feed_url = db_escape_string ( trim ( $_REQUEST [ "feed_url" ]));
985 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
986 $p_from = db_escape_string ( $_REQUEST [ "from" ]);
988 /* only read authentication information from POST */
990 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
991 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
993 if ( $p_from != 'tt-rss' ) {
994 header ( "Content-Type: text/html" );
997 <title>Tiny Tiny RSS</title>
998 <link rel= \" stylesheet \" type= \" text/css \" href= \" utility.css \" >
1001 <img class= \" floatingLogo \" src= \" images/ttrss_logo.png \"
1002 alt= \" Tiny Tiny RSS \" />
1003 <h1>Subscribe to feed...</h1>" ;
1006 $rc = subscribe_to_feed ( $this -> link
, $feed_url , $cat_id , $auth_login , $auth_pass );
1010 print_notice ( T_sprintf ( "Subscribed to <b> %s </b>." , $feed_url ));
1013 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>." , $feed_url ));
1016 print_error ( T_sprintf ( "No feeds found in <b> %s </b>." , $feed_url ));
1019 print_warning ( T_sprintf ( "Already subscribed to <b> %s </b>." , $feed_url ));
1022 print_notice ( "Multiple feed URLs found." );
1024 $feed_urls = get_feeds_from_html ( $feed_url );
1027 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>.<br>Can't download the Feed URL." , $feed_url ));
1031 if ( $p_from != 'tt-rss' ) {
1035 print "<form action= \" backend.php \" >" ;
1036 print "<input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >" ;
1037 print "<input type= \" hidden \" name= \" quiet \" value= \" 1 \" >" ;
1038 print "<input type= \" hidden \" name= \" method \" value= \" add \" >" ;
1040 print "<select name= \" feed_url \" >" ;
1042 foreach ( $feed_urls as $url => $name ) {
1043 $url = htmlspecialchars ( $url );
1044 $name = htmlspecialchars ( $name );
1046 print "<option value= \" $url\" > $name </option>" ;
1049 print "<input type= \" submit \" value= \" " . __ ( "Subscribe to selected feed" ).
1055 $tp_uri = get_self_url_prefix () . "/prefs.php" ;
1056 $tt_uri = get_self_url_prefix ();
1059 $result = db_query ( $this -> link
, "SELECT id FROM ttrss_feeds WHERE
1060 feed_url = ' $feed_url ' AND owner_uid = " . $_SESSION [ "uid" ]);
1062 $feed_id = db_fetch_result ( $result , 0 , "id" );
1069 print "<form method= \" GET \" style='display: inline'
1071 <input type= \" hidden \" name= \" tab \" value= \" feedConfig \" >
1072 <input type= \" hidden \" name= \" method \" value= \" editFeed \" >
1073 <input type= \" hidden \" name= \" methodparam \" value= \" $feed_id\" >
1074 <input type= \" submit \" value= \" " . __ ( "Edit subscription options" ). " \" >
1078 print "<form style='display: inline' method= \" GET \" action= \" $tt_uri\" >
1079 <input type= \" submit \" value= \" " . __ ( "Return to Tiny Tiny RSS" ). " \" >
1082 print "</body></html>" ;
1087 function categorize () {
1088 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
1090 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
1093 $cat_id_qpart = 'NULL' ;
1095 $cat_id_qpart = "' $cat_id '" ;
1098 db_query ( $this -> link
, "BEGIN" );
1100 foreach ( $ids as $id ) {
1102 db_query ( $this -> link
, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
1104 AND owner_uid = " . $_SESSION [ "uid" ]);
1108 db_query ( $this -> link
, "COMMIT" );
1111 function editCats () {
1113 $action = $_REQUEST [ "action" ];
1115 if ( $action == "save" ) {
1117 $cat_title = db_escape_string ( trim ( $_REQUEST [ "value" ]));
1118 $cat_id = db_escape_string ( $_REQUEST [ "cid" ]);
1120 db_query ( $this -> link
, "BEGIN" );
1122 $result = db_query ( $this -> link
, "SELECT title FROM ttrss_feed_categories
1123 WHERE id = ' $cat_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
1125 if ( db_num_rows ( $result ) == 1 ) {
1127 $old_title = db_fetch_result ( $result , 0 , "title" );
1129 if ( $cat_title != "" ) {
1130 $result = db_query ( $this -> link
, "UPDATE ttrss_feed_categories SET
1131 title = ' $cat_title ' WHERE id = ' $cat_id ' AND
1132 owner_uid = " . $_SESSION [ "uid" ]);
1139 print $_REQUEST [ "value" ];
1142 db_query ( $this -> link
, "COMMIT" );
1148 if ( $action == "add" ) {
1150 $feed_cat = db_escape_string ( trim ( $_REQUEST [ "cat" ]));
1152 if (! add_feed_category ( $this -> link
, $feed_cat ))
1153 print_warning ( T_sprintf ( "Category <b>$ %s </b> already exists in the database." , $feed_cat ));
1157 if ( $action == "remove" ) {
1159 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
1161 foreach ( $ids as $id ) {
1162 remove_feed_category ( $this -> link
, $id , $_SESSION [ "uid" ]);
1166 print "<div dojoType= \" dijit.Toolbar \" >
1167 <input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \" name= \" newcat \" >
1168 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').addCategory() \" >" .
1169 __ ( 'Create category' ). "</button></div>" ;
1171 $result = db_query ( $this -> link
, "SELECT title,id FROM ttrss_feed_categories
1172 WHERE owner_uid = " . $_SESSION [ "uid" ]. "
1175 if ( db_num_rows ( $result ) != 0 ) {
1177 print "<div class= \" prefFeedCatHolder \" >" ;
1179 print "<table width= \" 100% \" class= \" prefFeedCatList \"
1180 cellspacing= \" 0 \" id= \" prefFeedCatList \" >" ;
1184 while ( $line = db_fetch_assoc ( $result )) {
1186 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
1188 $cat_id = $line [ "id" ];
1189 $this_row_id = "id= \" FCATR- $cat_id\" " ;
1191 print "<tr class= \"\" $this_row_id >" ;
1193 $edit_title = htmlspecialchars ( $line [ "title" ]);
1195 print "<td width='5%' align='center'><input
1196 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
1197 type= \" checkbox \" ></td>" ;
1201 print "<span dojoType= \" dijit.InlineEditBox \"
1202 width= \" 300px \" autoSave= \" false \"
1203 cat-id= \" $cat_id\" >" . $edit_title .
1204 "<script type= \" dojo/method \" event= \" onChange \" args= \" item \" >
1208 content: {op: 'pref-feeds', method: 'editCats',
1211 cid: this.srcNodeRef.getAttribute('cat-id')},
1212 load: function(response) {
1213 elem.attr('value', response);
1229 print "<p>" . __ ( 'No feed categories defined.' ). "</p>" ;
1232 print "<div class='dlgButtons'>
1233 <div style='float : left'>
1234 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').removeSelected() \" >" .
1235 __ ( 'Remove selected categories' ). "</button>
1238 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').hide() \" >" .
1239 __ ( 'Close this window' ). "</button></div>" ;
1247 print "<div dojoType= \" dijit.layout.AccordionContainer \" region= \" center \" >" ;
1248 print "<div id= \" pref-feeds-feeds \" dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Feeds' ). " \" >" ;
1250 $result = db_query ( $this -> link
, "SELECT COUNT(id) AS num_errors
1251 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
1253 $num_errors = db_fetch_result ( $result , 0 , "num_errors" );
1255 if ( $num_errors > 0 ) {
1257 $error_button = "<button dojoType= \" dijit.form.Button \"
1258 onclick= \" showFeedsWithErrors() \" id= \" errorButton \" >" .
1259 __ ( "Feeds with errors" ) . "</button>" ;
1262 if ( DB_TYPE
== "pgsql" ) {
1263 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
1265 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
1268 $result = db_query ( $this -> link
, "SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE
1269 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
1270 ttrss_entries.id = ref_id AND
1271 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart AND
1272 ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]);
1274 $num_inactive = db_fetch_result ( $result , 0 , "num_inactive" );
1276 if ( $num_inactive > 0 ) {
1277 $inactive_button = "<button dojoType= \" dijit.form.Button \"
1278 onclick= \" showInactiveFeeds() \" >" .
1279 __ ( "Inactive feeds" ) . "</button>" ;
1282 $feed_search = db_escape_string ( $_REQUEST [ "search" ]);
1284 if ( array_key_exists ( "search" , $_REQUEST )) {
1285 $_SESSION [ "prefs_feed_search" ] = $feed_search ;
1287 $feed_search = $_SESSION [ "prefs_feed_search" ];
1290 print '<div dojoType="dijit.layout.BorderContainer" gutters="false">' ;
1292 print "<div region='top' dojoType= \" dijit.Toolbar \" >" ; #toolbar
1294 print "<div style='float : right; padding-right : 4px;'>
1295 <input dojoType= \" dijit.form.TextBox \" id= \" feed_search \" size= \" 20 \" type= \" search \"
1296 value= \" $feed_search\" >
1297 <button dojoType= \" dijit.form.Button \" onclick= \" updateFeedList() \" >" .
1298 __ ( 'Search' ). "</button>
1301 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1302 "<span>" . __ ( 'Select' ). "</span>" ;
1303 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1304 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(true) \"
1305 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
1306 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(false) \"
1307 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
1308 print "</div></div>" ;
1310 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1311 "<span>" . __ ( 'Feeds' ). "</span>" ;
1312 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1313 print "<div onclick= \" quickAddFeed() \"
1314 dojoType= \" dijit.MenuItem \" >" . __ ( 'Subscribe to feed' ). "</div>" ;
1315 print "<div onclick= \" editSelectedFeed() \"
1316 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit selected feeds' ). "</div>" ;
1317 print "<div onclick= \" resetFeedOrder() \"
1318 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1319 print "</div></div>" ;
1321 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
1322 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1323 "<span>" . __ ( 'Categories' ). "</span>" ;
1324 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1325 print "<div onclick= \" editFeedCats() \"
1326 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit categories' ). "</div>" ;
1327 print "<div onclick= \" resetCatOrder() \"
1328 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1329 print "</div></div>" ;
1333 print $error_button ;
1334 print $inactive_button ;
1336 print "<button dojoType= \" dijit.form.Button \" onclick= \" removeSelectedFeeds() \" >"
1337 . __ ( 'Unsubscribe' ). "</button dojoType= \" dijit.form.Button \" > " ;
1339 if ( defined ( '_ENABLE_FEED_DEBUGGING' )) {
1341 print "<select id= \" feedActionChooser \" onchange= \" feedActionChange() \" >
1342 <option value= \" facDefault \" selected>" . __ ( 'More actions...' ). "</option>" ;
1344 if ( FORCE_ARTICLE_PURGE
== 0 ) {
1346 "<option value= \" facPurge \" >" . __ ( 'Manual purge' ). "</option>" ;
1350 <option value= \" facClear \" >" . __ ( 'Clear feed data' ). "</option>
1351 <option value= \" facRescore \" >" . __ ( 'Rescore articles' ). "</option>" ;
1357 print "</div>" ; # toolbar
1360 print '<div dojoType="dijit.layout.ContentPane" region="center">' ;
1362 print "<div id= \" feedlistLoading \" >
1363 <img src='images/indicator_tiny.gif'>" .
1364 __ ( "Loading, please wait..." ). "</div>" ;
1366 print "<div dojoType= \" fox.PrefFeedStore \" jsId= \" feedStore \"
1367 url= \" backend.php?op=pref-feeds&method=getfeedtree \" >
1369 <div dojoType= \" lib.CheckBoxStoreModel \" jsId= \" feedModel \" store= \" feedStore \"
1370 query= \" {id:'root'} \" rootId= \" root \" rootLabel= \" Feeds \"
1371 childrenAttrs= \" items \" checkboxStrict= \" false \" checkboxAll= \" false \" >
1373 <div dojoType= \" fox.PrefFeedTree \" id= \" feedTree \"
1374 dndController= \" dijit.tree.dndSource \"
1375 betweenThreshold= \" 5 \"
1376 model= \" feedModel \" openOnClick= \" false \" >
1377 <script type= \" dojo/method \" event= \" onClick \" args= \" item \" >
1378 var id = String(item.id);
1379 var bare_id = id.substr(id.indexOf(':')+1);
1381 if (id.match('FEED:')) {
1383 } else if (id.match('CAT:')) {
1384 editCat(bare_id, item);
1387 <script type= \" dojo/method \" event= \" onLoad \" args= \" item \" >
1388 Element.hide( \" feedlistLoading \" );
1392 print "<div dojoType= \" dijit.Tooltip \" connectId= \" feedTree \" position= \" below \" >
1393 " . __ ( '<b>Hint:</b> you can drag feeds and categories around.' ). "
1399 print "</div>" ; # feeds pane
1401 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'OPML' ). " \" >" ;
1403 print "<p>" . __ ( "Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings." ) . " " ;
1405 print "<span class= \" insensitive \" >" . __ ( "Note: Only main settings profile can be migrated using OPML." ) . "</span>" ;
1409 print "<h3>" . __ ( "Import" ) . "</h3>" ;
1411 print "<br/><iframe id= \" upload_iframe \"
1412 name= \" upload_iframe \" onload= \" opmlImportComplete(this) \"
1413 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
1415 print "<form name= \" opml_form \" style='display : block' target= \" upload_iframe \"
1416 enctype= \" multipart/form-data \" method= \" POST \"
1417 action= \" backend.php \" >
1418 <input id= \" opml_file \" name= \" opml_file \" type= \" file \" >
1419 <input type= \" hidden \" name= \" op \" value= \" dlg \" >
1420 <input type= \" hidden \" name= \" method \" value= \" importOpml \" >
1421 <button dojoType= \" dijit.form.Button \" onclick= \" return opmlImport(); \" type= \" submit \" >" .
1422 __ ( 'Import' ) . "</button>" ;
1424 print "<h3>" . __ ( "Export" ) . "</h3>" ;
1426 print "<p>" . __ ( 'Filename:' ) .
1427 " <input type= \" text \" id= \" filename \" value= \" TinyTinyRSS.opml \" /> " .
1428 __ ( 'Include settings' ) . "<input type= \" checkbox \" id= \" settings \" CHECKED />" .
1430 "<button dojoType= \" dijit.form.Button \"
1431 onclick= \" gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked) \" >" .
1432 __ ( 'Export' ) . "</button></p></form>" ;
1434 print "<h3>" . __ ( "Publish" ) . "</h3>" ;
1436 print "<p>" . __ ( 'Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.' ) . " " ;
1438 print "<span class= \" insensitive \" >" . __ ( "Note: Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds." ) . "</span>" . "</p>" ;
1440 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('pubOPMLUrl') \" >" .
1441 __ ( 'Display URL' ). "</button> " ;
1444 print "</div>" ; # pane
1446 if ( strpos ( $_SERVER [ 'HTTP_USER_AGENT' ], "Firefox" ) !== false ) {
1448 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Firefox integration' ). " \" >" ;
1450 print "<p>" . __ ( 'This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.' ) . "</p>" ;
1454 print "<button onclick='window.navigator.registerContentHandler(" .
1455 " \" application/vnd.mozilla.maybe.feed \" , " .
1456 " \" " . add_feed_url () . " \" , " . " \" Tiny Tiny RSS \" )'>" .
1457 __ ( 'Click here to register this site as a feed reader.' ) .
1462 print "</div>" ; # pane
1465 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Subscribing using bookmarklet' ). " \" >" ;
1467 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>" ;
1469 $bm_subscribe_url = str_replace ( ' %s ' , '' , add_feed_url ());
1471 $confirm_str = __ ( 'Subscribe to %s in Tiny Tiny RSS?' );
1473 $bm_url = htmlspecialchars ( "javascript:{if(confirm(' $confirm_str '.replace(' %s ',window.location.href)))window.location.href=' $bm_subscribe_url '+window.location.href}" );
1475 print "<a href= \" $bm_url\" class='bookmarklet'>" . __ ( 'Subscribe in Tiny Tiny RSS' ). "</a>" ;
1477 print "</div>" ; #pane
1479 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Published & shared articles and generated feeds' ). " \" >" ;
1481 print "<h3>" . __ ( "Published articles and generated feeds" ) . "</h3>" ;
1483 print "<p>" . __ ( 'Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.' ). "</p>" ;
1485 $rss_url = '-2::' . htmlspecialchars ( get_self_url_prefix () .
1486 "/public.php?op=rss&id=-2&view-mode=all_articles" );;
1488 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('generatedFeed', ' $rss_url ') \" >" .
1489 __ ( 'Display URL' ). "</button> " ;
1491 print "<button dojoType= \" dijit.form.Button \" onclick= \" return clearFeedAccessKeys() \" >" .
1492 __ ( 'Clear all generated URLs' ). "</button> " ;
1494 print "<h3>" . __ ( "Articles shared by URL" ) . "</h3>" ;
1496 print "<p>" . __ ( "You can disable all articles shared by unique URLs here." ) . "</p>" ;
1498 print "<button dojoType= \" dijit.form.Button \" onclick= \" return clearArticleAccessKeys() \" >" .
1499 __ ( 'Unshare all articles' ). "</button> " ;
1501 print "</div>" ; #pane
1503 if ( defined ( 'CONSUMER_KEY' ) && CONSUMER_KEY
!= '' ) {
1505 print "<div id= \" pref-feeds-twitter \" dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Twitter' ). " \" >" ;
1507 $result = db_query ( $this -> link
, "SELECT COUNT(*) AS cid FROM ttrss_users
1508 WHERE twitter_oauth IS NOT NULL AND twitter_oauth != '' AND
1509 id = " . $_SESSION [ 'uid' ]);
1511 $is_registered = db_fetch_result ( $result , 0 , "cid" ) != 0 ;
1513 if (! $is_registered ) {
1514 print_notice ( __ ( 'Before you can update your Twitter feeds, you must register this instance of Tiny Tiny RSS with Twitter.com.' ));
1516 print_notice ( __ ( 'You have been successfully registered with Twitter.com and should be able to access your Twitter feeds.' ));
1519 print "<button dojoType= \" dijit.form.Button \" onclick= \" window.location.href = 'twitter.php?op=register' \" >" .
1520 __ ( "Register with Twitter.com" ). "</button>" ;
1524 print "<button dojoType= \" dijit.form.Button \"
1525 onclick= \" return clearTwitterCredentials() \" >" .
1526 __ ( "Clear stored credentials" ). "</button>" ;
1528 print "</div>" ; # pane
1532 print "</div>" ; #container