]>
git.wh0rd.org - tt-rss.git/blob - classes/dlg.php
55f6ea726a7f8105b041b31566d024166bbf6d6f
2 class Dlg
extends Protected_Handler
{
6 if ( parent
:: before ()) {
7 header ( "Content-Type: text/xml; charset=utf-8" );
8 $this -> param
= db_escape_string ( $_REQUEST [ "param" ]);
19 function importOpml () {
20 header ( "Content-Type: text/html" ); # required for iframe
22 print "<div class= \" prefFeedOPMLHolder \" >" ;
23 $owner_uid = $_SESSION [ "uid" ];
25 db_query ( $this -> link
, "BEGIN" );
27 /* create Imported feeds category just in case */
29 $result = db_query ( $this -> link
, "SELECT id FROM
30 ttrss_feed_categories WHERE title = 'Imported feeds' AND
31 owner_uid = ' $owner_uid ' LIMIT 1" );
33 if ( db_num_rows ( $result ) == 0 ) {
34 db_query ( $this -> link
, "INSERT INTO ttrss_feed_categories
36 VALUES ('Imported feeds', ' $owner_uid ')" );
39 db_query ( $this -> link
, "COMMIT" );
41 /* Handle OPML import by DOMXML/DOMDocument */
43 if ( function_exists ( 'domxml_open_file' )) {
44 print "<ul class='nomarks'>" ;
45 print "<li>" . __ ( "Importing using DOMXML." ). "</li>" ;
46 require_once "opml_domxml.php" ;
47 opml_import_domxml ( $this -> link
, $owner_uid );
49 } else if ( PHP_VERSION
>= 5 ) {
50 print "<ul class='nomarks'>" ;
51 print "<li>" . __ ( "Importing using DOMDocument." ). "</li>" ;
52 require_once "opml_domdoc.php" ;
53 opml_import_domdoc ( $this -> link
, $owner_uid );
56 print_error ( __ ( "DOMXML extension is not found. It is required for PHP versions below 5." ));
61 print "<div align='center'>" ;
62 print "<button dojoType= \" dijit.form.Button \"
63 onclick= \" dijit.byId('opmlImportDlg').hide() \" >" .
64 __ ( 'Close this window' ). "</button>" ;
72 function editPrefProfiles () {
73 print "<div dojoType= \" dijit.Toolbar \" >" ;
75 print "<input name= \" newprofile \" dojoType= \" dijit.form.ValidationTextBox \"
77 <button dojoType= \" dijit.form.Button \"
78 onclick= \" dijit.byId('profileEditDlg').addProfile() \" >" .
79 __ ( 'Create profile' ). "</button></div>" ;
81 $result = db_query ( $this -> link
, "SELECT title,id FROM ttrss_settings_profiles
82 WHERE owner_uid = " . $_SESSION [ "uid" ]. " ORDER BY title" );
84 print "<div class= \" prefFeedCatHolder \" >" ;
86 print "<form id= \" profile_edit_form \" onsubmit= \" return false \" >" ;
88 print "<table width= \" 100% \" class= \" prefFeedProfileList \"
89 cellspacing= \" 0 \" id= \" prefFeedProfileList \" >" ;
91 print "<tr class= \"\" id= \" FCATR-0 \" >" ; #odd
93 print "<td width='5%' align='center'><input
94 onclick='toggleSelectRow2(this);'
95 dojoType= \" dijit.form.CheckBox \"
96 type= \" checkbox \" ></td>" ;
98 if (! $_SESSION [ "profile" ]) {
99 $is_active = __ ( "(active)" );
105 __ ( "Default profile" ) . " $is_active </span></td>" ;
111 while ( $line = db_fetch_assoc ( $result )) {
113 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
115 $profile_id = $line [ "id" ];
116 $this_row_id = "id= \" FCATR- $profile_id\" " ;
118 print "<tr class= \"\" $this_row_id >" ;
120 $edit_title = htmlspecialchars ( $line [ "title" ]);
122 print "<td width='5%' align='center'><input
123 onclick='toggleSelectRow2(this);'
124 dojoType= \" dijit.form.CheckBox \"
125 type= \" checkbox \" ></td>" ;
127 if ( $_SESSION [ "profile" ] == $line [ "id" ]) {
128 $is_active = __ ( "(active)" );
133 print "<td><span dojoType= \" dijit.InlineEditBox \"
134 width= \" 300px \" autoSave= \" false \"
135 profile-id= \" $profile_id\" >" . $edit_title .
136 "<script type= \" dojo/method \" event= \" onChange \" args= \" item \" >
140 content: {op: 'rpc', method: 'saveprofile',
142 id: this.srcNodeRef.getAttribute('profile-id')},
143 load: function(response) {
144 elem.attr('value', response);
148 </span> $is_active </td>" ;
159 print "<div class='dlgButtons'>
160 <div style='float : left'>
161 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').removeSelected() \" >" .
162 __ ( 'Remove selected profiles' ). "</button>
163 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').activateProfile() \" >" .
164 __ ( 'Activate profile' ). "</button>
167 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').hide() \" >" .
168 __ ( 'Close this window' ). "</button>" ;
173 function pubOPMLUrl () {
174 print "<title>" . __ ( 'Public OPML URL' ). "</title>" ;
175 print "<content><![CDATA[" ;
177 $url_path = opml_publish_url ( $this -> link
);
179 print __ ( "Your Public OPML URL is:" );
181 print "<div class= \" tagCloudContainer \" >" ;
182 print "<a id='pub_opml_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
185 print "<div align='center'>" ;
187 print "<button dojoType= \" dijit.form.Button \" onclick= \" return opmlRegenKey() \" >" .
188 __ ( 'Generate new URL' ). "</button> " ;
190 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
191 __ ( 'Close this window' ). "</button>" ;
194 print "]]></content>" ;
199 function explainError () {
200 print "<title>" . __ ( 'Notice' ). "</title>" ;
201 print "<content><![CDATA[" ;
203 print "<div class= \" errorExplained \" >" ;
205 if ( $this -> param
== 1 ) {
206 print __ ( "Update daemon is enabled in configuration, but daemon process is not running, which prevents all feeds from updating. Please start the daemon process or contact instance owner." );
208 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
210 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
214 if ( $this -> param
== 3 ) {
215 print __ ( "Update daemon is taking too long to perform a feed update. This could indicate a problem like crash or a hang. Please check the daemon process or contact instance owner." );
217 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
219 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
225 print "<div align='center'>" ;
227 print "<button onclick= \" return closeInfoBox() \" >" .
228 __ ( 'Close this window' ). "</button>" ;
231 print "]]></content>" ;
236 function quickAddFeed () {
237 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
238 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" addfeed \" >" ;
240 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
241 print "<div class= \" dlgSecCont \" >" ;
243 print "<input style= \" font-size : 16px; width : 20em; \"
244 placeHolder= \" " . __ ( "Feed URL" ). " \"
245 dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \" name= \" feed \" id= \" feedDlg_feedUrl \" >" ;
249 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
250 print __ ( 'Place in category:' ) . " " ;
251 print_feed_cat_select ( $this -> link
, "cat" , false , 'dojoType="dijit.form.Select"' );
256 print '<div id="feedDlg_feedsContainer" style="display : none">
258 <div class="dlgSec">' . __ ( 'Available feeds' ) . '</div>
259 <div class="dlgSecCont">' .
260 '<select id="feedDlg_feedContainerSelect"
261 dojoType="dijit.form.Select" size="3">
262 <script type="dojo/method" event="onChange" args="value">
263 dijit.byId("feedDlg_feedUrl").attr("value", value);
268 print "<div id='feedDlg_loginContainer' style='display : none'>
270 <div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>
271 <div class= \" dlgSecCont \" >" .
273 " <input dojoType= \" dijit.form.TextBox \" name='login' \"
274 placeHolder= \" " . __ ( "Login" ). " \"
275 style= \" width : 10em; \" > " .
277 placeHolder= \" " . __ ( "Password" ). " \"
278 dojoType= \" dijit.form.TextBox \" type='password'
279 style= \" width : 10em; \" name='pass' \" >
283 print "<div style= \" clear : both \" >
284 <input type= \" checkbox \" dojoType= \" dijit.form.CheckBox \" id= \" feedDlg_loginCheck \"
285 onclick='checkboxToggleElement(this, \" feedDlg_loginContainer \" )'>
286 <label for= \" feedDlg_loginCheck \" >" .
287 __ ( 'This feed requires authentication.' ). "</div>" ;
291 print "<div class= \" dlgButtons \" >
292 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedAddDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
293 <button dojoType= \" dijit.form.Button \" onclick= \" return feedBrowser() \" >" . __ ( 'More feeds' ). "</button>
294 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedAddDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
300 function feedBrowser () {
301 $browser_search = db_escape_string ( $_REQUEST [ "search" ]);
303 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
304 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" updateFeedBrowser \" >" ;
306 print "<div dojoType= \" dijit.Toolbar \" >
307 <div style='float : right'>
308 <img style='display : none'
309 id='feed_browser_spinner' src='" .
310 theme_image ( $this -> link
, 'images/indicator_white.gif' ). "'>
311 <input name= \" search \" dojoType= \" dijit.form.TextBox \" size= \" 20 \" type= \" search \"
312 onchange= \" dijit.byId('feedBrowserDlg').update() \" value= \" $browser_search\" >
313 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').update() \" >" . __ ( 'Search' ). "</button>
316 print " <select name= \" mode \" dojoType= \" dijit.form.Select \" onchange= \" dijit.byId('feedBrowserDlg').update() \" >
317 <option value='1'>" . __ ( 'Popular feeds' ) . "</option>
318 <option value='2'>" . __ ( 'Feed archive' ) . "</option>
323 print " <select dojoType= \" dijit.form.Select \" name= \" limit \" onchange= \" dijit.byId('feedBrowserDlg').update() \" >" ;
325 foreach ( array ( 25 , 50 , 100 , 200 ) as $l ) {
326 $issel = ( $l == $limit ) ?
"selected= \" 1 \" " : "" ;
327 print "<option $issel value= \" $l\" > $l </option>" ;
334 $owner_uid = $_SESSION [ "uid" ];
336 print "<ul class='browseFeedList' id='browseFeedList'>" ;
337 print make_feed_browser ( $this -> link
, $search , 25 );
340 print "<div align='center'>
341 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
342 <button dojoType= \" dijit.form.Button \" style='display : none' id='feed_archive_remove' onclick= \" dijit.byId('feedBrowserDlg').removeFromArchive() \" >" . __ ( 'Remove' ). "</button>
343 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').hide() \" >" . __ ( 'Cancel' ). "</button></div>" ;
348 $this -> params
= explode ( ":" , db_escape_string ( $_REQUEST [ "param" ]), 2 );
350 $active_feed_id = sprintf ( " %d " , $this -> params
[ 0 ]);
351 $is_cat = $this -> params
[ 1 ] != "false" ;
353 print "<div class= \" dlgSec \" >" . __ ( 'Look for' ). "</div>" ;
355 print "<div class= \" dlgSecCont \" >" ;
357 if (! SPHINX_ENABLED
) {
359 print "<input dojoType= \" dijit.form.ValidationTextBox \"
360 style= \" font-size : 16px; width : 12em; \"
361 required= \" 1 \" name= \" query \" type= \" search \" value=''>" ;
363 print " " . __ ( 'match on' ). " " ;
365 $search_fields = array (
366 "title" => __ ( "Title" ),
367 "content" => __ ( "Content" ),
368 "both" => __ ( "Title or content" ));
370 print_select_hash ( "match_on" , 3 , $search_fields ,
371 'dojoType="dijit.form.Select"' );
373 print "<input dojoType= \" dijit.form.ValidationTextBox \"
374 style= \" font-size : 16px; width : 20em; \"
375 required= \" 1 \" name= \" query \" type= \" search \" value=''>" ;
379 print "<hr/>" . __ ( 'Limit search to:' ). " " ;
381 print "<select name= \" search_mode \" dojoType= \" dijit.form.Select \" >
382 <option value= \" all_feeds \" >" . __ ( 'All feeds' ). "</option>" ;
384 $feed_title = getFeedTitle ( $this -> link
, $active_feed_id );
387 $feed_cat_title = getFeedCatTitle ( $this -> link
, $active_feed_id );
389 $feed_cat_title = getCategoryTitle ( $this -> link
, $active_feed_id );
392 if ( $active_feed_id && ! $is_cat ) {
393 print "<option selected= \" 1 \" value= \" this_feed \" > $feed_title </option>" ;
395 print "<option disabled= \" 1 \" value= \" false \" >" . __ ( 'This feed' ). "</option>" ;
399 $cat_preselected = "selected= \" 1 \" " ;
402 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' ) && ( $active_feed_id > 0 ||
$is_cat )) {
403 print "<option $cat_preselected value= \" this_cat \" > $feed_cat_title </option>" ;
405 //print "<option disabled>".__('This category')."</option>";
412 print "<div class= \" dlgButtons \" >" ;
414 if (! SPHINX_ENABLED
) {
415 print "<div style= \" float : left \" >
416 <a class= \" visibleLink \" target= \" _blank \" href= \" http://tt-rss.org/redmine/wiki/tt-rss/SearchSyntax \" >Search syntax</a>
420 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('searchDlg').execute() \" >" . __ ( 'Search' ). "</button>
421 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('searchDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
425 function quickAddFilter () {
426 $active_feed_id = db_escape_string ( $_REQUEST [ "param" ]);
428 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-filters \" >" ;
429 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" quiet \" value= \" 1 \" >" ;
430 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" add \" >" ;
432 $result = db_query ( $this -> link
, "SELECT id,description
433 FROM ttrss_filter_types ORDER BY description" );
435 $filter_types = array ();
437 while ( $line = db_fetch_assoc ( $result )) {
438 //array_push($filter_types, $line["description"]);
439 $filter_types [ $line [ "id" ]] = __ ( $line [ "description" ]);
442 print "<div class= \" dlgSec \" >" . __ ( "Match" ). "</div>" ;
444 print "<div class= \" dlgSecCont \" >" ;
446 print "<span id= \" filterDlg_dateModBox \" style= \" display : none \" >" ;
448 $filter_params = array (
449 "before" => __ ( "before" ),
450 "after" => __ ( "after" ));
452 print_select_hash ( "filter_date_modifier" , "before" ,
453 $filter_params , 'dojoType="dijit.form.Select"' );
455 print " </span>" ;
457 print "<input dojoType= \" dijit.form.ValidationTextBox \"
458 required= \" true \" id= \" filterDlg_regExp \"
459 style= \" font-size : 16px \"
460 name= \" reg_exp \" value= \" $reg_exp\" />" ;
462 print "<span id= \" filterDlg_dateChkBox \" style= \" display : none \" >" ;
463 print " <button dojoType= \" dijit.form.Button \"
464 onclick= \" return filterDlgCheckDate() \" >" .
465 __ ( 'Check it' ). "</button>" ;
468 print "<hr/>" . __ ( "on field" ) . " " ;
469 print_select_hash ( "filter_type" , 1 , $filter_types ,
470 'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"' );
474 print __ ( "in" ) . " " ;
475 print_feed_select ( $this -> link
, "feed_id" , $active_feed_id ,
476 'dojoType="dijit.form.FilteringSelect"' );
480 print "<div class= \" dlgSec \" >" . __ ( "Perform Action" ). "</div>" ;
482 print "<div class= \" dlgSecCont \" >" ;
484 print "<select name= \" action_id \" dojoType= \" dijit.form.Select \"
485 onchange= \" filterDlgCheckAction(this) \" >" ;
487 $result = db_query ( $this -> link
, "SELECT id,description FROM ttrss_filter_actions
490 while ( $line = db_fetch_assoc ( $result )) {
491 printf ( "<option value=' %d '> %s </option>" , $line [ "id" ], __ ( $line [ "description" ]));
496 print "<span id= \" filterDlg_paramBox \" style= \" display : none \" >" ;
497 print " " . __ ( "with parameters:" ) . " " ;
498 print "<input dojoType= \" dijit.form.TextBox \"
499 id= \" filterDlg_actionParam \"
500 name= \" action_param \" >" ;
502 print_label_select ( $this -> link
, "action_param_label" , $action_param ,
503 'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"' );
507 print " " ; // tiny layout hack
511 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
512 print "<div class= \" dlgSecCont \" >" ;
514 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" enabled \" id= \" enabled \" checked= \" 1 \" >
515 <label for= \" enabled \" >" . __ ( 'Enabled' ). "</label><hr/>" ;
517 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" inverse \" id= \" inverse \" >
518 <label for= \" inverse \" >" . __ ( 'Inverse match' ). "</label>" ;
522 print "<div class= \" dlgButtons \" >" ;
524 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').test() \" >" .
525 __ ( 'Test' ). "</button> " ;
527 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').execute() \" >" .
528 __ ( 'Create' ). "</button> " ;
530 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').hide() \" >" .
531 __ ( 'Cancel' ). "</button>" ;
536 function inactiveFeeds () {
538 if ( DB_TYPE
== "pgsql" ) {
539 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
541 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
544 $result = db_query ( $this -> link
, "SELECT ttrss_feeds.title, ttrss_feeds.site_url,
545 ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article
546 FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE
547 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
548 ttrss_entries.id = ref_id AND
549 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart
550 AND ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]. " AND
551 ttrss_user_entries.feed_id = ttrss_feeds.id AND
552 ttrss_entries.id = ref_id
553 GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url
554 ORDER BY last_article" );
556 print __ ( "These feeds have not been updated with new content for 3 months (oldest first):" );
558 print "<div class= \" inactiveFeedHolder \" >" ;
560 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefInactiveFeedList \" >" ;
564 while ( $line = db_fetch_assoc ( $result )) {
566 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
567 $feed_id = $line [ "id" ];
568 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
570 print "<tr class= \"\" $this_row_id >" ;
572 $edit_title = htmlspecialchars ( $line [ "title" ]);
574 print "<td width='5%' align='center'><input
575 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
576 type= \" checkbox \" ></td>" ;
579 print "<a class= \" visibleLink \" href= \" # \" " .
580 "title= \" " . __ ( "Click to edit feed" ). " \" " .
581 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
582 htmlspecialchars ( $line [ "title" ]). "</a>" ;
584 print "</td><td class= \" insensitive \" align='right'>" ;
585 print make_local_datetime ( $this -> link
, $line [ 'last_article' ], false );
595 print "<div class='dlgButtons'>" ;
596 print "<div style='float : left'>" ;
597 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').removeSelected() \" >"
598 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
601 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').hide() \" >" .
602 __ ( 'Close this window' ). "</button>" ;
608 function feedsWithErrors () {
609 print __ ( "These feeds have not been updated because of errors:" );
611 $result = db_query ( $this -> link
, "SELECT id,title,feed_url,last_error,site_url
612 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
614 print "<div class= \" inactiveFeedHolder \" >" ;
616 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefErrorFeedList \" >" ;
620 while ( $line = db_fetch_assoc ( $result )) {
622 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
623 $feed_id = $line [ "id" ];
624 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
626 print "<tr class= \"\" $this_row_id >" ;
628 $edit_title = htmlspecialchars ( $line [ "title" ]);
630 print "<td width='5%' align='center'><input
631 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
632 type= \" checkbox \" ></td>" ;
635 print "<a class= \" visibleLink \" href= \" # \" " .
636 "title= \" " . __ ( "Click to edit feed" ). " \" " .
637 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
638 htmlspecialchars ( $line [ "title" ]). "</a>: " ;
640 print "<span class= \" insensitive \" >" ;
641 print htmlspecialchars ( $line [ "last_error" ]);
653 print "<div class='dlgButtons'>" ;
654 print "<div style='float : left'>" ;
655 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').removeSelected() \" >"
656 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
659 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').hide() \" >" .
660 __ ( 'Close this window' ). "</button>" ;
665 function editArticleTags () {
667 print __ ( "Tags for this article (separated by commas):" ). "<br>" ;
669 $tags = get_article_tags ( $this -> link
, $this -> param
);
671 $tags_str = join ( ", " , $tags );
673 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $this ->param \" >" ;
674 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
675 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setArticleTags \" >" ;
677 print "<table width='100%'><tr><td>" ;
679 print "<textarea dojoType= \" dijit.form.SimpleTextarea \" rows='4'
680 style='font-size : 12px; width : 100%' id= \" tags_str \"
681 name='tags_str'> $tags_str </textarea>
682 <div class= \" autocomplete \" id= \" tags_choices \"
683 style= \" display:none \" ></div>" ;
685 print "</td></tr></table>" ;
687 print "<div class='dlgButtons'>" ;
689 print "<button dojoType= \" dijit.form.Button \"
690 onclick= \" dijit.byId('editTagsDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
691 print "<button dojoType= \" dijit.form.Button \"
692 onclick= \" dijit.byId('editTagsDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
697 function printTagCloud () {
698 print "<title>" . __ ( 'Tag Cloud' ). "</title>" ;
699 print "<content><![CDATA[" ;
701 print "<div class= \" tagCloudContainer \" >" ;
703 // from here: http://www.roscripts.com/Create_tag_cloud-71.html
705 $query = "SELECT tag_name, COUNT(post_int_id) AS count
706 FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ "uid" ]. "
707 GROUP BY tag_name ORDER BY count DESC LIMIT 50" ;
709 $result = db_query ( $this -> link
, $query );
713 while ( $line = db_fetch_assoc ( $result )) {
714 $tags [ $line [ "tag_name" ]] = $line [ "count" ];
717 if ( count ( $tags ) == 0 ){ return ; }
721 $max_size = 32 ; // max font size in pixels
722 $min_size = 11 ; // min font size in pixels
724 // largest and smallest array values
725 $max_qty = max ( array_values ( $tags ));
726 $min_qty = min ( array_values ( $tags ));
728 // find the range of values
729 $spread = $max_qty - $min_qty ;
730 if ( $spread == 0 ) { // we don't want to divide by zero
734 // set the font-size increment
735 $step = ( $max_size - $min_size ) / ( $spread );
737 // loop through the tag array
738 foreach ( $tags as $key => $value ) {
739 // calculate font-size
740 // find the $value in excess of $min_qty
741 // multiply by the font-size increment ($size)
742 // and add the $min_size set above
743 $size = round ( $min_size +
(( $value - $min_qty ) * $step ));
745 $key_escaped = str_replace ( "'" , " \\ '" , $key );
747 echo "<a href= \" javascript:viewfeed(' $key_escaped ') \" style= \" font-size: " .
748 $size . "px \" title= \" $value articles tagged with " .
749 $key . '">' . $key . '</a> ' ;
756 print "<div align='center'>" ;
757 print "<button dojoType= \" dijit.form.Button \"
758 onclick= \" return closeInfoBox() \" >" .
759 __ ( 'Close this window' ). "</button>" ;
762 print "]]></content>" ;
765 function printTagSelect () {
767 print "<title>" . __ ( 'Select item(s) by tags' ) . "</title>" ;
768 print "<content><![CDATA[" ;
770 print __ ( "Match:" ). " " .
771 "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" checked value= \" any \" name= \" tag_mode \" > Any " ;
772 print "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" value= \" all \" name= \" tag_mode \" > All " ;
775 print "<select id= \" all_tags \" name= \" all_tags \" title= \" " . __ ( 'Which Tags?' ) . " \" multiple= \" multiple \" size= \" 10 \" style= \" width : 100% \" >" ;
776 $result = db_query ( $this -> link
, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ 'uid' ]. "
777 AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC" );
779 while ( $row = db_fetch_assoc ( $result )) {
780 $tmp = htmlspecialchars ( $row [ "tag_name" ]);
781 print "<option value= \" " . str_replace ( " " , " %20 " , $tmp ) . " \" > $tmp </option>" ;
786 print "<div align='right'>" ;
787 print "<button dojoType= \" dijit.form.Button \" onclick= \" viewfeed(get_all_tags($('all_tags')),
788 get_radio_checked($('tag_mode'))); \" >" . __ ( 'Display entries' ) . "</button>" ;
790 print "<button dojoType= \" dijit.form.Button \"
791 onclick= \" return closeInfoBox() \" >" .
792 __ ( 'Close this window' ) . "</button>" ;
795 print "]]></content>" ;
798 function emailArticle () {
800 $secretkey = sha1 ( uniqid ( rand (), true ));
802 $_SESSION [ 'email_secretkey' ] = $secretkey ;
804 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" secretkey \" value= \" $secretkey\" >" ;
805 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
806 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" sendEmail \" >" ;
808 $result = db_query ( $this -> link
, "SELECT email, full_name FROM ttrss_users WHERE
809 id = " . $_SESSION [ "uid" ]);
811 $user_email = htmlspecialchars ( db_fetch_result ( $result , 0 , "email" ));
812 $user_name = htmlspecialchars ( db_fetch_result ( $result , 0 , "full_name" ));
814 if (! $user_name ) $user_name = $_SESSION [ 'name' ];
816 $_SESSION [ 'email_replyto' ] = $user_email ;
817 $_SESSION [ 'email_fromname' ] = $user_name ;
819 require_once "lib/MiniTemplator.class.php" ;
821 $tpl = new MiniTemplator
;
822 $tpl_t = new MiniTemplator
;
824 $tpl -> readTemplateFromFile ( "templates/email_article_template.txt" );
826 $tpl -> setVariable ( 'USER_NAME' , $_SESSION [ "name" ]);
827 $tpl -> setVariable ( 'USER_EMAIL' , $user_email );
828 $tpl -> setVariable ( 'TTRSS_HOST' , $_SERVER [ "HTTP_HOST" ]);
831 $result = db_query ( $this -> link
, "SELECT link, content, title
832 FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND
833 id IN ( $this ->param) AND owner_uid = " . $_SESSION [ "uid" ]);
835 if ( db_num_rows ( $result ) > 1 ) {
836 $subject = __ ( "[Forwarded]" ) . " " . __ ( "Multiple articles" );
839 while ( $line = db_fetch_assoc ( $result )) {
842 $subject = __ ( "[Forwarded]" ) . " " . htmlspecialchars ( $line [ "title" ]);
844 $tpl -> setVariable ( 'ARTICLE_TITLE' , strip_tags ( $line [ "title" ]));
845 $tpl -> setVariable ( 'ARTICLE_URL' , strip_tags ( $line [ "link" ]));
847 $tpl -> addBlock ( 'article' );
850 $tpl -> addBlock ( 'email' );
853 $tpl -> generateOutputToString ( $content );
855 print "<table width='100%'><tr><td>" ;
861 print "<input dojoType= \" dijit.form.TextBox \" disabled= \" 1 \" style= \" width : 30em; \"
862 value= \" $user_name < $user_email > \" >" ;
864 print "</td></tr><tr><td>" ;
870 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" true \"
871 style= \" width : 30em; \"
872 name= \" destination \" id= \" emailArticleDlg_destination \" >" ;
874 print "<div class= \" autocomplete \" id= \" emailArticleDlg_dst_choices \"
875 style= \" z-index: 30; display : none \" ></div>" ;
877 print "</td></tr><tr><td>" ;
879 print __ ( 'Subject:' );
883 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" true \"
884 style= \" width : 30em; \"
885 name= \" subject \" value= \" $subject\" id= \" subject \" >" ;
889 print "<tr><td colspan='2'><textarea dojoType= \" dijit.form.SimpleTextarea \" style='font-size : 12px; width : 100%' rows= \" 20 \"
890 name='content'> $content </textarea>" ;
892 print "</td></tr></table>" ;
894 print "<div class='dlgButtons'>" ;
895 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('emailArticleDlg').execute() \" >" . __ ( 'Send e-mail' ). "</button> " ;
896 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('emailArticleDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
902 function generatedFeed () {
904 print "<title>" . __ ( 'View as RSS' ). "</title>" ;
905 print "<content><![CDATA[" ;
907 $this -> params
= explode ( ":" , $this -> param
, 3 );
908 $feed_id = db_escape_string ( $this -> params
[ 0 ]);
909 $is_cat = ( bool ) $this -> params
[ 1 ];
911 $key = get_feed_access_key ( $this -> link
, $feed_id , $is_cat );
913 $url_path = htmlspecialchars ( $this -> params
[ 2 ]) . "&key=" . $key ;
915 print __ ( "You can view this feed as RSS using the following URL:" );
917 print "<div class= \" tagCloudContainer \" >" ;
918 print "<a id='gen_feed_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
921 print "<div align='center'>" ;
923 print "<button dojoType= \" dijit.form.Button \" onclick= \" return genUrlChangeKey(' $feed_id ', ' $is_cat ') \" >" .
924 __ ( 'Generate new URL' ). "</button> " ;
926 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
927 __ ( 'Close this window' ). "</button>" ;
930 print "]]></content>" ;
935 function newVersion () {
937 $version_data = check_for_update ( $this -> link
);
938 $version = $version_data [ 'version' ];
939 $id = $version_data [ 'version_id' ];
941 print "<div class='tagCloudContainer'>" ;
943 print T_sprintf ( "New version of Tiny Tiny RSS is available ( %s )." ,
948 $details = "http://tt-rss.org/redmine/versions/show/ $id " ;
949 $download = "http://tt-rss.org/#Download" ;
951 print "<div style='text-align : center'>" ;
952 print "<button dojoType= \" dijit.form.Button \"
953 onclick= \" return window.open(' $details ') \" >" . __ ( "Details" ). "</button>" ;
954 print "<button dojoType= \" dijit.form.Button \"
955 onclick= \" return window.open(' $download ') \" >" . __ ( "Download" ). "</button>" ;
956 print "<button dojoType= \" dijit.form.Button \"
957 onclick= \" return dijit.byId('newVersionDlg').hide() \" >" .
958 __ ( 'Close this window' ). "</button>" ;
963 function customizeCSS () {
964 $value = get_pref ( $this -> link
, "USER_STYLESHEET" );
966 $value = str_replace ( "<br/>" , " \n " , $value );
968 print T_sprintf ( "You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here. <a target= \" _blank \" class= \" visibleLink \" href= \" %s\" >This file</a> can be used as a baseline." , "tt-rss.css" );
970 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
971 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setpref \" >" ;
972 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" key \" value= \" USER_STYLESHEET \" >" ;
974 print "<table width='100%'><tr><td>" ;
975 print "<textarea dojoType= \" dijit.form.SimpleTextarea \"
976 style='font-size : 12px; width : 100%; height: 200px;'
977 placeHolder='body#ttrssMain { font-size : 14px; };'
978 name='value'> $value </textarea>" ;
979 print "</td></tr></table>" ;
981 print "<div class='dlgButtons'>" ;
982 print "<button dojoType= \" dijit.form.Button \"
983 onclick= \" dijit.byId('cssEditDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
984 print "<button dojoType= \" dijit.form.Button \"
985 onclick= \" dijit.byId('cssEditDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
990 function editArticleNote () {
991 $result = db_query ( $this -> link
, "SELECT note FROM ttrss_user_entries WHERE
992 ref_id = ' $this ->param' AND owner_uid = " . $_SESSION [ 'uid' ]);
994 $note = db_fetch_result ( $result , 0 , "note" );
996 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $this ->param \" >" ;
997 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
998 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setNote \" >" ;
1000 print "<table width='100%'><tr><td>" ;
1001 print "<textarea dojoType= \" dijit.form.SimpleTextarea \"
1002 style='font-size : 12px; width : 100%; height: 100px;'
1003 placeHolder='body#ttrssMain { font-size : 14px; };'
1004 name='note'> $note </textarea>" ;
1005 print "</td></tr></table>" ;
1007 print "<div class='dlgButtons'>" ;
1008 print "<button dojoType= \" dijit.form.Button \"
1009 onclick= \" dijit.byId('editNoteDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
1010 print "<button dojoType= \" dijit.form.Button \"
1011 onclick= \" dijit.byId('editNoteDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
1017 print "<table width='100%'><tr><td align='center'>" ;
1018 print "<img src= \" images/logo_big.png \" >" ;
1020 print "<td width='70%'>" ;
1022 print "<h1>Tiny Riny RSS</h1>
1023 <strong>Version " . VERSION
. "</strong>
1024 <p>Copyright © 2005-" . date ( 'Y' ). "
1025 <a target= \" _blank \" class= \" visibleLink \"
1026 href= \" http://fakecake.org/ \" >Andrew Dolgov</a>
1027 and other contributors.</p>
1028 <p class= \" insensitive \" >Licensed under GNU GPL version 2.</p>" ;
1030 print "<p class= \" insensitive \" >
1031 <a class= \" visibleLink \" target= \" _blank \"
1032 href= \" http://tt-rss.org/ \" >Official site</a> —
1033 <a href= \" http://tt-rss.org/redmine/wiki/tt-rss/Donate \"
1034 target= \" _blank \" class= \" visibleLink \" >
1035 Support the project.</a></p>" ;
1040 print "<div align='center'>" ;
1041 print "<button dojoType= \" dijit.form.Button \"
1043 __ ( 'Close this window' ). "</button>" ;
1047 function addInstance () {
1048 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-instances \" >" ;
1049 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" add \" >" ;
1051 print "<div class= \" dlgSec \" >" . __ ( "Instance" ). "</div>" ;
1053 print "<div class= \" dlgSecCont \" >" ;
1057 print __ ( "URL:" ) . " " ;
1059 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
1060 placeHolder= \" " . __ ( "Instance URL" ). " \"
1061 regExp='^(http|https)://.*'
1062 style= \" font-size : 16px; width: 20em \" name= \" access_url \" >" ;
1066 $access_key = sha1 ( uniqid ( rand (), true ));
1070 print __ ( "Access key:" ) . " " ;
1072 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
1073 placeHolder= \" " . __ ( "Access key" ). " \" regExp='\w{40}'
1074 style= \" width: 20em \" name= \" access_key \" id= \" instance_add_key \"
1075 value= \" $access_key\" >" ;
1077 print "<p class='insensitive'>" . __ ( "Use one access key for both linked instances." );
1081 print "<div class= \" dlgButtons \" >
1082 <div style='float : left'>
1083 <button dojoType= \" dijit.form.Button \"
1084 onclick= \" return dijit.byId('instanceAddDlg').regenKey() \" >" .
1085 __ ( 'Generate new key' ). "</button>
1087 <button dojoType= \" dijit.form.Button \"
1088 onclick= \" return dijit.byId('instanceAddDlg').execute() \" >" .
1089 __ ( 'Create link' ). "</button>
1090 <button dojoType= \" dijit.form.Button \"
1091 onclick= \" return dijit.byId('instanceAddDlg').hide() \"\" >" .
1092 __ ( 'Cancel' ). "</button></div>" ;
1097 function shareArticle () {
1098 $result = db_query ( $this -> link
, "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = ' $this ->param'
1099 AND owner_uid = " . $_SESSION [ 'uid' ]);
1101 if ( db_num_rows ( $result ) == 0 ) {
1102 print "Article not found." ;
1105 $uuid = db_fetch_result ( $result , 0 , "uuid" );
1106 $ref_id = db_fetch_result ( $result , 0 , "ref_id" );
1109 $uuid = db_escape_string ( sha1 ( uniqid ( rand (), true )));
1110 db_query ( $this -> link
, "UPDATE ttrss_user_entries SET uuid = ' $uuid ' WHERE int_id = ' $this ->param'
1111 AND owner_uid = " . $_SESSION [ 'uid' ]);
1114 print __ ( "You can share this article by the following unique URL:" );
1116 $url_path = get_self_url_prefix ();
1117 $url_path .= "/public.php?op=share&key= $uuid " ;
1119 print "<div class= \" tagCloudContainer \" >" ;
1120 print "<a id='pub_opml_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
1123 /* if (!label_find_id($this->link, __('Shared'), $_SESSION["uid"]))
1124 label_create($this->link, __('Shared'), $_SESSION["uid"]);
1126 label_add_article($this->link, $ref_id, __('Shared'), $_SESSION['uid']); */
1129 print "<div align='center'>" ;
1131 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('shareArticleDlg').hide() \" >" .
1132 __ ( 'Close this window' ). "</button>" ;