print "</dlg>";
}
+ function exportData() {
+
+ print "<p style='text-align : center' id='export_status_message'>You need to prepare exported data first by clicking the button below.</p>";
+
+ print "<div align='center'>";
+ print "<button dojoType=\"dijit.form.Button\"
+ onclick=\"dijit.byId('dataExportDlg').prepare()\">".
+ __('Prepare data')."</button>";
+
+ print "<button dojoType=\"dijit.form.Button\"
+ onclick=\"dijit.byId('dataExportDlg').hide()\">".
+ __('Close this window')."</button>";
+
+ print "</div>";
+
+
+ }
+
function importOpml() {
header("Content-Type: text/html"); # required for iframe
+ print __("If you have imported labels and/or filters, you might need to reload preferences to see your new data.") . "</p>";
+
print "<div class=\"prefFeedOPMLHolder\">";
$owner_uid = $_SESSION["uid"];
/* Handle OPML import by DOMXML/DOMDocument */
- if (function_exists('domxml_open_file')) {
- print "<ul class='nomarks'>";
- print "<li>".__("Importing using DOMXML.")."</li>";
- require_once "opml_domxml.php";
- opml_import_domxml($this->link, $owner_uid);
- print "</ul>";
- } else if (PHP_VERSION >= 5) {
- print "<ul class='nomarks'>";
- print "<li>".__("Importing using DOMDocument.")."</li>";
- require_once "opml_domdoc.php";
- opml_import_domdoc($this->link, $owner_uid);
- print "</ul>";
- } else {
- print_error(__("DOMXML extension is not found. It is required for PHP versions below 5."));
- }
-
+ print "<ul class='nomarks'>";
+ require_once "opml.php";
+ opml_import_domdoc($this->link, $owner_uid);
+ print "</ul>";
print "</div>";
print "<div align='center'>";
print "<button dojoType=\"dijit.form.Button\"
- onclick=\"dijit.byId('opmlImportDlg').hide()\">".
+ onclick=\"dijit.byId('opmlImportDlg').execute()\">".
__('Close this window')."</button>";
print "</div>";
function editPrefProfiles() {
print "<div dojoType=\"dijit.Toolbar\">";
+ print "<div dojoType=\"dijit.form.DropDownButton\">".
+ "<span>" . __('Select')."</span>";
+ print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+ print "<div onclick=\"selectTableRows('prefFeedProfileList', 'all')\"
+ dojoType=\"dijit.MenuItem\">".__('All')."</div>";
+ print "<div onclick=\"selectTableRows('prefFeedProfileList', 'none')\"
+ dojoType=\"dijit.MenuItem\">".__('None')."</div>";
+ print "</div></div>";
+
+ print "<div style=\"float : right\">";
+
print "<input name=\"newprofile\" dojoType=\"dijit.form.ValidationTextBox\"
required=\"1\">
<button dojoType=\"dijit.form.Button\"
onclick=\"dijit.byId('profileEditDlg').addProfile()\">".
__('Create profile')."</button></div>";
+ print "</div>";
+
$result = db_query($this->link, "SELECT title,id FROM ttrss_settings_profiles
WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
print "<table width=\"100%\" class=\"prefFeedProfileList\"
cellspacing=\"0\" id=\"prefFeedProfileList\">";
- print "<tr class=\"\" id=\"FCATR-0\">"; #odd
+ print "<tr class=\"placeholder\" id=\"FCATR-0\">"; #odd
print "<td width='5%' align='center'><input
+ id='FCATC-0'
onclick='toggleSelectRow2(this);'
dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\"></td>";
$profile_id = $line["id"];
$this_row_id = "id=\"FCATR-$profile_id\"";
- print "<tr class=\"\" $this_row_id>";
+ print "<tr class=\"placeholder\" $this_row_id>";
$edit_title = htmlspecialchars($line["title"]);
print "<td width='5%' align='center'><input
onclick='toggleSelectRow2(this);'
+ id='FCATC-$profile_id'
dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\"></td>";
" <input
placeHolder=\"".__("Password")."\"
dojoType=\"dijit.form.TextBox\" type='password'
- style=\"width : 10em;\" name='pass'\">
+ style=\"width : 10em;\" name='pass'\">".
+ " <p class='insensitive'>".__("OAuth will be used automatically for Twitter feeds.")."</p>
</div></div>";
print "<div style=\"clear : both\">
- <input type=\"checkbox\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"
+ <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"
onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>
<label for=\"feedDlg_loginCheck\">".
__('This feed requires authentication.')."</div>";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"quiet\" value=\"1\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">";
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"csrf_token\" value=\"".$_SESSION['csrf_token']."\">";
$result = db_query($this->link, "SELECT id,description
FROM ttrss_filter_types ORDER BY description");
print "<hr/>";
print __("in") . " ";
+
+ print "<span id='filterDlg_feeds'>";
print_feed_select($this->link, "feed_id", $active_feed_id,
'dojoType="dijit.form.FilteringSelect"');
+ print "</span>";
+
+ print "<span id='filterDlg_cats' style='display : none'>";
+ print_feed_cat_select($this->link, "cat_id", $active_cat_id,
+ 'dojoType="dijit.form.FilteringSelect"');
+ print "</span>";
print "</div>";
<label for=\"enabled\">".__('Enabled')."</label><hr/>";
print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\">
- <label for=\"inverse\">".__('Inverse match')."</label>";
+ <label for=\"inverse\">".__('Inverse match')."</label><hr/>";
+
+ print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"cat_filter\" id=\"cat_filter\" onchange=\"filterDlgCheckCat(this)\">
+ <label for=\"cat_filter\">".__('Apply to category')."</label><hr/>";
+
print "</div>";
GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url
ORDER BY last_article");
- print __("These feeds have not been updated with new content for 3 months (oldest first):");
+ print "<div class=\"dialogNotice\">" . __("These feeds have not been updated with new content for 3 months (oldest first):") . "</div>";
+
+ print "<div dojoType=\"dijit.Toolbar\">";
+ print "<div dojoType=\"dijit.form.DropDownButton\">".
+ "<span>" . __('Select')."</span>";
+ print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+ print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'all')\"
+ dojoType=\"dijit.MenuItem\">".__('All')."</div>";
+ print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'none')\"
+ dojoType=\"dijit.MenuItem\">".__('None')."</div>";
+ print "</div></div>";
+ print "</div>"; #toolbar
print "<div class=\"inactiveFeedHolder\">";
$feed_id = $line["id"];
$this_row_id = "id=\"FUPDD-$feed_id\"";
- print "<tr class=\"\" $this_row_id>";
+ # class needed for selectTableRows()
+ print "<tr class=\"placeholder\" $this_row_id>";
$edit_title = htmlspecialchars($line["title"]);
+ # id needed for selectTableRows()
print "<td width='5%' align='center'><input
onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
- type=\"checkbox\"></td>";
+ type=\"checkbox\" id=\"FUPDC-$feed_id\"></td>";
print "<td>";
print "<a class=\"visibleLink\" href=\"#\" ".
}
function feedsWithErrors() {
- print __("These feeds have not been updated because of errors:");
+ print "<div class=\"dialogNotice\">" . __("These feeds have not been updated because of errors:") . "</div>";
$result = db_query($this->link, "SELECT id,title,feed_url,last_error,site_url
FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
+ print "<div dojoType=\"dijit.Toolbar\">";
+ print "<div dojoType=\"dijit.form.DropDownButton\">".
+ "<span>" . __('Select')."</span>";
+ print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+ print "<div onclick=\"selectTableRows('prefErrorFeedList', 'all')\"
+ dojoType=\"dijit.MenuItem\">".__('All')."</div>";
+ print "<div onclick=\"selectTableRows('prefErrorFeedList', 'none')\"
+ dojoType=\"dijit.MenuItem\">".__('None')."</div>";
+ print "</div></div>";
+ print "</div>"; #toolbar
+
print "<div class=\"inactiveFeedHolder\">";
print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
$feed_id = $line["id"];
$this_row_id = "id=\"FUPDD-$feed_id\"";
- print "<tr class=\"\" $this_row_id>";
+ # class needed for selectTableRows()
+ print "<tr class=\"placeholder\" $this_row_id>";
$edit_title = htmlspecialchars($line["title"]);
+ # id needed for selectTableRows()
print "<td width='5%' align='center'><input
onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
- type=\"checkbox\"></td>";
+ type=\"checkbox\" id=\"FUPDC-$feed_id\"></td>";
print "<td>";
print "<a class=\"visibleLink\" href=\"#\" ".
print "<div class=\"tagCloudContainer\">";
- printTagCloud($this->link);
+ // from here: http://www.roscripts.com/Create_tag_cloud-71.html
+
+ $query = "SELECT tag_name, COUNT(post_int_id) AS count
+ FROM ttrss_tags WHERE owner_uid = ".$_SESSION["uid"]."
+ GROUP BY tag_name ORDER BY count DESC LIMIT 50";
+
+ $result = db_query($this->link, $query);
+
+ $tags = array();
+
+ while ($line = db_fetch_assoc($result)) {
+ $tags[$line["tag_name"]] = $line["count"];
+ }
+
+ if( count($tags) == 0 ){ return; }
+
+ ksort($tags);
+
+ $max_size = 32; // max font size in pixels
+ $min_size = 11; // min font size in pixels
+
+ // largest and smallest array values
+ $max_qty = max(array_values($tags));
+ $min_qty = min(array_values($tags));
+
+ // find the range of values
+ $spread = $max_qty - $min_qty;
+ if ($spread == 0) { // we don't want to divide by zero
+ $spread = 1;
+ }
+
+ // set the font-size increment
+ $step = ($max_size - $min_size) / ($spread);
+
+ // loop through the tag array
+ foreach ($tags as $key => $value) {
+ // calculate font-size
+ // find the $value in excess of $min_qty
+ // multiply by the font-size increment ($size)
+ // and add the $min_size set above
+ $size = round($min_size + (($value - $min_qty) * $step));
+
+ $key_escaped = str_replace("'", "\\'", $key);
+
+ echo "<a href=\"javascript:viewfeed('$key_escaped') \" style=\"font-size: " .
+ $size . "px\" title=\"$value articles tagged with " .
+ $key . '">' . $key . '</a> ';
+ }
+
+
print "</div>";
print "]]></content>";
}
- function emailArticle() {
-
- $secretkey = sha1(uniqid(rand(), true));
-
- $_SESSION['email_secretkey'] = $secretkey;
-
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"secretkey\" value=\"$secretkey\">";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"sendEmail\">";
-
- $result = db_query($this->link, "SELECT email, full_name FROM ttrss_users WHERE
- id = " . $_SESSION["uid"]);
-
- $user_email = htmlspecialchars(db_fetch_result($result, 0, "email"));
- $user_name = htmlspecialchars(db_fetch_result($result, 0, "full_name"));
-
- if (!$user_name) $user_name = $_SESSION['name'];
-
- $_SESSION['email_replyto'] = $user_email;
- $_SESSION['email_fromname'] = $user_name;
-
- require_once "lib/MiniTemplator.class.php";
-
- $tpl = new MiniTemplator;
- $tpl_t = new MiniTemplator;
-
- $tpl->readTemplateFromFile("templates/email_article_template.txt");
-
- $tpl->setVariable('USER_NAME', $_SESSION["name"]);
- $tpl->setVariable('USER_EMAIL', $user_email);
- $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"]);
-
-
- $result = db_query($this->link, "SELECT link, content, title
- FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND
- id IN ($this->param) AND owner_uid = " . $_SESSION["uid"]);
-
- if (db_num_rows($result) > 1) {
- $subject = __("[Forwarded]") . " " . __("Multiple articles");
- }
-
- while ($line = db_fetch_assoc($result)) {
-
- if (!$subject)
- $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]);
-
- $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"]));
- $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"]));
-
- $tpl->addBlock('article');
- }
-
- $tpl->addBlock('email');
-
- $content = "";
- $tpl->generateOutputToString($content);
-
- print "<table width='100%'><tr><td>";
-
- print __('From:');
-
- print "</td><td>";
-
- print "<input dojoType=\"dijit.form.TextBox\" disabled=\"1\" style=\"width : 30em;\"
- value=\"$user_name <$user_email>\">";
-
- print "</td></tr><tr><td>";
-
- print __('To:');
-
- print "</td><td>";
-
- print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"
- style=\"width : 30em;\"
- name=\"destination\" id=\"emailArticleDlg_destination\">";
-
- print "<div class=\"autocomplete\" id=\"emailArticleDlg_dst_choices\"
- style=\"z-index: 30; display : none\"></div>";
-
- print "</td></tr><tr><td>";
-
- print __('Subject:');
-
- print "</td><td>";
-
- print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"
- style=\"width : 30em;\"
- name=\"subject\" value=\"$subject\" id=\"subject\">";
-
- print "</td></tr>";
-
- print "<tr><td colspan='2'><textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 100%' rows=\"20\"
- name='content'>$content</textarea>";
-
- print "</td></tr></table>";
-
- print "<div class='dlgButtons'>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').execute()\">".__('Send e-mail')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Cancel')."</button>";
- print "</div>";
-
- //return;
- }
-
function generatedFeed() {
print "<title>".__('View as RSS')."</title>";
$url_path = htmlspecialchars($this->params[2]) . "&key=" . $key;
- print __("You can view this feed as RSS using the following URL:");
+ print "<div class=\"dialogNotice\">" . __("You can view this feed as RSS using the following URL:") . "</div>";
print "<div class=\"tagCloudContainer\">";
print "<a id='gen_feed_url' href='$url_path' target='_blank'>$url_path</a>";
$value = str_replace("<br/>", "\n", $value);
+ print "<div class=\"dialogNotice\">";
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");
+ print "</div>";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setpref\">";
}
- function editArticleNote() {
- $result = db_query($this->link, "SELECT note FROM ttrss_user_entries WHERE
- ref_id = '$this->param' AND owner_uid = " . $_SESSION['uid']);
-
- $note = db_fetch_result($result, 0, "note");
-
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$this->param\">";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setNote\">";
-
- print "<table width='100%'><tr><td>";
- print "<textarea dojoType=\"dijit.form.SimpleTextarea\"
- style='font-size : 12px; width : 100%; height: 100px;'
- placeHolder='body#ttrssMain { font-size : 14px; };'
- name='note'>$note</textarea>";
- print "</td></tr></table>";
-
- print "<div class='dlgButtons'>";
- print "<button dojoType=\"dijit.form.Button\"
- onclick=\"dijit.byId('editNoteDlg').execute()\">".__('Save')."</button> ";
- print "<button dojoType=\"dijit.form.Button\"
- onclick=\"dijit.byId('editNoteDlg').hide()\">".__('Cancel')."</button>";
- print "</div>";
-
- }
-
- function about() {
- print "<table width='100%'><tr><td align='center'>";
- print "<img src=\"images/logo_big.png\">";
- print "</td>";
- print "<td width='70%'>";
-
- print "<h1>Tiny Riny RSS</h1>
- <strong>Version ".VERSION."</strong>
- <p>Copyright © 2005-".date('Y')."
- <a target=\"_blank\" class=\"visibleLink\"
- href=\"http://fakecake.org/\">Andrew Dolgov</a>
- and other contributors.</p>
- <p class=\"insensitive\">Licensed under GNU GPL version 2.</p>";
-
- print "<p class=\"insensitive\">
- <a class=\"visibleLink\" target=\"_blank\"
- href=\"http://tt-rss.org/\">Official site</a> —
- <a href=\"http://tt-rss.org/redmine/wiki/tt-rss/Donate\"
- target=\"_blank\" class=\"visibleLink\">
- Support the project.</a></p>";
-
- print "</td></tr>";
- print "</table>";
-
- print "<div align='center'>";
- print "<button dojoType=\"dijit.form.Button\"
- type=\"submit\">".
- __('Close this window')."</button>";
- print "</div>";
- }
-
function addInstance() {
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-instances\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">";
return;
}
- function shareArticle() {
- $result = db_query($this->link, "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '$this->param'
- AND owner_uid = " . $_SESSION['uid']);
+ function dataImport() {
+ header("Content-Type: text/html"); # required for iframe
- if (db_num_rows($result) == 0) {
- print "Article not found.";
- } else {
+ print "<div style='text-align : center'>";
- $uuid = db_fetch_result($result, 0, "uuid");
- $ref_id = db_fetch_result($result, 0, "ref_id");
+ if (is_file($_FILES['export_file']['tmp_name'])) {
- if (!$uuid) {
- $uuid = db_escape_string(sha1(uniqid(rand(), true)));
- db_query($this->link, "UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$this->param'
- AND owner_uid = " . $_SESSION['uid']);
- }
+ perform_data_import($this->link, $_FILES['export_file']['tmp_name'], $_SESSION['uid']);
- print __("You can share this article by the following unique URL:");
+ } else {
+ print "<p>" . T_sprintf("Could not upload file. You might need to adjust upload_max_filesize
+ in PHP.ini (current value = %s)", ini_get("upload_max_filesize")) . " or use CLI import tool.</p>";
- $url_path = get_self_url_prefix();
- $url_path .= "/public.php?op=share&key=$uuid";
+ }
- print "<div class=\"tagCloudContainer\">";
- print "<a id='pub_opml_url' href='$url_path' target='_blank'>$url_path</a>";
- print "</div>";
+ print "<button dojoType=\"dijit.form.Button\"
+ onclick=\"dijit.byId('dataImportDlg').hide()\">".
+ __('Close this window')."</button>";
- /* if (!label_find_id($this->link, __('Shared'), $_SESSION["uid"]))
- label_create($this->link, __('Shared'), $_SESSION["uid"]);
+ print "</div>";
+
+ }
+
+ function batchSubscribe() {
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchaddfeeds\">";
- label_add_article($this->link, $ref_id, __('Shared'), $_SESSION['uid']); */
+ print "<table width='100%'><tr><td>
+ ".__("Add one valid RSS feed per line (no feed detection is done)")."
+ </td><td align='right'>";
+ if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
+ print __('Place in category:') . " ";
+ print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"');
}
+ print "</td></tr><tr><td colspan='2'>";
+ print "<textarea
+ style='font-size : 12px; width : 100%; height: 200px;'
+ placeHolder=\"".__("Feeds to subscribe, One per line")."\"
+ dojoType=\"dijit.form.SimpleTextarea\" required=\"1\" name=\"feeds\"></textarea>";
- print "<div align='center'>";
+ print "</td></tr><tr><td colspan='2'>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('shareArticleDlg').hide()\">".
- __('Close this window')."</button>";
+ print "<div id='feedDlg_loginContainer' style='display : none'>
+ " .
+ " <input dojoType=\"dijit.form.TextBox\" name='login'\"
+ placeHolder=\"".__("Login")."\"
+ style=\"width : 10em;\"> ".
+ " <input
+ placeHolder=\"".__("Password")."\"
+ dojoType=\"dijit.form.TextBox\" type='password'
+ style=\"width : 10em;\" name='pass'\">".
+ " <p class='insensitive'>".__("OAuth will be used automatically for Twitter feeds.")."</p>
+ </div>";
- print "</div>";
+ print "</td></tr><tr><td colspan='2'>";
+
+ print "<div style=\"clear : both\">
+ <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"
+ onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>
+ <label for=\"feedDlg_loginCheck\">".
+ __('Feeds require authentication.')."</div>";
+
+ print "</form>";
+
+ print "</td></tr></table>";
+
+ print "<div class=\"dlgButtons\">
+ <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').execute()\">".__('Subscribe')."</button>
+ <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').hide()\">".__('Cancel')."</button>
+ </div>";
}
}