]>
git.wh0rd.org - tt-rss.git/blob - modules/pref-feeds.php
3 function batch_edit_cbox ( $elem , $label = false ) {
4 print "<input type= \" checkbox \" title= \" " . __ ( "Check to enable field" ). " \"
5 onchange= \" dijit.byId('feedEditDlg').toggleField(this, ' $elem ', ' $label ') \" >" ;
8 function module_pref_feeds ( $link ) {
10 global $update_intervals ;
11 global $purge_intervals ;
12 global $update_methods ;
14 $subop = $_REQUEST [ "subop" ];
15 $quiet = $_REQUEST [ "quiet" ];
16 $mode = $_REQUEST [ "mode" ];
18 if ( $subop == "renamecat" ) {
19 $title = db_escape_string ( $_REQUEST [ 'title' ]);
20 $id = db_escape_string ( $_REQUEST [ 'id' ]);
23 db_query ( $link , "UPDATE ttrss_feed_categories SET
24 title = ' $title ' WHERE id = ' $id ' AND owner_uid = " . $_SESSION [ "uid" ]);
29 if ( $subop == "remtwitterinfo" ) {
31 db_query ( $link , "UPDATE ttrss_users SET twitter_oauth = NULL
32 WHERE id = " . $_SESSION [ 'uid' ]);
37 if ( $subop == "getfeedtree" ) {
41 $root [ 'name' ] = __ ( 'Feeds' );
42 $root [ 'items' ] = array ();
43 $root [ 'type' ] = 'category' ;
45 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
47 $result = db_query ( $link , "SELECT id, title FROM ttrss_feed_categories
48 WHERE owner_uid = " . $_SESSION [ "uid" ] . " ORDER BY order_id, title" );
50 while ( $line = db_fetch_assoc ( $result )) {
52 $cat [ 'id' ] = 'CAT:' . $line [ 'id' ];
53 $cat [ 'bare_id' ] = $feed_id ;
54 $cat [ 'name' ] = $line [ 'title' ];
55 $cat [ 'items' ] = array ();
56 $cat [ 'type' ] = 'category' ;
58 $feed_result = db_query ( $link , "SELECT id, title, last_error,
59 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
61 WHERE cat_id = '" . $line [ 'id' ]. "' AND owner_uid = " . $_SESSION [ "uid" ].
62 " ORDER BY order_id, title" );
64 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
66 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
67 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
68 $feed [ 'name' ] = $feed_line [ 'title' ];
69 $feed [ 'checkbox' ] = false ;
70 $feed [ 'error' ] = $feed_line [ 'last_error' ];
71 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
72 $feed [ 'param' ] = make_local_datetime ( $link ,
73 $feed_line [ 'last_updated' ], true );
75 array_push ( $cat [ 'items' ], $feed );
78 array_push ( $root [ 'items' ], $cat );
81 /* Uncategorized is a special case */
86 $cat [ 'name' ] = __ ( "Uncategorized" );
87 $cat [ 'items' ] = array ();
88 $cat [ 'type' ] = 'category' ;
90 $feed_result = db_query ( $link , "SELECT id, title,last_error,
91 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
93 WHERE cat_id IS NULL AND owner_uid = " . $_SESSION [ "uid" ].
94 " ORDER BY order_id, title" );
96 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
98 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
99 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
100 $feed [ 'name' ] = $feed_line [ 'title' ];
101 $feed [ 'checkbox' ] = false ;
102 $feed [ 'error' ] = $feed_line [ 'last_error' ];
103 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
104 $feed [ 'param' ] = make_local_datetime ( $link ,
105 $feed_line [ 'last_updated' ], true );
107 array_push ( $cat [ 'items' ], $feed );
110 array_push ( $root [ 'items' ], $cat );
112 $feed_result = db_query ( $link , "SELECT id, title, last_error,
113 " . SUBSTRING_FOR_DATE
. "(last_updated,1,19) AS last_updated
115 WHERE owner_uid = " . $_SESSION [ "uid" ].
116 " ORDER BY order_id, title" );
118 while ( $feed_line = db_fetch_assoc ( $feed_result )) {
120 $feed [ 'id' ] = 'FEED:' . $feed_line [ 'id' ];
121 $feed [ 'bare_id' ] = $feed_line [ 'id' ];
122 $feed [ 'name' ] = $feed_line [ 'title' ];
123 $feed [ 'checkbox' ] = false ;
124 $feed [ 'error' ] = $feed_line [ 'last_error' ];
125 $feed [ 'icon' ] = getFeedIcon ( $feed_line [ 'id' ]);
126 $feed [ 'param' ] = make_local_datetime ( $link ,
127 $feed_line [ 'last_updated' ], true );
129 array_push ( $root [ 'items' ], $feed );
134 $fl [ 'identifier' ] = 'id' ;
135 $fl [ 'label' ] = 'name' ;
136 $fl [ 'items' ] = array ( $root );
138 print json_encode ( $fl );
142 if ( $subop == "catsortreset" ) {
143 db_query ( $link , "UPDATE ttrss_feed_categories
144 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
148 if ( $subop == "feedsortreset" ) {
149 db_query ( $link , "UPDATE ttrss_feeds
150 SET order_id = 0 WHERE owner_uid = " . $_SESSION [ "uid" ]);
154 if ( $subop == "savefeedorder" ) {
155 # if ($_POST['payload']) {
156 # file_put_contents("/tmp/blahblah.txt", $_POST['payload']);
157 # $data = json_decode($_POST['payload'], true);
159 # $data = json_decode(file_get_contents("/tmp/blahblah.txt"), true);
162 $data = json_decode ( $_POST [ 'payload' ], true );
164 if ( is_array ( $data ) && is_array ( $data [ 'items' ])) {
169 foreach ( $data [ 'items' ] as $item ) {
171 if ( $item [ 'id' ] != 'root' ) {
172 if ( is_array ( $item [ 'items' ])) {
173 if ( isset ( $item [ 'items' ][ '_reference' ])) {
174 $data_map [ $item [ 'id' ]] = array ( $item [ 'items' ]);
176 $data_map [ $item [ 'id' ]] =& $item [ 'items' ];
182 foreach ( $data [ 'items' ][ 0 ][ 'items' ] as $item ) {
183 $id = $item [ '_reference' ];
184 $bare_id = substr ( $id , strpos ( $id , ':' ) +
1 );
189 db_query ( $link , "UPDATE ttrss_feed_categories
190 SET order_id = ' $cat_order_id ' WHERE id = ' $bare_id ' AND
191 owner_uid = " . $_SESSION [ "uid" ]);
196 if ( is_array ( $data_map [ $id ])) {
197 foreach ( $data_map [ $id ] as $feed ) {
198 $id = $feed [ '_reference' ];
199 $feed_id = substr ( $id , strpos ( $id , ':' ) +
1 );
202 $cat_query = "cat_id = ' $bare_id '" ;
204 $cat_query = "cat_id = NULL" ;
206 db_query ( $link , "UPDATE ttrss_feeds
207 SET order_id = ' $feed_order_id ',
209 WHERE id = ' $feed_id ' AND
210 owner_uid = " . $_SESSION [ "uid" ]);
221 if ( $subop == "removeicon" ) {
222 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
224 $result = db_query ( $link , "SELECT id FROM ttrss_feeds
225 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
227 if ( db_num_rows ( $result ) != 0 ) {
228 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
234 if ( $subop == "uploadicon" ) {
235 $icon_file = $_FILES [ 'icon_file' ][ 'tmp_name' ];
236 $feed_id = db_escape_string ( $_REQUEST [ "feed_id" ]);
238 if ( is_file ( $icon_file ) && $feed_id ) {
239 if ( filesize ( $icon_file ) < 20000 ) {
241 $result = db_query ( $link , "SELECT id FROM ttrss_feeds
242 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
244 if ( db_num_rows ( $result ) != 0 ) {
245 unlink ( ICONS_DIR
. "/ $feed_id .ico" );
246 move_uploaded_file ( $icon_file , ICONS_DIR
. "/ $feed_id .ico" );
258 print "<script type= \" text/javascript \" >" ;
259 print "parent.uploadIconHandler( $rc );" ;
264 if ( $subop == "editfeed" ) {
266 $feed_id = db_escape_string ( $_REQUEST [ "id" ]);
268 $result = db_query ( $link ,
269 "SELECT * FROM ttrss_feeds WHERE id = ' $feed_id ' AND
270 owner_uid = " . $_SESSION [ "uid" ]);
272 $title = htmlspecialchars ( db_fetch_result ( $result ,
275 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $feed_id\" >" ;
276 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-feeds \" >" ;
277 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" subop \" value= \" editSave \" >" ;
279 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
280 print "<div class= \" dlgSecCont \" >" ;
284 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
285 placeHolder= \" " . __ ( "Feed Title" ). " \"
286 style= \" font-size : 16px; width: 20em \" name= \" title \" value= \" $title\" >" ;
290 $feed_url = db_fetch_result ( $result , 0 , "feed_url" );
291 $feed_url = htmlspecialchars ( db_fetch_result ( $result ,
296 print __ ( 'URL:' ) . " " ;
297 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
298 placeHolder= \" " . __ ( "Feed URL" ). " \"
299 regExp='^(http|https)://.*' style= \" width : 20em \"
300 name= \" feed_url \" value= \" $feed_url\" >" ;
304 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
306 $cat_id = db_fetch_result ( $result , 0 , "cat_id" );
310 print __ ( 'Place in category:' ) . " " ;
312 print_feed_cat_select ( $link , "cat_id" , $cat_id ,
313 'dojoType="dijit.form.Select"' );
318 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
319 print "<div class= \" dlgSecCont \" >" ;
321 /* Update Interval */
323 $update_interval = db_fetch_result ( $result , 0 , "update_interval" );
325 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
326 'dojoType="dijit.form.Select"' );
330 $update_method = db_fetch_result ( $result , 0 , "update_method" ,
331 'dojoType="dijit.form.Select"' );
333 print " " . __ ( 'using' ) . " " ;
334 print_select_hash ( "update_method" , $update_method , $update_methods ,
335 'dojoType="dijit.form.Select"' );
337 $purge_interval = db_fetch_result ( $result , 0 , "purge_interval" );
339 if ( FORCE_ARTICLE_PURGE
== 0 ) {
345 print __ ( 'Article purging:' ) . " " ;
347 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
348 'dojoType="dijit.form.Select"' );
351 print "<input style= \" display : none \" name='purge_interval'
352 dojoType= \" dijit.form.TextBox \" value=' $purge_interval '>" ;
357 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
358 print "<div class= \" dlgSecCont \" >" ;
360 $auth_login = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_login" ));
364 # print "<tr><td>" . __('Login:') . "</td><td>";
366 print "<input dojoType= \" dijit.form.TextBox \" id= \" feedEditDlg_login \"
367 placeHolder= \" " . __ ( "Login" ). " \"
368 name= \" auth_login \" value= \" $auth_login\" ><hr/>" ;
370 # print "</tr><tr><td>" . __("Password:") . "</td><td>";
372 $auth_pass = htmlspecialchars ( db_fetch_result ( $result , 0 , "auth_pass" ));
374 print "<input dojoType= \" dijit.form.TextBox \" type= \" password \" name= \" auth_pass \"
375 placeHolder= \" " . __ ( "Password" ). " \"
376 value= \" $auth_pass\" >" ;
378 print "<div dojoType= \" dijit.Tooltip \" connectId= \" feedEditDlg_login \" position= \" below \" >
379 " . __ ( '<b>Hint:</b> you need to fill in your login information if your feed requires authentication, except for Twitter feeds.' ). "
382 # print "</td></tr></table>";
385 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
386 print "<div class= \" dlgSecCont \" >" ;
388 # print "<div style=\"line-height : 100%\">";
390 $private = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "private" ));
393 $checked = "checked= \" 1 \" " ;
398 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" private \" id= \" private \"
399 $checked > <label for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
401 $rtl_content = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "rtl_content" ));
404 $checked = "checked= \" 1 \" " ;
409 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
410 $checked > <label for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
412 $include_in_digest = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "include_in_digest" ));
414 if ( $include_in_digest ) {
415 $checked = "checked= \" 1 \" " ;
420 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" include_in_digest \"
421 name= \" include_in_digest \"
422 $checked > <label for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
425 $always_display_enclosures = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "always_display_enclosures" ));
427 if ( $always_display_enclosures ) {
428 $checked = "checked" ;
433 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" always_display_enclosures \"
434 name= \" always_display_enclosures \"
435 $checked > <label for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
438 $cache_images = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "cache_images" ));
441 $checked = "checked= \" 1 \" " ;
446 if ( SIMPLEPIE_CACHE_IMAGES
) {
447 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" cache_images \"
448 name= \" cache_images \"
449 $checked > <label for= \" cache_images \" >" .
450 __ ( 'Cache images locally (SimplePie only)' ). "</label>" ;
453 $mark_unread_on_update = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "mark_unread_on_update" ));
455 if ( $mark_unread_on_update ) {
456 $checked = "checked" ;
461 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" mark_unread_on_update \"
462 name= \" mark_unread_on_update \"
463 $checked > <label for= \" mark_unread_on_update \" >" . __ ( 'Mark updated articles as unread' ). "</label>" ;
465 $update_on_checksum_change = sql_bool_to_bool ( db_fetch_result ( $result , 0 , "update_on_checksum_change" ));
467 if ( $update_on_checksum_change ) {
468 $checked = "checked" ;
473 print "<hr/><input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" id= \" update_on_checksum_change \"
474 name= \" update_on_checksum_change \"
475 $checked > <label for= \" update_on_checksum_change \" >" . __ ( 'Mark posts as updated on content change' ). "</label>" ;
482 print "<div class= \" dlgSec \" >" . __ ( "Icon" ). "</div>" ;
483 print "<div class= \" dlgSecCont \" >" ;
485 print "<iframe name= \" icon_upload_iframe \"
486 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
488 print "<form style='display : block' target= \" icon_upload_iframe \"
489 enctype= \" multipart/form-data \" method= \" POST \"
490 action= \" backend.php \" >
491 <input id= \" icon_file \" size= \" 10 \" name= \" icon_file \" type= \" file \" >
492 <input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >
493 <input type= \" hidden \" name= \" feed_id \" value= \" $feed_id\" >
494 <input type= \" hidden \" name= \" subop \" value= \" uploadicon \" >
495 <button dojoType= \" dijit.form.Button \" onclick= \" return uploadFeedIcon(); \"
496 type= \" submit \" >" . __ ( 'Replace' ). "</button>
497 <button dojoType= \" dijit.form.Button \" onclick= \" return removeFeedIcon( $feed_id ); \"
498 type= \" submit \" >" . __ ( 'Remove' ). "</button>
503 $title = htmlspecialchars ( $title , ENT_QUOTES
);
505 print "<div class='dlgButtons'>
506 <div style= \" float : left \" >
507 <button dojoType= \" dijit.form.Button \" onclick='return unsubscribeFeed( $feed_id , \" $title\" )'>" .
508 __ ( 'Unsubscribe' ). "</button>" ;
510 $pubsub_state = db_fetch_result ( $result , 0 , "pubsub_state" );
512 $pubsub_btn_disabled = ( $pubsub_state == 2 ) ?
"" : "disabled= \" 1 \" " ;
514 print "<button dojoType= \" dijit.form.Button \" id= \" pubsubReset_Btn \" $pubsub_btn_disabled
515 onclick='return resetPubSub( $feed_id , \" $title\" )'>" . __ ( 'Resubscribe to push updates' ).
520 print "<div dojoType= \" dijit.Tooltip \" connectId= \" pubsubReset_Btn \" position= \" below \" >" .
521 __ ( 'Resets PubSubHubbub subscription status for push-enabled feeds.' ). "</div>" ;
523 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedEditDlg').execute() \" >" . __ ( 'Save' ). "</button>
524 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedEditDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
530 if ( $subop == "editfeeds" ) {
532 $feed_ids = db_escape_string ( $_REQUEST [ "ids" ]);
534 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" ids \" value= \" $feed_ids\" >" ;
535 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-feeds \" >" ;
536 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" subop \" value= \" batchEditSave \" >" ;
538 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
539 print "<div class= \" dlgSecCont \" >" ;
543 print "<input dojoType= \" dijit.form.ValidationTextBox \"
544 disabled= \" 1 \" style= \" font-size : 16px; width : 20em; \" required= \" 1 \"
545 name= \" title \" value= \" $title\" >" ;
547 batch_edit_cbox ( "title" );
553 print __ ( 'URL:' ) . " " ;
554 print "<input dojoType= \" dijit.form.ValidationTextBox \" disabled= \" 1 \"
555 required= \" 1 \" regExp='^(http|https)://.*' style= \" width : 20em \"
556 name= \" feed_url \" value= \" $feed_url\" >" ;
558 batch_edit_cbox ( "feed_url" );
562 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
566 print __ ( 'Place in category:' ) . " " ;
568 print_feed_cat_select ( $link , "cat_id" , $cat_id ,
569 'disabled="1" dojoType="dijit.form.Select"' );
571 batch_edit_cbox ( "cat_id" );
577 print "<div class= \" dlgSec \" >" . __ ( "Update" ). "</div>" ;
578 print "<div class= \" dlgSecCont \" >" ;
580 /* Update Interval */
582 print_select_hash ( "update_interval" , $update_interval , $update_intervals ,
583 'disabled="1" dojoType="dijit.form.Select"' );
585 batch_edit_cbox ( "update_interval" );
589 print " " . __ ( 'using' ) . " " ;
590 print_select_hash ( "update_method" , $update_method , $update_methods ,
591 'disabled="1" dojoType="dijit.form.Select"' );
592 batch_edit_cbox ( "update_method" );
596 if ( FORCE_ARTICLE_PURGE
== 0 ) {
600 print __ ( 'Article purging:' ) . " " ;
602 print_select_hash ( "purge_interval" , $purge_interval , $purge_intervals ,
603 'disabled="1" dojoType="dijit.form.Select"' );
605 batch_edit_cbox ( "purge_interval" );
609 print "<div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>" ;
610 print "<div class= \" dlgSecCont \" >" ;
612 print "<input dojoType= \" dijit.form.TextBox \"
613 placeHolder= \" " . __ ( "Login" ). " \" disabled= \" 1 \"
614 name= \" auth_login \" value= \" $auth_login\" >" ;
616 batch_edit_cbox ( "auth_login" );
618 print "<br/><input dojoType= \" dijit.form.TextBox \" type= \" password \" name= \" auth_pass \"
619 placeHolder= \" " . __ ( "Password" ). " \" disabled= \" 1 \"
620 value= \" $auth_pass\" >" ;
622 batch_edit_cbox ( "auth_pass" );
625 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
626 print "<div class= \" dlgSecCont \" >" ;
628 print "<input disabled= \" 1 \" type= \" checkbox \" name= \" private \" id= \" private \"
629 dojoType= \" dijit.form.CheckBox \" > <label id= \" private_l \" class='insensitive' for= \" private \" >" . __ ( 'Hide from Popular feeds' ). "</label>" ;
631 print " " ; batch_edit_cbox ( "private" , "private_l" );
633 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" rtl_content \" name= \" rtl_content \"
634 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" rtl_content_l \" for= \" rtl_content \" >" . __ ( 'Right-to-left content' ). "</label>" ;
636 print " " ; batch_edit_cbox ( "rtl_content" , "rtl_content_l" );
638 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" include_in_digest \"
639 name= \" include_in_digest \"
640 dojoType= \" dijit.form.CheckBox \" > <label id= \" include_in_digest_l \" class='insensitive' for= \" include_in_digest \" >" . __ ( 'Include in e-mail digest' ). "</label>" ;
642 print " " ; batch_edit_cbox ( "include_in_digest" , "include_in_digest_l" );
644 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" always_display_enclosures \"
645 name= \" always_display_enclosures \"
646 dojoType= \" dijit.form.CheckBox \" > <label id= \" always_display_enclosures_l \" class='insensitive' for= \" always_display_enclosures \" >" . __ ( 'Always display image attachments' ). "</label>" ;
648 print " " ; batch_edit_cbox ( "always_display_enclosures" , "always_display_enclosures_l" );
650 if ( SIMPLEPIE_CACHE_IMAGES
) {
651 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" cache_images \"
652 name= \" cache_images \"
653 dojoType= \" dijit.form.CheckBox \" > <label class='insensitive' id= \" cache_images_l \"
654 for= \" cache_images \" >" .
655 __ ( 'Cache images locally' ). "</label>" ;
658 print " " ; batch_edit_cbox ( "cache_images" , "cache_images_l" );
661 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" mark_unread_on_update \"
662 name= \" mark_unread_on_update \"
663 dojoType= \" dijit.form.CheckBox \" > <label id= \" mark_unread_on_update_l \" class='insensitive' for= \" mark_unread_on_update \" >" . __ ( 'Mark updated articles as unread' ). "</label>" ;
665 print " " ; batch_edit_cbox ( "mark_unread_on_update" , "mark_unread_on_update_l" );
667 print "<br/><input disabled= \" 1 \" type= \" checkbox \" id= \" update_on_checksum_change \"
668 name= \" update_on_checksum_change \"
669 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>" ;
671 print " " ; batch_edit_cbox ( "update_on_checksum_change" , "update_on_checksum_change_l" );
675 print "<div class='dlgButtons'>
676 <button dojoType= \" dijit.form.Button \"
677 onclick= \" return dijit.byId('feedEditDlg').execute() \" >" .
678 __ ( 'Save' ). "</button>
679 <button dojoType= \" dijit.form.Button \"
680 onclick= \" return dijit.byId('feedEditDlg').hide() \" >" .
681 __ ( 'Cancel' ). "</button>
687 if ( $subop == "editSave" ||
$subop == "batchEditSave" ) {
689 $feed_title = db_escape_string ( trim ( $_POST [ "title" ]));
690 $feed_link = db_escape_string ( trim ( $_POST [ "feed_url" ]));
691 $upd_intl = db_escape_string ( $_POST [ "update_interval" ]);
692 $purge_intl = db_escape_string ( $_POST [ "purge_interval" ]);
693 $feed_id = db_escape_string ( $_POST [ "id" ]); /* editSave */
694 $feed_ids = db_escape_string ( $_POST [ "ids" ]); /* batchEditSave */
695 $cat_id = db_escape_string ( $_POST [ "cat_id" ]);
696 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
697 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
698 $private = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "private" ]));
699 $rtl_content = checkbox_to_sql_bool ( db_escape_string ( $_POST [ "rtl_content" ]));
700 $include_in_digest = checkbox_to_sql_bool (
701 db_escape_string ( $_POST [ "include_in_digest" ]));
702 $cache_images = checkbox_to_sql_bool (
703 db_escape_string ( $_POST [ "cache_images" ]));
704 $update_method = ( int ) db_escape_string ( $_POST [ "update_method" ]);
706 $always_display_enclosures = checkbox_to_sql_bool (
707 db_escape_string ( $_POST [ "always_display_enclosures" ]));
709 $mark_unread_on_update = checkbox_to_sql_bool (
710 db_escape_string ( $_POST [ "mark_unread_on_update" ]));
712 $update_on_checksum_change = checkbox_to_sql_bool (
713 db_escape_string ( $_POST [ "update_on_checksum_change" ]));
715 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
716 if ( $cat_id && $cat_id != 0 ) {
717 $category_qpart = "cat_id = ' $cat_id '," ;
718 $category_qpart_nocomma = "cat_id = ' $cat_id '" ;
720 $category_qpart = 'cat_id = NULL,' ;
721 $category_qpart_nocomma = 'cat_id = NULL' ;
724 $category_qpart = "" ;
725 $category_qpart_nocomma = "" ;
728 if ( SIMPLEPIE_CACHE_IMAGES
) {
729 $cache_images_qpart = "cache_images = $cache_images ," ;
731 $cache_images_qpart = "" ;
734 if ( $subop == "editSave" ) {
736 $result = db_query ( $link , "UPDATE ttrss_feeds SET
738 title = ' $feed_title ', feed_url = ' $feed_link ',
739 update_interval = ' $upd_intl ',
740 purge_interval = ' $purge_intl ',
741 auth_login = ' $auth_login ',
742 auth_pass = ' $auth_pass ',
744 rtl_content = $rtl_content ,
746 include_in_digest = $include_in_digest ,
747 always_display_enclosures = $always_display_enclosures ,
748 mark_unread_on_update = $mark_unread_on_update ,
749 update_on_checksum_change = $update_on_checksum_change ,
750 update_method = ' $update_method '
751 WHERE id = ' $feed_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
753 } else if ( $subop == "batchEditSave" ) {
754 $feed_data = array ();
756 foreach ( array_keys ( $_POST ) as $k ) {
757 if ( $k != "op" && $k != "subop" && $k != "ids" ) {
758 $feed_data [ $k ] = $_POST [ $k ];
762 db_query ( $link , "BEGIN" );
764 foreach ( array_keys ( $feed_data ) as $k ) {
770 $qpart = "title = ' $feed_title '" ;
774 $qpart = "feed_url = ' $feed_link '" ;
777 case "update_interval" :
778 $qpart = "update_interval = ' $upd_intl '" ;
781 case "purge_interval" :
782 $qpart = "purge_interval = ' $purge_intl '" ;
786 $qpart = "auth_login = ' $auth_login '" ;
790 $qpart = "auth_pass = ' $auth_pass '" ;
794 $qpart = "private = ' $private '" ;
797 case "include_in_digest" :
798 $qpart = "include_in_digest = ' $include_in_digest '" ;
801 case "always_display_enclosures" :
802 $qpart = "always_display_enclosures = ' $always_display_enclosures '" ;
805 case "mark_unread_on_update" :
806 $qpart = "mark_unread_on_update = ' $mark_unread_on_update '" ;
809 case "update_on_checksum_change" :
810 $qpart = "update_on_checksum_change = ' $update_on_checksum_change '" ;
814 $qpart = "cache_images = ' $cache_images '" ;
818 $qpart = "rtl_content = ' $rtl_content '" ;
821 case "update_method" :
822 $qpart = "update_method = ' $update_method '" ;
826 $qpart = $category_qpart_nocomma ;
833 "UPDATE ttrss_feeds SET $qpart WHERE id IN ( $feed_ids )
834 AND owner_uid = " . $_SESSION [ "uid" ]);
839 db_query ( $link , "COMMIT" );
844 if ( $subop == "resetPubSub" ) {
846 $ids = db_escape_string ( $_REQUEST [ "ids" ]);
848 db_query ( $link , "UPDATE ttrss_feeds SET pubsub_state = 0 WHERE id IN ( $ids )
849 AND owner_uid = " . $_SESSION [ "uid" ]);
854 if ( $subop == "remove" ) {
856 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
858 foreach ( $ids as $id ) {
859 remove_feed ( $link , $id , $_SESSION [ "uid" ]);
865 if ( $subop == "clear" ) {
866 $id = db_escape_string ( $_REQUEST [ "id" ]);
867 clear_feed_articles ( $link , $id );
870 if ( $subop == "rescore" ) {
871 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
873 foreach ( $ids as $id ) {
875 $filters = load_filters ( $link , $id , $_SESSION [ "uid" ], 6 );
877 $result = db_query ( $link , "SELECT
878 title, content, link, ref_id, author," .
879 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
881 ttrss_user_entries, ttrss_entries
882 WHERE ref_id = id AND feed_id = ' $id ' AND
883 owner_uid = " . $_SESSION [ 'uid' ]. "
888 while ( $line = db_fetch_assoc ( $result )) {
890 $tags = get_article_tags ( $link , $line [ "ref_id" ]);
892 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
893 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
894 $line [ 'author' ], $tags );
896 $new_score = calculate_article_score ( $article_filters );
898 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
900 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
903 foreach ( array_keys ( $scores ) as $s ) {
905 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ',
907 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
908 } else if ( $s < - 500 ) {
909 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ',
911 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
913 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
914 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
919 print __ ( "All done." );
923 if ( $subop == "rescoreAll" ) {
925 $result = db_query ( $link ,
926 "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION [ 'uid' ]);
928 while ( $feed_line = db_fetch_assoc ( $result )) {
930 $id = $feed_line [ "id" ];
932 $filters = load_filters ( $link , $id , $_SESSION [ "uid" ], 6 );
934 $tmp_result = db_query ( $link , "SELECT
935 title, content, link, ref_id, author," .
936 SUBSTRING_FOR_DATE
. "(updated, 1, 19) AS updated
938 ttrss_user_entries, ttrss_entries
939 WHERE ref_id = id AND feed_id = ' $id ' AND
940 owner_uid = " . $_SESSION [ 'uid' ]. "
945 while ( $line = db_fetch_assoc ( $tmp_result )) {
947 $tags = get_article_tags ( $link , $line [ "ref_id" ]);
949 $article_filters = get_article_filters ( $filters , $line [ 'title' ],
950 $line [ 'content' ], $line [ 'link' ], strtotime ( $line [ 'updated' ]),
951 $line [ 'author' ], $tags );
953 $new_score = calculate_article_score ( $article_filters );
955 if (! $scores [ $new_score ]) $scores [ $new_score ] = array ();
957 array_push ( $scores [ $new_score ], $line [ 'ref_id' ]);
960 foreach ( array_keys ( $scores ) as $s ) {
962 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ',
964 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
966 db_query ( $link , "UPDATE ttrss_user_entries SET score = ' $s ' WHERE
967 ref_id IN (" . join ( ',' , $scores [ $s ]) . ")" );
972 print __ ( "All done." );
976 if ( $subop == "add" ) {
978 $feed_url = db_escape_string ( trim ( $_REQUEST [ "feed_url" ]));
979 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
980 $p_from = db_escape_string ( $_REQUEST [ "from" ]);
982 /* only read authentication information from POST */
984 $auth_login = db_escape_string ( trim ( $_POST [ "auth_login" ]));
985 $auth_pass = db_escape_string ( trim ( $_POST [ "auth_pass" ]));
987 if ( $p_from != 'tt-rss' ) {
988 header ( "Content-Type: text/html" );
991 <title>Tiny Tiny RSS</title>
992 <link rel= \" stylesheet \" type= \" text/css \" href= \" utility.css \" >
995 <img class= \" floatingLogo \" src= \" images/ttrss_logo.png \"
996 alt= \" Tiny Tiny RSS \" />
997 <h1>Subscribe to feed...</h1>" ;
1000 $rc = subscribe_to_feed ( $link , $feed_url , $cat_id , $auth_login , $auth_pass );
1004 print_notice ( T_sprintf ( "Subscribed to <b> %s </b>." , $feed_url ));
1007 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>." , $feed_url ));
1010 print_warning ( T_sprintf ( "Already subscribed to <b> %s </b>." , $feed_url ));
1013 print_notice ( "Multiple feed URLs found." );
1015 $feed_urls = get_feeds_from_html ( $feed_url );
1018 print_error ( T_sprintf ( "Could not subscribe to <b> %s </b>.<br>Can't download the Feed URL." , $feed_url ));
1022 if ( $p_from != 'tt-rss' ) {
1026 print "<form action= \" backend.php \" >" ;
1027 print "<input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >" ;
1028 print "<input type= \" hidden \" name= \" quiet \" value= \" 1 \" >" ;
1029 print "<input type= \" hidden \" name= \" subop \" value= \" add \" >" ;
1031 print "<select name= \" feed_url \" >" ;
1033 foreach ( $feed_urls as $url => $name ) {
1034 $url = htmlspecialchars ( $url );
1035 $name = htmlspecialchars ( $name );
1037 print "<option value= \" $url\" > $name </option>" ;
1040 print "<input type= \" submit \" value= \" " . __ ( "Subscribe to selected feed" ).
1046 $tp_uri = get_self_url_prefix () . "/prefs.php" ;
1047 $tt_uri = get_self_url_prefix ();
1050 $result = db_query ( $link , "SELECT id FROM ttrss_feeds WHERE
1051 feed_url = ' $feed_url ' AND owner_uid = " . $_SESSION [ "uid" ]);
1053 $feed_id = db_fetch_result ( $result , 0 , "id" );
1060 print "<form method= \" GET \" style='display: inline'
1062 <input type= \" hidden \" name= \" tab \" value= \" feedConfig \" >
1063 <input type= \" hidden \" name= \" subop \" value= \" editFeed \" >
1064 <input type= \" hidden \" name= \" subopparam \" value= \" $feed_id\" >
1065 <input type= \" submit \" value= \" " . __ ( "Edit subscription options" ). " \" >
1069 print "<form style='display: inline' method= \" GET \" action= \" $tt_uri\" >
1070 <input type= \" submit \" value= \" " . __ ( "Return to Tiny Tiny RSS" ). " \" >
1073 print "</body></html>" ;
1078 if ( $subop == "categorize" ) {
1081 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
1083 $cat_id = db_escape_string ( $_REQUEST [ "cat_id" ]);
1086 $cat_id_qpart = 'NULL' ;
1088 $cat_id_qpart = "' $cat_id '" ;
1091 db_query ( $link , "BEGIN" );
1093 foreach ( $ids as $id ) {
1095 db_query ( $link , "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
1097 AND owner_uid = " . $_SESSION [ "uid" ]);
1101 db_query ( $link , "COMMIT" );
1105 if ( $subop == "editCats" ) {
1107 $action = $_REQUEST [ "action" ];
1109 if ( $action == "save" ) {
1111 $cat_title = db_escape_string ( trim ( $_REQUEST [ "value" ]));
1112 $cat_id = db_escape_string ( $_REQUEST [ "cid" ]);
1114 db_query ( $link , "BEGIN" );
1116 $result = db_query ( $link , "SELECT title FROM ttrss_feed_categories
1117 WHERE id = ' $cat_id ' AND owner_uid = " . $_SESSION [ "uid" ]);
1119 if ( db_num_rows ( $result ) == 1 ) {
1121 $old_title = db_fetch_result ( $result , 0 , "title" );
1123 if ( $cat_title != "" ) {
1124 $result = db_query ( $link , "UPDATE ttrss_feed_categories SET
1125 title = ' $cat_title ' WHERE id = ' $cat_id ' AND
1126 owner_uid = " . $_SESSION [ "uid" ]);
1133 print $_REQUEST [ "value" ];
1136 db_query ( $link , "COMMIT" );
1142 if ( $action == "add" ) {
1144 $feed_cat = db_escape_string ( trim ( $_REQUEST [ "cat" ]));
1146 if (! add_feed_category ( $link , $feed_cat ))
1147 print_warning ( T_sprintf ( "Category <b>$ %s </b> already exists in the database." , $feed_cat ));
1151 if ( $action == "remove" ) {
1153 $ids = split ( "," , db_escape_string ( $_REQUEST [ "ids" ]));
1155 foreach ( $ids as $id ) {
1156 remove_feed_category ( $link , $id , $_SESSION [ "uid" ]);
1160 print "<div dojoType= \" dijit.Toolbar \" >
1161 <input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \" name= \" newcat \" >
1162 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').addCategory() \" >" .
1163 __ ( 'Create category' ). "</button></div>" ;
1165 $result = db_query ( $link , "SELECT title,id FROM ttrss_feed_categories
1166 WHERE owner_uid = " . $_SESSION [ "uid" ]. "
1171 if ( db_num_rows ( $result ) != 0 ) {
1173 print "<div class= \" prefFeedCatHolder \" >" ;
1175 # print "<form id=\"feed_cat_edit_form\" onsubmit=\"return false\">";
1177 print "<table width= \" 100% \" class= \" prefFeedCatList \"
1178 cellspacing= \" 0 \" id= \" prefFeedCatList \" >" ;
1182 while ( $line = db_fetch_assoc ( $result )) {
1184 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
1186 $cat_id = $line [ "id" ];
1187 $this_row_id = "id= \" FCATR- $cat_id\" " ;
1189 print "<tr class= \"\" $this_row_id >" ;
1191 $edit_title = htmlspecialchars ( $line [ "title" ]);
1193 print "<td width='5%' align='center'><input
1194 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
1195 type= \" checkbox \" ></td>" ;
1199 # print "<span id=\"FCATT-$cat_id\">" .
1200 # $edit_title . "</span>";
1202 print "<span dojoType= \" dijit.InlineEditBox \"
1203 width= \" 300px \" autoSave= \" false \"
1204 cat-id= \" $cat_id\" >" . $edit_title .
1205 "<script type= \" dojo/method \" event= \" onChange \" args= \" item \" >
1209 content: {op: 'pref-feeds', subop: 'editCats',
1212 cid: this.srcNodeRef.getAttribute('cat-id')},
1213 load: function(response) {
1214 elem.attr('value', response);
1233 print "<p>" . __ ( 'No feed categories defined.' ). "</p>" ;
1236 print "<div class='dlgButtons'>
1237 <div style='float : left'>
1238 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').removeSelected() \" >" .
1239 __ ( 'Remove selected categories' ). "</button>
1242 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedCatEditDlg').hide() \" >" .
1243 __ ( 'Close this window' ). "</button></div>" ;
1251 print "<div dojoType= \" dijit.layout.AccordionContainer \" region= \" center \" >" ;
1252 print "<div id= \" pref-feeds-feeds \" dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Feeds' ). " \" >" ;
1254 $result = db_query ( $link , "SELECT COUNT(id) AS num_errors
1255 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
1257 $num_errors = db_fetch_result ( $result , 0 , "num_errors" );
1259 if ( $num_errors > 0 ) {
1261 $error_button = "<button dojoType= \" dijit.form.Button \"
1262 onclick= \" showFeedsWithErrors() \" id= \" errorButton \" >" .
1263 __ ( "Feeds with errors" ) . "</button>" ;
1265 // print format_notice("<a href=\"javascript:showFeedsWithErrors()\">".
1266 // __('Some feeds have update errors (click for details)')."</a>");
1269 if ( DB_TYPE
== "pgsql" ) {
1270 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
1272 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
1275 $result = db_query ( $link , "SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE
1276 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
1277 ttrss_entries.id = ref_id AND
1278 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart AND
1279 ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]);
1281 $num_inactive = db_fetch_result ( $result , 0 , "num_inactive" );
1283 if ( $num_inactive > 0 ) {
1284 $inactive_button = "<button dojoType= \" dijit.form.Button \"
1285 onclick= \" showInactiveFeeds() \" >" .
1286 __ ( "Inactive feeds" ) . "</button>" ;
1289 $feed_search = db_escape_string ( $_REQUEST [ "search" ]);
1291 if ( array_key_exists ( "search" , $_REQUEST )) {
1292 $_SESSION [ "prefs_feed_search" ] = $feed_search ;
1294 $feed_search = $_SESSION [ "prefs_feed_search" ];
1297 print "<div dojoType= \" dijit.Toolbar \" >" ;
1299 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1300 "<span>" . __ ( 'Select' ). "</span>" ;
1301 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1302 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(true) \"
1303 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
1304 print "<div onclick= \" dijit.byId('feedTree').model.setAllChecked(false) \"
1305 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
1306 print "</div></div>" ;
1308 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1309 "<span>" . __ ( 'Feeds' ). "</span>" ;
1310 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1311 print "<div onclick= \" quickAddFeed() \"
1312 dojoType= \" dijit.MenuItem \" >" . __ ( 'Subscribe to feed' ). "</div>" ;
1313 print "<div onclick= \" editSelectedFeed() \"
1314 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit selected feeds' ). "</div>" ;
1315 print "<div onclick= \" resetFeedOrder() \"
1316 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1317 print "</div></div>" ;
1319 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
1320 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
1321 "<span>" . __ ( 'Categories' ). "</span>" ;
1322 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
1323 print "<div onclick= \" editFeedCats() \"
1324 dojoType= \" dijit.MenuItem \" >" . __ ( 'Edit categories' ). "</div>" ;
1325 print "<div onclick= \" resetCatOrder() \"
1326 dojoType= \" dijit.MenuItem \" >" . __ ( 'Reset sort order' ). "</div>" ;
1327 print "</div></div>" ;
1331 print $error_button ;
1332 print $inactive_button ;
1334 print "<button dojoType= \" dijit.form.Button \" onclick= \" removeSelectedFeeds() \" >"
1335 . __ ( 'Unsubscribe' ). "</button dojoType= \" dijit.form.Button \" > " ;
1337 if ( defined ( '_ENABLE_FEED_DEBUGGING' )) {
1339 print "<select id= \" feedActionChooser \" onchange= \" feedActionChange() \" >
1340 <option value= \" facDefault \" selected>" . __ ( 'More actions...' ). "</option>" ;
1342 if ( FORCE_ARTICLE_PURGE
== 0 ) {
1344 "<option value= \" facPurge \" >" . __ ( 'Manual purge' ). "</option>" ;
1348 <option value= \" facClear \" >" . __ ( 'Clear feed data' ). "</option>
1349 <option value= \" facRescore \" >" . __ ( 'Rescore articles' ). "</option>" ;
1355 print "</div>" ; # toolbar
1357 print "<div id= \" feedlistLoading \" >
1358 <img src='images/indicator_tiny.gif'>" .
1359 __ ( "Loading, please wait..." ). "</div>" ;
1361 print "<div dojoType= \" fox.PrefFeedStore \" jsId= \" feedStore \"
1362 url= \" backend.php?op=pref-feeds&subop=getfeedtree \" >
1364 <div dojoType= \" lib.CheckBoxStoreModel \" jsId= \" feedModel \" store= \" feedStore \"
1365 query= \" {id:'root'} \" rootId= \" root \" rootLabel= \" Feeds \"
1366 childrenAttrs= \" items \" checkboxStrict= \" false \" checkboxAll= \" false \" >
1368 <div dojoType= \" fox.PrefFeedTree \" id= \" feedTree \"
1369 dndController= \" dijit.tree.dndSource \"
1370 betweenThreshold= \" 5 \"
1371 model= \" feedModel \" openOnClick= \" false \" >
1372 <script type= \" dojo/method \" event= \" onClick \" args= \" item \" >
1373 var id = String(item.id);
1374 var bare_id = id.substr(id.indexOf(':')+1);
1376 if (id.match('FEED:')) {
1378 } else if (id.match('CAT:')) {
1379 editCat(bare_id, item);
1382 <script type= \" dojo/method \" event= \" onLoad \" args= \" item \" >
1383 Element.hide( \" feedlistLoading \" );
1387 print "<div dojoType= \" dijit.Tooltip \" connectId= \" feedTree \" position= \" below \" >
1388 " . __ ( '<b>Hint:</b> you can drag feeds and categories around.' ). "
1391 print "</div>" ; # feeds pane
1393 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'OPML' ). " \" >" ;
1395 print "<p>" . __ ( "Using OPML you can export and import your feeds and Tiny Tiny RSS settings." );
1397 print "<div class= \" insensitive \" >" . __ ( "Note: Only main settings profile can be migrated using OPML." ) . "</div>" ;
1401 print "<iframe id= \" upload_iframe \"
1402 name= \" upload_iframe \" onload= \" opmlImportComplete(this) \"
1403 style= \" width: 400px; height: 100px; display: none; \" ></iframe>" ;
1405 print "<form style='display : block' target= \" upload_iframe \"
1406 enctype= \" multipart/form-data \" method= \" POST \"
1407 action= \" backend.php \" >
1408 <input id= \" opml_file \" name= \" opml_file \" type= \" file \" >
1409 <input type= \" hidden \" name= \" op \" value= \" dlg \" >
1410 <input type= \" hidden \" name= \" id \" value= \" importOpml \" >
1411 <button dojoType= \" dijit.form.Button \" onclick= \" return opmlImport(); \"
1412 type= \" submit \" >" . __ ( 'Import' ). "</button>
1413 <button dojoType= \" dijit.form.Button \" onclick= \" gotoExportOpml() \" >" . __ ( 'Export OPML' ). "</button>
1416 print "<p>" . __ ( 'Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.' );
1418 print "<div class= \" insensitive \" >" . __ ( "Note: Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds." ) . "</div>" . "</p>" ;
1420 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('pubOPMLUrl') \" >" .
1421 __ ( 'Display URL' ). "</button> " ;
1424 print "</div>" ; # pane
1426 if ( strpos ( $_SERVER [ 'HTTP_USER_AGENT' ], "Firefox" ) !== false ) {
1428 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Firefox integration' ). " \" >" ;
1430 print "<p>" . __ ( 'This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.' ) . "</p>" ;
1434 print "<button onclick='window.navigator.registerContentHandler(" .
1435 " \" application/vnd.mozilla.maybe.feed \" , " .
1436 " \" " . add_feed_url () . " \" , " . " \" Tiny Tiny RSS \" )'>" .
1437 __ ( 'Click here to register this site as a feed reader.' ) .
1442 print "</div>" ; # pane
1445 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Subscribing using bookmarklet' ). " \" >" ;
1447 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>" ;
1449 $bm_subscribe_url = str_replace ( ' %s ' , '' , add_feed_url ());
1451 $confirm_str = __ ( 'Subscribe to %s in Tiny Tiny RSS?' );
1453 $bm_url = htmlspecialchars ( "javascript:{if(confirm(' $confirm_str '.replace(' %s ',window.location.href)))window.location.href=' $bm_subscribe_url '+window.location.href}" );
1455 print "<a href= \" $bm_url\" class='bookmarklet'>" . __ ( 'Subscribe in Tiny Tiny RSS' ). "</a>" ;
1457 print "</div>" ; #pane
1459 print "<div dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Published articles and generated feeds' ). " \" >" ;
1461 print "<p>" . __ ( 'Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.' ). "</p>" ;
1463 $rss_url = '-2::' . htmlspecialchars ( get_self_url_prefix () .
1464 "/backend.php?op=rss&id=-2&view-mode=all_articles" );;
1466 print "<button dojoType= \" dijit.form.Button \" onclick= \" return displayDlg('generatedFeed', ' $rss_url ') \" >" .
1467 __ ( 'Display URL' ). "</button> " ;
1469 print "<button dojoType= \" dijit.form.Button \" onclick= \" return clearFeedAccessKeys() \" >" .
1470 __ ( 'Clear all generated URLs' ). "</button> " ;
1472 print "</div>" ; #pane
1474 if ( defined ( 'CONSUMER_KEY' ) && CONSUMER_KEY
!= '' ) {
1476 print "<div id= \" pref-feeds-twitter \" dojoType= \" dijit.layout.AccordionPane \" title= \" " . __ ( 'Twitter' ). " \" >" ;
1478 $result = db_query ( $link , "SELECT COUNT(*) AS cid FROM ttrss_users
1479 WHERE twitter_oauth IS NOT NULL AND twitter_oauth != '' AND
1480 id = " . $_SESSION [ 'uid' ]);
1482 $is_registered = db_fetch_result ( $result , 0 , "cid" ) != 0 ;
1484 if (! $is_registered ) {
1485 print_notice ( __ ( 'Before you can update your Twitter feeds, you must register this instance of Tiny Tiny RSS with Twitter.com.' ));
1487 print_notice ( __ ( 'You have been successfully registered with Twitter.com and should be able to access your Twitter feeds.' ));
1490 print "<button dojoType= \" dijit.form.Button \" onclick= \" window.location.href = 'twitter.php?op=register' \" >" .
1491 __ ( "Register with Twitter.com" ). "</button>" ;
1495 print "<button dojoType= \" dijit.form.Button \"
1496 onclick= \" return clearTwitterCredentials() \" >" .
1497 __ ( "Clear stored credentials" ). "</button>" ;
1499 print "</div>" ; # pane
1503 print "</div>" ; #container
1507 function make_feed_browser ( $link , $search , $limit , $mode = 1 ) {
1509 $owner_uid = $_SESSION [ "uid" ];
1513 $search_qpart = "AND (UPPER(feed_url) LIKE UPPER('% $search %') OR
1514 UPPER(title) LIKE UPPER('% $search %'))" ;
1520 $result = db_query ( $link , "SELECT feed_url, subscribers FROM
1521 ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
1522 WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url
1523 AND owner_uid = ' $owner_uid ') $search_qpart
1524 ORDER BY subscribers DESC LIMIT $limit " );
1525 } else if ( $mode == 2 ) {
1526 $result = db_query ( $link , "SELECT *,
1527 (SELECT COUNT(*) FROM ttrss_user_entries WHERE
1528 orig_feed_id = ttrss_archived_feeds.id) AS articles_archived
1530 ttrss_archived_feeds
1532 (SELECT COUNT(*) FROM ttrss_feeds
1533 WHERE ttrss_feeds.feed_url = ttrss_archived_feeds.feed_url AND
1534 owner_uid = ' $owner_uid ') = 0 AND
1535 owner_uid = ' $owner_uid ' $search_qpart
1536 ORDER BY id DESC LIMIT $limit " );
1541 while ( $line = db_fetch_assoc ( $result )) {
1545 $feed_url = $line [ "feed_url" ];
1546 $subscribers = $line [ "subscribers" ];
1548 $det_result = db_query ( $link , "SELECT site_url,title,id
1549 FROM ttrss_feeds WHERE feed_url = ' $feed_url ' LIMIT 1" );
1551 $details = db_fetch_assoc ( $det_result );
1553 $icon_file = ICONS_DIR
. "/" . $details [ "id" ] . ".ico" ;
1555 if ( file_exists ( $icon_file ) && filesize ( $icon_file ) > 0 ) {
1556 $feed_icon = "<img style= \" vertical-align : middle \" class= \" tinyFeedIcon \" src= \" " . ICONS_URL
.
1557 "/" . $details [ "id" ]. ".ico \" >" ;
1559 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" images/blank_icon.gif \" >" ;
1562 $check_box = "<input onclick='toggleSelectListRow2(this)'
1563 dojoType= \" dijit.form.CheckBox \"
1564 type= \" checkbox \" \" >" ;
1566 $class = ( $feedctr %
2 ) ?
"even" : "odd" ;
1568 $feed_url = htmlspecialchars ( $line [ "feed_url" ]);
1570 if ( $details [ "site_url" ]) {
1571 $site_url = "<a target= \" _blank \" href= \" " .
1572 htmlspecialchars ( $details [ "site_url" ]). " \" >
1573 <img style='border-width : 0px' src='images/www.png' alt='www'></a>" ;
1578 $feed_url = "<a target= \" _blank \" href= \" $feed_url\" ><img
1579 style='border-width : 0px; vertical-align : middle'
1580 src='images/feed-icon-12x12.png'></a>" ;
1582 $rv .= "<li title= \" " . htmlspecialchars ( $details [ "site_url" ]). " \"
1583 id= \" FBROW-" . $details [ "id" ]. " \" > $check_box " .
1584 " $feed_icon $feed_url " . htmlspecialchars ( $details [ "title" ]) .
1585 " <span class='subscribers'>( $subscribers )</span>
1588 } else if ( $mode == 2 ) {
1589 $feed_url = htmlspecialchars ( $line [ "feed_url" ]);
1590 $site_url = htmlspecialchars ( $line [ "site_url" ]);
1591 $title = htmlspecialchars ( $line [ "title" ]);
1593 $icon_file = ICONS_DIR
. "/" . $line [ "id" ] . ".ico" ;
1595 if ( file_exists ( $icon_file ) && filesize ( $icon_file ) > 0 ) {
1596 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" " . ICONS_URL
.
1597 "/" . $line [ "id" ]. ".ico \" >" ;
1599 $feed_icon = "<img class= \" tinyFeedIcon \" src= \" images/blank_icon.gif \" >" ;
1602 $check_box = "<input onclick='toggleSelectListRow2(this)' dojoType= \" dijit.form.CheckBox \"
1603 type= \" checkbox \" >" ;
1605 $class = ( $feedctr %
2 ) ?
"even" : "odd" ;
1607 if ( $line [ 'articles_archived' ] > 0 ) {
1608 $archived = sprintf ( __ ( " %d archived articles" ), $line [ 'articles_archived' ]);
1609 $archived = " <span class='subscribers'>( $archived )</span>" ;
1614 if ( $line [ "site_url" ]) {
1615 $site_url = "<a target= \" _blank \" href= \" $site_url\" >
1616 <img style='border-width : 0px' src='images/www.png' alt='www'></a>" ;
1621 $feed_url = "<a target= \" _blank \" href= \" $feed_url\" ><img
1622 style='border-width : 0px; vertical-align : middle'
1623 src='images/feed-icon-12x12.png'></a>" ;
1625 $rv .= "<li title='" . $line [ 'site_url' ]. "' class=' $class '
1626 id= \" FBROW-" . $line [ "id" ]. " \" >" .
1627 $check_box . " $feed_icon $feed_url " . $title .
1628 $archived . $site_url . "</li>" ;
1636 if ( $feedctr == 0 ) {
1637 $rv .= "<li style= \" text-align : center \" ><p>" . __ ( 'No feeds found.' ). "</p></li>" ;