]>
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' )) {
49 $result = db_query ( $this -> link
, "SELECT id, title FROM ttrss_feed_categories
50 WHERE owner_uid = " . $_SESSION [ "uid" ] . " ORDER BY order_id, title" );
52 while ( $line = db_fetch_assoc ( $result )) {
54 $cat [ 'id' ] = 'CAT:' . $line [ 'id' ];
55 $cat [ 'bare_id' ] = $feed_id ;
56 $cat [ 'name' ] = $line [ 'title' ];
57 $cat [ 'items' ] = array ();
58 $cat [ 'checkbox' ] = false ;
59 $cat [ 'type' ] = 'category' ;
61 $feed_result = db_query ( $this -> link
, "SELECT id, title, last_error,
62 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
64 WHERE cat_id = '" . $line [ 'id' ]. "' AND owner_uid = " . $_SESSION [ "uid" ].
65 " $search_qpart ORDER BY order_id, title" );
67 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
69 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
70 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
71 $feed [ 'name' ] = $feed_line [ 'title' ];
72 $feed [ 'checkbox' ] = false ;
73 $feed [ 'error' ] = $feed_line [ 'last_error' ];
74 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
75 $feed [ 'param' ] = make_local_datetime ( $this -> link
,
76 $feed_line [ 'last_updated' ], true );
78 array_push ( $cat [ 'items' ], $feed );
81 $cat [ 'param' ] = T_sprintf ( '( %d feeds)' , count ( $cat [ 'items' ]));
83 if ( count ( $cat [ 'items' ]) > 0 )
84 array_push ( $root [ 'items' ], $cat );
86 $root [ 'param' ] +
= count ( $cat [ 'items' ]);
89 /* Uncategorized is a special case */
94 $cat [ 'name' ] = __ ( "Uncategorized" );
95 $cat [ 'items' ] = array ();
96 $cat [ 'type' ] = 'category' ;
97 $cat [ 'checkbox' ] = false ;
99 $feed_result = db_query ( $this -> link
, "SELECT id, title,last_error,
100 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
102 WHERE cat_id IS NULL AND owner_uid = " . $_SESSION [ "uid" ].
103 " $search_qpart ORDER BY order_id, title" );
105 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
107 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
108 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
109 $feed [ 'name' ] = $feed_line [ 'title' ];
110 $feed [ 'checkbox' ] = false ;
111 $feed [ 'error' ] = $feed_line [ 'last_error' ];
112 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
113 $feed [ 'param' ] = make_local_datetime ( $this -> link
,
114 $feed_line [ 'last_updated' ], true );
116 array_push ( $cat [ 'items' ], $feed );
119 $cat [ 'param' ] = T_sprintf ( '( %d feeds)' , count ( $cat [ 'items' ]));
121 if ( count ( $cat [ 'items' ]) > 0 )
122 array_push ( $root [ 'items' ], $cat );
124 $root [ 'param' ] +
= count ( $cat [ 'items' ]);
125 $root [ 'param' ] = T_sprintf ( '( %d feeds)' , $root [ 'param' ]);
128 $feed_result = db_query ( $this -> link
, "SELECT id, title, last_error,
129 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
131 WHERE owner_uid = " . $_SESSION [ "uid" ].
132 " $search_qpart ORDER BY order_id, title" );
134 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
136 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
137 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
138 $feed [ 'name' ] = $feed_line [ 'title' ];
139 $feed [ 'checkbox' ] = false ;
140 $feed [ 'error' ] = $feed_line [ 'last_error' ];
141 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
142 $feed [ 'param' ] = make_local_datetime ( $this -> link
,
143 $feed_line [ 'last_updated' ], true );
145 array_push ( $root [ 'items' ], $feed );
148 $root [ 'param' ] = T_sprintf ( '( %d feeds)' , count ( $root [ 'items' ]));
153 $fl [ 'identifier' ] = 'id' ;
154 $fl [ 'label' ] = 'name' ;
155 $fl [ 'items' ] = array ( $root );
157 print json_encode ( $fl );
161 function catsortreset () {
162 db_query ( $this -> link
, "UPDATE ttrss_feed_categories
163 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
167 function feedsortreset () {
168 db_query ( $this -> link
, "UPDATE ttrss_feeds
169 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
173 function savefeedorder () {
174 $data = json_decode ( $_POST [ 'payload' ], true );
176 if ( is_array ( $data ) && is_array ( $data [ 'items' ])) {
181 foreach ( $data [ 'items' ] as $item ) {
183 if ( $item [ 'id' ] != 'root' ) {
184 if ( is_array ( $item [ 'items' ])) {
185 if ( isset ( $item [ 'items' ][ '_reference' ])) {
186 $data_map [ $item [ 'id' ]] = array ( $item [ 'items' ]);
188 $data_map [ $item [ 'id' ]] =& $item [ 'items' ];
194 foreach ( $data [ 'items' ][ 0 ][ 'items' ] as $item ) {
195 $id = $item [ '_reference' ];
196 $bare_id = substr ( $id , strpos ( $id , ':' ) +
1 );
201 db_query ( $this -> link
, "UPDATE ttrss_feed_categories
202 SET order_id = ' $cat_order_id ' WHERE id = ' $bare_id ' AND
203 owner_uid = " . $_SESSION [ "uid" ]);
208 if ( is_array ( $data_map [ $id ])) {
209 foreach ( $data_map [ $id ] as $feed ) {
210 $id = $feed [ '_reference' ];
211 $feed_id = substr ( $id , strpos ( $id , ':' ) +
1 );
214 $cat_query = "cat_id = ' $bare_id '" ;
216 $cat_query = "cat_id = NULL" ;
218 db_query ( $this -> link
, "UPDATE ttrss_feeds
219 SET order_id = ' $feed_order_id ',
221 WHERE id = ' $feed_id ' AND
222 owner_uid = " . $_SESSION [ "uid" ]);
233 function removeicon () {
234 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
236 $result = db_query ( $this -> link
, "SELECT id FROM ttrss_feeds
237 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
239 if ( db_num_rows ( $result ) != 0 ) {
240 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
246 function uploadicon () {
247 $icon_file = $_FILES [ 'icon_file' ][ 'tmp_name' ];
248 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
250 if ( is_file ( $icon_file ) && $feed_id ) {
251 if ( filesize ( $icon_file ) < 20000 ) {
253 $result = db_query ( $this -> link
, "SELECT id FROM ttrss_feeds
254 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
256 if ( db_num_rows ( $result ) != 0 ) {
257 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
258 move_uploaded_file ( $icon_file , ICONS_DIR
. "/ $feed_id .ico" );
270 print "<script type= \" text/javascript \" >" ;
271 print "parent.uploadIconHandler( $rc );" ;
276 function editfeed () {
277 global $purge_intervals ;
278 global $update_intervals ;
279 global $update_methods ;
281 $feed_id = db_escape_string ( $_REQUEST [ "id" ]);
283 $result = db_query ( $this -> link
,
284 "SELECT * FROM ttrss_feeds WHERE id = ' $feed_id ' AND
285 owner_uid = " . $_SESSION [ "uid" ]);
287 $title = htmlspecialchars ( db_fetch_result ( $result ,
290 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $feed_id\" >" ;
291 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-feeds \" >" ;
292 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" editSave \" >" ;
294 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
295 print "<div class= \" dlgSecCont \" >" ;
299 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
300 placeHolder= \" " . __ ( "Feed Title" ). " \"
301 style= \" font-size : 16px; width: 20em \" name= \" title \" value= \" $title\" >" ;
305 $feed_url = db_fetch_result ( $result , 0 , "feed_url" );
306 $feed_url = htmlspecialchars ( db_fetch_result ( $result ,
311 print __ ( 'URL:' ) . " " ;
312 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
313 placeHolder= \" " . __ ( "Feed URL" ). " \"
314 regExp='^(http|https)://.*' style= \" width : 20em \"
315 name= \" feed_url \" value= \" $feed_url\" >" ;
317 $last_error = db_fetch_result ( $result , 0 , "last_error" );
320 print " <span title= \" " . htmlspecialchars ( $last_error ). " \"
321 class= \" feed_error \" >(error)</span>" ;
327 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
329 $cat_id = db_fetch_result ( $result , 0 , "cat_id" );
333 print __ ( 'Place in category:' ) . " " ;
335 print_feed_cat_select ( $this -> link
, "cat_id" , $cat_id ,
336 'dojoType="dijit.form.Select"' );
341 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
342 print "<div class= \" dlgSecCont \" >" ;
344 /* Update Interval */
346 $update_interval = db_fetch_result ( $result , 0 , "update_interval" );
348 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
349 'dojoType="dijit.form.Select"' );
353 $update_method = db_fetch_result ( $result , 0 , "update_method" ,
354 'dojoType="dijit.form.Select"' );
356 print " " . __ ( 'using' ) . " " ;
357 print_select_hash ( "update_method" , $update_method , $update_methods ,
358 'dojoType="dijit.form.Select"' );
360 $purge_interval = db_fetch_result ( $result , 0 , "purge_interval" );
366 print __ ( 'Article purging:' ) . " " ;
368 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
369 'dojoType="dijit.form.Select" ' .
370 (( FORCE_ARTICLE_PURGE
== 0 ) ?
"" : 'disabled="1"' ));
373 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
374 print "<div class= \" dlgSecCont \" >" ;
376 $auth_login = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_login" ));
378 print "<input dojoType= \" dijit.form.TextBox \" id= \" feedEditDlg_login \"
379 placeHolder= \" " . __ ( "Login" ). " \"
380 name= \" auth_login \" value= \" $auth_login\" ><hr/>" ;
382 $auth_pass = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_pass" ));
384 print "<input dojoType= \" dijit.form.TextBox \" type= \" password \" name= \" auth_pass \"
385 placeHolder= \" " . __ ( "Password" ). " \"
386 value= \" $auth_pass\" >" ;
388 print "<div dojoType= \" dijit.Tooltip \" connectId= \" feedEditDlg_login \" position= \" below \" >
389 " . __ ( '<b>Hint:</b> you need to fill in your login information if your feed requires authentication, except for Twitter feeds.' ). "
393 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
394 print "<div class= \" dlgSecCont \" >" ;
396 $private = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "private" ));
399 $checked = "checked= \" 1 \" " ;
404 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" private \" id= \" private \"
405 $checked > <label for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
407 $rtl_content = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "rtl_content" ));
410 $checked = "checked= \" 1 \" " ;
415 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
416 $checked > <label for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
418 $include_in_digest = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "include_in_digest" ));
420 if ( $include_in_digest ) {
421 $checked = "checked= \" 1 \" " ;
426 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" include_in_digest \"
427 name= \" include_in_digest \"
428 $checked > <label for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
431 $always_display_enclosures = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "always_display_enclosures" ));
433 if ( $always_display_enclosures ) {
434 $checked = "checked" ;
439 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" always_display_enclosures \"
440 name= \" always_display_enclosures \"
441 $checked > <label for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
444 $cache_images = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "cache_images" ));
447 $checked = "checked= \" 1 \" " ;
452 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" cache_images \"
453 name= \" cache_images \"
454 $checked > <label for= \" cache_images \" >" .
455 __ ( 'Cache images locally' ). "</label>" ;
457 $mark_unread_on_update = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "mark_unread_on_update" ));
459 if ( $mark_unread_on_update ) {
460 $checked = "checked" ;
465 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" mark_unread_on_update \"
466 name= \" mark_unread_on_update \"
467 $checked > <label for= \" mark_unread_on_update \" >" . __ ( 'Mark updated articles as unread' ). "</label>" ;
469 $update_on_checksum_change = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "update_on_checksum_change" ));
471 if ( $update_on_checksum_change ) {
472 $checked = "checked" ;
477 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" update_on_checksum_change \"
478 name= \" update_on_checksum_change \"
479 $checked > <label for= \" update_on_checksum_change \" >" . __ ( 'Mark posts as updated on content change' ). "</label>" ;
485 print "<div class= \" dlgSec \" >" . __ ( "Icon" ). "</div>" ;
486 print "<div class= \" dlgSecCont \" >" ;
488 print "<iframe name= \" icon_upload_iframe \"
489 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
491 print "<form style='display : block' target= \" icon_upload_iframe \"
492 enctype= \" multipart/form-data \" method= \" POST \"
493 action= \" backend.php \" >
494 <input id= \" icon_file \" size= \" 10 \" name= \" icon_file \" type= \" file \" >
495 <input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >
496 <input type= \" hidden \" name= \" feed_id \" value= \" $feed_id\" >
497 <input type= \" hidden \" name= \" method \" value= \" uploadicon \" >
498 <button dojoType= \" dijit.form.Button \" onclick= \" return uploadFeedIcon(); \"
499 type= \" submit \" >" . __ ( 'Replace' ). "</button>
500 <button dojoType= \" dijit.form.Button \" onclick= \" return removeFeedIcon( $feed_id ); \"
501 type= \" submit \" >" . __ ( 'Remove' ). "</button>
506 $title = htmlspecialchars ( $title , ENT_QUOTES
);
508 print "<div class='dlgButtons'>
509 <div style= \" float : left \" >
510 <button dojoType= \" dijit.form.Button \" onclick='return unsubscribeFeed( $feed_id , \" $title\" )'>" .
511 __ ( 'Unsubscribe' ). "</button>" ;
513 if ( PUBSUBHUBBUB_ENABLED
) {
514 $pubsub_state = db_fetch_result ( $result , 0 , "pubsub_state" );
515 $pubsub_btn_disabled = ( $pubsub_state == 2 ) ?
"" : "disabled= \" 1 \" " ;
517 print "<button dojoType= \" dijit.form.Button \" id= \" pubsubReset_Btn \" $pubsub_btn_disabled
518 onclick='return resetPubSub( $feed_id , \" $title\" )'>" . __ ( 'Resubscribe to push updates' ).
524 print "<div dojoType= \" dijit.Tooltip \" connectId= \" pubsubReset_Btn \" position= \" below \" >" .
525 __ ( 'Resets PubSubHubbub subscription status for push-enabled feeds.' ). "</div>" ;
527 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedEditDlg').execute() \" >" . __ ( 'Save' ). "</button>
528 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedEditDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
534 function editfeeds () {
535 global $purge_intervals ;
536 global $update_intervals ;
537 global $update_methods ;
539 $feed_ids = db_escape_string ( $_REQUEST [ "ids" ]);
541 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" ids \" value= \" $feed_ids\" >" ;
542 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-feeds \" >" ;
543 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" batchEditSave \" >" ;
545 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
546 print "<div class= \" dlgSecCont \" >" ;
550 print "<input dojoType= \" dijit.form.ValidationTextBox \"
551 disabled= \" 1 \" style= \" font-size : 16px; width : 20em; \" required= \" 1 \"
552 name= \" title \" value= \" $title\" >" ;
554 $this -> batch_edit_cbox ( "title" );
560 print __ ( 'URL:' ) . " " ;
561 print "<input dojoType= \" dijit.form.ValidationTextBox \" disabled= \" 1 \"
562 required= \" 1 \" regExp='^(http|https)://.*' style= \" width : 20em \"
563 name= \" feed_url \" value= \" $feed_url\" >" ;
565 $this -> batch_edit_cbox ( "feed_url" );
569 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
573 print __ ( 'Place in category:' ) . " " ;
575 print_feed_cat_select ( $this -> link
, "cat_id" , $cat_id ,
576 'disabled="1" dojoType="dijit.form.Select"' );
578 $this -> batch_edit_cbox ( "cat_id" );
584 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
585 print "<div class= \" dlgSecCont \" >" ;
587 /* Update Interval */
589 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
590 'disabled="1" dojoType="dijit.form.Select"' );
592 $this -> batch_edit_cbox ( "update_interval" );
596 print " " . __ ( 'using' ) . " " ;
597 print_select_hash ( "update_method" , $update_method , $update_methods ,
598 'disabled="1" dojoType="dijit.form.Select"' );
599 $this -> batch_edit_cbox ( "update_method" );
603 if ( FORCE_ARTICLE_PURGE
== 0 ) {
607 print __ ( 'Article purging:' ) . " " ;
609 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
610 'disabled="1" dojoType="dijit.form.Select"' );
612 $this -> batch_edit_cbox ( "purge_interval" );
616 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
617 print "<div class= \" dlgSecCont \" >" ;
619 print "<input dojoType= \" dijit.form.TextBox \"
620 placeHolder= \" " . __ ( "Login" ). " \" disabled= \" 1 \"
621 name= \" auth_login \" value= \" $auth_login\" >" ;
623 $this -> batch_edit_cbox ( "auth_login" );
625 print "<br/><input dojoType= \" dijit.form.TextBox \" type= \" password \" name= \" auth_pass \"
626 placeHolder= \" " . __ ( "Password" ). " \" disabled= \" 1 \"
627 value= \" $auth_pass\" >" ;
629 $this -> batch_edit_cbox ( "auth_pass" );
632 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
633 print "<div class= \" dlgSecCont \" >" ;
635 print "<input disabled= \" 1 \" type= \" checkbox \" name= \" private \" id= \" private \"
636 dojoType= \" dijit.form.CheckBox \" > <label id= \" private_l \" class='insensitive' for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
638 print " " ; $this -> batch_edit_cbox ( "private" , "private_l" );
640 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
641 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" rtl_content_l \" for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
643 print " " ; $this -> batch_edit_cbox ( "rtl_content" , "rtl_content_l" );
645 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" include_in_digest \"
646 name= \" include_in_digest \"
647 dojoType= \" dijit.form.CheckBox \" > <label id= \" include_in_digest_l \" class='insensitive' for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
649 print " " ; $this -> batch_edit_cbox ( "include_in_digest" , "include_in_digest_l" );
651 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" always_display_enclosures \"
652 name= \" always_display_enclosures \"
653 dojoType= \" dijit.form.CheckBox \" > <label id= \" always_display_enclosures_l \" class='insensitive' for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
655 print " " ; $this -> batch_edit_cbox ( "always_display_enclosures" , "always_display_enclosures_l" );
657 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" cache_images \"
658 name= \" cache_images \"
659 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" cache_images_l \"
660 for= \" cache_images \" >" .
661 __ ( 'Cache images locally' ). "</label>" ;
663 print " " ; $this -> batch_edit_cbox ( "cache_images" , "cache_images_l" );
665 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" mark_unread_on_update \"
666 name= \" mark_unread_on_update \"
667 dojoType= \" dijit.form.CheckBox \" > <label id= \" mark_unread_on_update_l \" class='insensitive' for= \" mark_unread_on_update \" >" . __ ( 'Mark updated articles as unread' ). "</label>" ;
669 print " " ; $this -> batch_edit_cbox ( "mark_unread_on_update" , "mark_unread_on_update_l" );
671 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" update_on_checksum_change \"
672 name= \" update_on_checksum_change \"
673 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>" ;
675 print " " ; $this -> batch_edit_cbox ( "update_on_checksum_change" , "update_on_checksum_change_l" );
679 print "<div class='dlgButtons'>
680 <button dojoType= \" dijit.form.Button \"
681 onclick= \" return dijit.byId('feedEditDlg').execute() \" >" .
682 __ ( 'Save' ). "</button>
683 <button dojoType= \" dijit.form.Button \"
684 onclick= \" return dijit.byId('feedEditDlg').hide() \" >" .
685 __ ( 'Cancel' ). "</button>
691 function batchEditSave () {
692 return $this -> editsaveops ( true );
695 function editSave () {
696 return $this -> editsaveops ( false );
699 function editsaveops ( $batch ) {
701 $feed_title = db_escape_string ( trim ( $_POST [ "title" ]));
702 $feed_link = db_escape_string ( trim ( $_POST [ "feed_url" ]));
703 $upd_intl = ( int ) db_escape_string ( $_POST [ "update_interval" ]);
704 $purge_intl = ( int ) db_escape_string ( $_POST [ "purge_interval" ]);
705 $feed_id = ( int ) db_escape_string ( $_POST [ "id" ]); /* editSave */
706 $feed_ids = db_escape_string ( $_POST [ "ids" ]); /* batchEditSave */
707 $cat_id = ( int ) db_escape_string ( $_POST [ "cat_id" ]);
708 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
709 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
710 $private = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "private" ]));
711 $rtl_content = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "rtl_content" ]));
712 $include_in_digest = checkbox_to_sql_bool (
713 db_escape_string ( $_POST [ "include_in_digest" ]));
714 $cache_images = checkbox_to_sql_bool (
715 db_escape_string ( $_POST [ "cache_images" ]));
716 $update_method = ( int ) db_escape_string ( $_POST [ "update_method" ]);
718 $always_display_enclosures = checkbox_to_sql_bool (
719 db_escape_string ( $_POST [ "always_display_enclosures" ]));
721 $mark_unread_on_update = checkbox_to_sql_bool (
722 db_escape_string ( $_POST [ "mark_unread_on_update" ]));
724 $update_on_checksum_change = checkbox_to_sql_bool (
725 db_escape_string ( $_POST [ "update_on_checksum_change" ]));
727 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
728 if ( $cat_id && $cat_id != 0 ) {
729 $category_qpart = "cat_id = ' $cat_id '," ;
730 $category_qpart_nocomma = "cat_id = ' $cat_id '" ;
732 $category_qpart = 'cat_id = NULL,' ;
733 $category_qpart_nocomma = 'cat_id = NULL' ;
736 $category_qpart = "" ;
737 $category_qpart_nocomma = "" ;
740 $cache_images_qpart = "cache_images = $cache_images ," ;
744 $result = db_query ( $this -> link
, "UPDATE ttrss_feeds SET
746 title = ' $feed_title ', feed_url = ' $feed_link ',
747 update_interval = ' $upd_intl ',
748 purge_interval = ' $purge_intl ',
749 auth_login = ' $auth_login ',
750 auth_pass = ' $auth_pass ',
752 rtl_content = $rtl_content ,
754 include_in_digest = $include_in_digest ,
755 always_display_enclosures = $always_display_enclosures ,
756 mark_unread_on_update = $mark_unread_on_update ,
757 update_on_checksum_change = $update_on_checksum_change ,
758 update_method = ' $update_method '
759 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
762 $feed_data = array ();
764 foreach ( array_keys ( $_POST ) as $k ) {
765 if ( $k != "op" && $k != "method" && $k != "ids" ) {
766 $feed_data [ $k ] = $_POST [ $k ];
770 db_query ( $this -> link
, "BEGIN" );
772 foreach ( array_keys ( $feed_data ) as $k ) {
778 $qpart = "title = ' $feed_title '" ;
782 $qpart = "feed_url = ' $feed_link '" ;
785 case "update_interval" :
786 $qpart = "update_interval = ' $upd_intl '" ;
789 case "purge_interval" :
790 $qpart = "purge_interval = ' $purge_intl '" ;
794 $qpart = "auth_login = ' $auth_login '" ;
798 $qpart = "auth_pass = ' $auth_pass '" ;
802 $qpart = "private = ' $private '" ;
805 case "include_in_digest" :
806 $qpart = "include_in_digest = ' $include_in_digest '" ;
809 case "always_display_enclosures" :
810 $qpart = "always_display_enclosures = ' $always_display_enclosures '" ;
813 case "mark_unread_on_update" :
814 $qpart = "mark_unread_on_update = ' $mark_unread_on_update '" ;
817 case "update_on_checksum_change" :
818 $qpart = "update_on_checksum_change = ' $update_on_checksum_change '" ;
822 $qpart = "cache_images = ' $cache_images '" ;
826 $qpart = "rtl_content = ' $rtl_content '" ;
829 case "update_method" :
830 $qpart = "update_method = ' $update_method '" ;
834 $qpart = $category_qpart_nocomma ;
840 db_query ( $this -> link
,
841 "UPDATE ttrss_feeds SET $qpart WHERE id IN ( $feed_ids )
842 AND owner_uid = " . $_SESSION [ "uid" ]);
847 db_query ( $this -> link
, "COMMIT" );
852 function resetPubSub () {
854 $ids = db_escape_string ( $_REQUEST [ "ids" ]);
856 db_query ( $this -> link
, "UPDATE ttrss_feeds SET pubsub_state = 0 WHERE id IN ( $ids )
857 AND owner_uid = " . $_SESSION [ "uid" ]);
864 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
866 foreach ( $ids as $id ) {
867 remove_feed ( $this -> link
, $id , $_SESSION [ "uid" ]);
874 $id = db_escape_string ( $_REQUEST [ "id" ]);
875 clear_feed_articles ( $this -> link
, $id );
879 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
881 foreach ( $ids as $id ) {
883 $filters = load_filters ( $this -> link
, $id , $_SESSION [ "uid" ], 6 );
885 $result = db_query ( $this -> link
, "SELECT
886 title, content, link, ref_id, author," .
887 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
889 ttrss_user_entries, ttrss_entries
890 WHERE ref_id = id AND feed_id = ' $id ' AND
891 owner_uid = " . $_SESSION [ 'uid' ]. "
896 while ( $line = db_fetch_assoc ( $result )) {
898 $tags = get_article_tags ( $this -> link
, $line [ "ref_id" ]);
900 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
901 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
902 $line [ 'author' ], $tags );
904 $new_score = calculate_article_score ( $article_filters );
906 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
908 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
911 foreach ( array_keys ( $scores ) as $s ) {
913 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
915 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
916 } else if ( $s < - 500 ) {
917 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
919 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
921 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
922 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
927 print __ ( "All done." );
931 function rescoreAll () {
933 $result = db_query ( $this -> link
,
934 "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION [ 'uid' ]);
936 while ( $feed_line = db_fetch_assoc ( $result )) {
938 $id = $feed_line [ "id" ];
940 $filters = load_filters ( $this -> link
, $id , $_SESSION [ "uid" ], 6 );
942 $tmp_result = db_query ( $this -> link
, "SELECT
943 title, content, link, ref_id, author," .
944 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
946 ttrss_user_entries, ttrss_entries
947 WHERE ref_id = id AND feed_id = ' $id ' AND
948 owner_uid = " . $_SESSION [ 'uid' ]. "
953 while ( $line = db_fetch_assoc ( $tmp_result )) {
955 $tags = get_article_tags ( $this -> link
, $line [ "ref_id" ]);
957 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
958 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
959 $line [ 'author' ], $tags );
961 $new_score = calculate_article_score ( $article_filters );
963 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
965 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
968 foreach ( array_keys ( $scores ) as $s ) {
970 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ',
972 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
974 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
975 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
980 print __ ( "All done." );
985 $feed_url = db_escape_string ( trim ( $_REQUEST [ "feed_url" ]));
986 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
987 $p_from = db_escape_string ( $_REQUEST [ "from" ]);
989 /* only read authentication information from POST */
991 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
992 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
994 if ( $p_from != 'tt-rss' ) {
995 header ( 'Content-Type: text/html; charset=utf-8' );
998 <title>Tiny Tiny RSS</title>
999 <link rel= \" stylesheet \" type= \" text/css \" href= \" utility.css \" >
1000 <meta http-equiv= \" Content-Type \" content= \" text/html; charset=utf-8 \" />
1003 <img class= \" floatingLogo \" src= \" images/ttrss_logo.png \"
1004 alt= \" Tiny Tiny RSS \" />
1005 <h1>Subscribe to feed...</h1>" ;
1008 $rc = subscribe_to_feed ( $this -> link
, $feed_url , $cat_id , $auth_login , $auth_pass );
1012 print_notice ( T_sprintf ( "Subscribed to <b> %s </b>." , $feed_url ));
1015 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>." , $feed_url ));
1018 print_error ( T_sprintf ( "No feeds found in <b> %s </b>." , $feed_url ));
1021 print_warning ( T_sprintf ( "Already subscribed to <b> %s </b>." , $feed_url ));
1024 print_notice ( __ ( "Multiple feed URLs found." ));
1026 $feed_urls = get_feeds_from_html ( $feed_url );
1029 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>.<br>Can't download the Feed URL." , $feed_url ));
1033 if ( $p_from != 'tt-rss' ) {
1037 print "<form action= \" backend.php \" >" ;
1038 print "<input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >" ;
1039 print "<input type= \" hidden \" name= \" quiet \" value= \" 1 \" >" ;
1040 print "<input type= \" hidden \" name= \" method \" value= \" add \" >" ;
1042 print "<select name= \" feed_url \" >" ;
1044 foreach ( $feed_urls as $url => $name ) {
1045 $url = htmlspecialchars ( $url );
1046 $name = htmlspecialchars ( $name );
1048 print "<option value= \" $url\" > $name </option>" ;
1051 print "<input type= \" submit \" value= \" " . __ ( "Subscribe to selected feed" ).
1057 $tp_uri = get_self_url_prefix () . "/prefs.php" ;
1058 $tt_uri = get_self_url_prefix ();
1061 $result = db_query ( $this -> link
, "SELECT id FROM ttrss_feeds WHERE
1062 feed_url = ' $feed_url ' AND owner_uid = " . $_SESSION [ "uid" ]);
1064 $feed_id = db_fetch_result ( $result , 0 , "id" );
1071 print "<form method= \" GET \" style='display: inline'
1073 <input type= \" hidden \" name= \" tab \" value= \" feedConfig \" >
1074 <input type= \" hidden \" name= \" method \" value= \" editFeed \" >
1075 <input type= \" hidden \" name= \" methodparam \" value= \" $feed_id\" >
1076 <input type= \" submit \" value= \" " . __ ( "Edit subscription options" ). " \" >
1080 print "<form style='display: inline' method= \" GET \" action= \" $tt_uri\" >
1081 <input type= \" submit \" value= \" " . __ ( "Return to Tiny Tiny RSS" ). " \" >
1084 print "</body></html>" ;
1089 function categorize () {
1090 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
1092 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
1095 $cat_id_qpart = 'NULL' ;
1097 $cat_id_qpart = "' $cat_id '" ;
1100 db_query ( $this -> link
, "BEGIN" );
1102 foreach ( $ids as $id ) {
1104 db_query ( $this -> link
, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
1106 AND owner_uid = " . $_SESSION [ "uid" ]);
1110 db_query ( $this -> link
, "COMMIT" );
1113 function editCats () {
1115 $action = $_REQUEST [ "action" ];
1117 if ( $action == "save" ) {
1119 $cat_title = db_escape_string ( trim ( $_REQUEST [ "value" ]));
1120 $cat_id = db_escape_string ( $_REQUEST [ "cid" ]);
1122 db_query ( $this -> link
, "BEGIN" );
1124 $result = db_query ( $this -> link
, "SELECT title FROM ttrss_feed_categories
1125 WHERE id = ' $cat_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
1127 if ( db_num_rows ( $result ) == 1 ) {
1129 $old_title = db_fetch_result ( $result , 0 , "title" );
1131 if ( $cat_title != "" ) {
1132 $result = db_query ( $this -> link
, "UPDATE ttrss_feed_categories SET
1133 title = ' $cat_title ' WHERE id = ' $cat_id ' AND
1134 owner_uid = " . $_SESSION [ "uid" ]);
1141 print $_REQUEST [ "value" ];
1144 db_query ( $this -> link
, "COMMIT" );
1150 if ( $action == "add" ) {
1152 $feed_cat = db_escape_string ( trim ( $_REQUEST [ "cat" ]));
1154 if (! add_feed_category ( $this -> link
, $feed_cat ))
1155 print_warning ( T_sprintf ( "Category <b>$ %s </b> already exists in the database." , $feed_cat ));
1159 if ( $action == "remove" ) {
1161 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
1163 foreach ( $ids as $id ) {
1164 remove_feed_category ( $this -> link
, $id , $_SESSION [ "uid" ]);
1168 print "<div dojoType= \" dijit.Toolbar \" >
1169 <input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \" name= \" newcat \" >
1170 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').addCategory() \" >" .
1171 __ ( 'Create category' ). "</button></div>" ;
1173 $result = db_query ( $this -> link
, "SELECT title,id FROM ttrss_feed_categories
1174 WHERE owner_uid = " . $_SESSION [ "uid" ]. "
1177 if ( db_num_rows ( $result ) != 0 ) {
1179 print "<div class= \" prefFeedCatHolder \" >" ;
1181 print "<table width= \" 100% \" class= \" prefFeedCatList \"
1182 cellspacing= \" 0 \" id= \" prefFeedCatList \" >" ;
1186 while ( $line = db_fetch_assoc ( $result )) {
1188 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
1190 $cat_id = $line [ "id" ];
1191 $this_row_id = "id= \" FCATR- $cat_id\" " ;
1193 print "<tr class= \"\" $this_row_id >" ;
1195 $edit_title = htmlspecialchars ( $line [ "title" ]);
1197 print "<td width='5%' align='center'><input
1198 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
1199 type= \" checkbox \" ></td>" ;
1203 print "<span dojoType= \" dijit.InlineEditBox \"
1204 width= \" 300px \" autoSave= \" false \"
1205 cat-id= \" $cat_id\" >" . $edit_title .
1206 "<script type= \" dojo/method \" event= \" onChange \" args= \" item \" >
1210 content: {op: 'pref-feeds', method: 'editCats',
1213 cid: this.srcNodeRef.getAttribute('cat-id')},
1214 load: function(response) {
1215 elem.attr('value', response);
1231 print "<p>" . __ ( 'No feed categories defined.' ). "</p>" ;
1234 print "<div class='dlgButtons'>
1235 <div style='float : left'>
1236 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').removeSelected() \" >" .
1237 __ ( 'Remove selected categories' ). "</button>
1240 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').hide() \" >" .
1241 __ ( 'Close this window' ). "</button></div>" ;
1249 print "<div dojoType= \" dijit.layout.AccordionContainer \" region= \" center \" >" ;
1250 print "<div id= \" pref-feeds-feeds \" dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Feeds' ). " \" >" ;
1252 $result = db_query ( $this -> link
, "SELECT COUNT(id) AS num_errors
1253 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
1255 $num_errors = db_fetch_result ( $result , 0 , "num_errors" );
1257 if ( $num_errors > 0 ) {
1259 $error_button = "<button dojoType= \" dijit.form.Button \"
1260 onclick= \" showFeedsWithErrors() \" id= \" errorButton \" >" .
1261 __ ( "Feeds with errors" ) . "</button>" ;
1264 if ( DB_TYPE
== "pgsql" ) {
1265 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
1267 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
1270 $result = db_query ( $this -> link
, "SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE
1271 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
1272 ttrss_entries.id = ref_id AND
1273 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart AND
1274 ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]);
1276 $num_inactive = db_fetch_result ( $result , 0 , "num_inactive" );
1278 if ( $num_inactive > 0 ) {
1279 $inactive_button = "<button dojoType= \" dijit.form.Button \"
1280 onclick= \" showInactiveFeeds() \" >" .
1281 __ ( "Inactive feeds" ) . "</button>" ;
1284 $feed_search = db_escape_string ( $_REQUEST [ "search" ]);
1286 if ( array_key_exists ( "search" , $_REQUEST )) {
1287 $_SESSION [ "prefs_feed_search" ] = $feed_search ;
1289 $feed_search = $_SESSION [ "prefs_feed_search" ];
1292 print '<div dojoType="dijit.layout.BorderContainer" gutters="false">' ;
1294 print "<div region='top' dojoType= \" dijit.Toolbar \" >" ; #toolbar
1296 print "<div style='float : right; padding-right : 4px;'>
1297 <input dojoType= \" dijit.form.TextBox \" id= \" feed_search \" size= \" 20 \" type= \" search \"
1298 value= \" $feed_search\" >
1299 <button dojoType= \" dijit.form.Button \" onclick= \" updateFeedList() \" >" .
1300 __ ( 'Search' ). "</button>
1303 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1304 "<span>" . __ ( 'Select' ). "</span>" ;
1305 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1306 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(true) \"
1307 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
1308 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(false) \"
1309 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
1310 print "</div></div>" ;
1312 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1313 "<span>" . __ ( 'Feeds' ). "</span>" ;
1314 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1315 print "<div onclick= \" quickAddFeed() \"
1316 dojoType= \" dijit.MenuItem \" >" . __ ( 'Subscribe to feed' ). "</div>" ;
1317 print "<div onclick= \" editSelectedFeed() \"
1318 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit selected feeds' ). "</div>" ;
1319 print "<div onclick= \" resetFeedOrder() \"
1320 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1321 print "<div onclick= \" batchSubscribe() \"
1322 dojoType= \" dijit.MenuItem \" >" . __ ( 'Batch subscribe' ). "</div>" ;
1323 print "</div></div>" ;
1325 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
1326 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1327 "<span>" . __ ( 'Categories' ). "</span>" ;
1328 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1329 print "<div onclick= \" editFeedCats() \"
1330 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit categories' ). "</div>" ;
1331 print "<div onclick= \" resetCatOrder() \"
1332 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1333 print "</div></div>" ;
1337 print $error_button ;
1338 print $inactive_button ;
1340 print "<button dojoType= \" dijit.form.Button \" onclick= \" removeSelectedFeeds() \" >"
1341 . __ ( 'Unsubscribe' ). "</button dojoType= \" dijit.form.Button \" > " ;
1343 if ( defined ( '_ENABLE_FEED_DEBUGGING' )) {
1345 print "<select id= \" feedActionChooser \" onchange= \" feedActionChange() \" >
1346 <option value= \" facDefault \" selected>" . __ ( 'More actions...' ). "</option>" ;
1348 if ( FORCE_ARTICLE_PURGE
== 0 ) {
1350 "<option value= \" facPurge \" >" . __ ( 'Manual purge' ). "</option>" ;
1354 <option value= \" facClear \" >" . __ ( 'Clear feed data' ). "</option>
1355 <option value= \" facRescore \" >" . __ ( 'Rescore articles' ). "</option>" ;
1361 print "</div>" ; # toolbar
1364 print '<div dojoType="dijit.layout.ContentPane" region="center">' ;
1366 print "<div id= \" feedlistLoading \" >
1367 <img src='images/indicator_tiny.gif'>" .
1368 __ ( "Loading, please wait..." ). "</div>" ;
1370 print "<div dojoType= \" fox.PrefFeedStore \" jsId= \" feedStore \"
1371 url= \" backend.php?op=pref-feeds&method=getfeedtree \" >
1373 <div dojoType= \" lib.CheckBoxStoreModel \" jsId= \" feedModel \" store= \" feedStore \"
1374 query= \" {id:'root'} \" rootId= \" root \" rootLabel= \" Feeds \"
1375 childrenAttrs= \" items \" checkboxStrict= \" false \" checkboxAll= \" false \" >
1377 <div dojoType= \" fox.PrefFeedTree \" id= \" feedTree \"
1378 dndController= \" dijit.tree.dndSource \"
1379 betweenThreshold= \" 5 \"
1380 model= \" feedModel \" openOnClick= \" false \" >
1381 <script type= \" dojo/method \" event= \" onClick \" args= \" item \" >
1382 var id = String(item.id);
1383 var bare_id = id.substr(id.indexOf(':')+1);
1385 if (id.match('FEED:')) {
1387 } else if (id.match('CAT:')) {
1388 editCat(bare_id, item);
1391 <script type= \" dojo/method \" event= \" onLoad \" args= \" item \" >
1392 Element.hide( \" feedlistLoading \" );
1396 print "<div dojoType= \" dijit.Tooltip \" connectId= \" feedTree \" position= \" below \" >
1397 " . __ ( '<b>Hint:</b> you can drag feeds and categories around.' ). "
1403 print "</div>" ; # feeds pane
1405 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Import and export' ). " \" >" ;
1407 print "<h3>" . __ ( "OPML" ) . "</h3>" ;
1409 print "<p>" . __ ( "Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings." ) . " " ;
1411 print __ ( "Only main settings profile can be migrated using OPML." ) . "</p>" ;
1413 print "<iframe id= \" upload_iframe \"
1414 name= \" upload_iframe \" onload= \" opmlImportComplete(this) \"
1415 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
1417 print "<form name= \" opml_form \" style='display : block' target= \" upload_iframe \"
1418 enctype= \" multipart/form-data \" method= \" POST \"
1419 action= \" backend.php \" >
1420 <input id= \" opml_file \" name= \" opml_file \" type= \" file \" >
1421 <input type= \" hidden \" name= \" op \" value= \" dlg \" >
1422 <input type= \" hidden \" name= \" method \" value= \" importOpml \" >
1423 <button dojoType= \" dijit.form.Button \" onclick= \" return opmlImport(); \" type= \" submit \" >" .
1424 __ ( 'Import my OPML' ) . "</button>" ;
1428 print "<p>" . __ ( 'Filename:' ) .
1429 " <input type= \" text \" id= \" filename \" value= \" TinyTinyRSS.opml \" /> " .
1430 __ ( 'Include settings' ) . "<input type= \" checkbox \" id= \" settings \" checked= \" 1 \" />" ;
1432 print "</p><button dojoType= \" dijit.form.Button \"
1433 onclick= \" gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked) \" >" .
1434 __ ( 'Export OPML' ) . "</button></p></form>" ;
1438 print "<p>" . __ ( 'Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.' ) . " " ;
1440 print __ ( "Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds." ) . "</p>" ;
1442 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('pubOPMLUrl') \" >" .
1443 __ ( 'Display published OPML URL' ). "</button> " ;
1446 print "<h3>" . __ ( "Article archive" ) . "</h3>" ;
1448 print "<p>" . __ ( "You can export and import your Starred and Archived articles for safekeeping or when migrating between tt-rss instances." ) . "</p>" ;
1450 print "<button dojoType= \" dijit.form.Button \" onclick= \" return exportData() \" >" .
1451 __ ( 'Export my data' ). "</button> " ;
1455 print "<iframe id= \" data_upload_iframe \"
1456 name= \" data_upload_iframe \" onload= \" dataImportComplete(this) \"
1457 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
1459 print "<form name= \" import_form \" style='display : block' target= \" data_upload_iframe \"
1460 enctype= \" multipart/form-data \" method= \" POST \"
1461 action= \" backend.php \" >
1462 <input id= \" export_file \" name= \" export_file \" type= \" file \" >
1463 <input type= \" hidden \" name= \" op \" value= \" dlg \" >
1464 <input type= \" hidden \" name= \" method \" value= \" dataimport \" >
1465 <button dojoType= \" dijit.form.Button \" onclick= \" return importData(); \" type= \" submit \" >" .
1466 __ ( 'Import' ) . "</button>" ;
1469 print "</div>" ; # pane
1471 if ( strpos ( $_SERVER [ 'HTTP_USER_AGENT' ], "Firefox" ) !== false ) {
1473 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Firefox integration' ). " \" >" ;
1475 print "<p>" . __ ( 'This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.' ) . "</p>" ;
1479 print "<button onclick='window.navigator.registerContentHandler(" .
1480 " \" application/vnd.mozilla.maybe.feed \" , " .
1481 " \" " . add_feed_url () . " \" , " . " \" Tiny Tiny RSS \" )'>" .
1482 __ ( 'Click here to register this site as a feed reader.' ) .
1487 print "</div>" ; # pane
1490 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Subscribing using bookmarklet' ). " \" >" ;
1492 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>" ;
1494 $bm_subscribe_url = str_replace ( ' %s ' , '' , add_feed_url ());
1496 $confirm_str = __ ( 'Subscribe to %s in Tiny Tiny RSS?' );
1498 $bm_url = htmlspecialchars ( "javascript:{if(confirm(' $confirm_str '.replace(' %s ',window.location.href)))window.location.href=' $bm_subscribe_url '+window.location.href}" );
1500 print "<a href= \" $bm_url\" class='bookmarklet'>" . __ ( 'Subscribe in Tiny Tiny RSS' ). "</a>" ;
1502 print "</div>" ; #pane
1504 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Published & shared articles / Generated feeds' ). " \" >" ;
1506 print "<h3>" . __ ( "Published articles and generated feeds" ) . "</h3>" ;
1508 print "<p>" . __ ( 'Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.' ). "</p>" ;
1510 $rss_url = '-2::' . htmlspecialchars ( get_self_url_prefix () .
1511 "/public.php?op=rss&id=-2&view-mode=all_articles" );;
1513 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('generatedFeed', ' $rss_url ') \" >" .
1514 __ ( 'Display URL' ). "</button> " ;
1516 print "<button dojoType= \" dijit.form.Button \" onclick= \" return clearFeedAccessKeys() \" >" .
1517 __ ( 'Clear all generated URLs' ). "</button> " ;
1519 print "<h3>" . __ ( "Articles shared by URL" ) . "</h3>" ;
1521 print "<p>" . __ ( "You can disable all articles shared by unique URLs here." ) . "</p>" ;
1523 print "<button dojoType= \" dijit.form.Button \" onclick= \" return clearArticleAccessKeys() \" >" .
1524 __ ( 'Unshare all articles' ). "</button> " ;
1526 print "</div>" ; #pane
1528 if ( defined ( 'CONSUMER_KEY' ) && CONSUMER_KEY
!= '' ) {
1530 print "<div id= \" pref-feeds-twitter \" dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Twitter' ). " \" >" ;
1532 $result = db_query ( $this -> link
, "SELECT COUNT(*) AS cid FROM ttrss_users
1533 WHERE twitter_oauth IS NOT NULL AND twitter_oauth != '' AND
1534 id = " . $_SESSION [ 'uid' ]);
1536 $is_registered = db_fetch_result ( $result , 0 , "cid" ) != 0 ;
1538 if (! $is_registered ) {
1539 print_notice ( __ ( 'Before you can update your Twitter feeds, you must register this instance of Tiny Tiny RSS with Twitter.com.' ));
1541 print_notice ( __ ( 'You have been successfully registered with Twitter.com and should be able to access your Twitter feeds.' ));
1544 print "<button dojoType= \" dijit.form.Button \" onclick= \" window.location.href = 'twitter.php?op=register' \" >" .
1545 __ ( "Register with Twitter.com" ). "</button>" ;
1549 print "<button dojoType= \" dijit.form.Button \"
1550 onclick= \" return clearTwitterCredentials() \" >" .
1551 __ ( "Clear stored credentials" ). "</button>" ;
1553 print "</div>" ; # pane
1557 print "</div>" ; #container