function edit() { $filter_id = db_escape_string($_REQUEST["id"]); $result = db_query($this->link, "SELECT * FROM ttrss_filters WHERE id = '{$filter_id}' AND owner_uid = " . $_SESSION["uid"]); $reg_exp = htmlspecialchars(db_fetch_result($result, 0, "reg_exp")); $filter_type = db_fetch_result($result, 0, "filter_type"); $feed_id = db_fetch_result($result, 0, "feed_id"); $cat_id = db_fetch_result($result, 0, "cat_id"); $action_id = db_fetch_result($result, 0, "action_id"); $action_param = db_fetch_result($result, 0, "action_param"); $filter_param = db_fetch_result($result, 0, "filter_param"); $enabled = sql_bool_to_bool(db_fetch_result($result, 0, "enabled")); $inverse = sql_bool_to_bool(db_fetch_result($result, 0, "inverse")); $cat_filter = sql_bool_to_bool(db_fetch_result($result, 0, "cat_filter")); print "<form id=\"filter_edit_form\" onsubmit='return false'>"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"{$filter_id}\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"csrf_token\" value=\"" . $_SESSION['csrf_token'] . "\">"; $result = db_query($this->link, "SELECT id,description\n\t\t\tFROM ttrss_filter_types ORDER BY description"); $filter_types = array(); while ($line = db_fetch_assoc($result)) { //array_push($filter_types, $line["description"]); $filter_types[$line["id"]] = __($line["description"]); } print "<div class=\"dlgSec\">" . __("Match") . "</div>"; print "<div class=\"dlgSecCont\">"; if ($filter_type != 5) { $date_ops_invisible = 'style="display : none"'; } print "<span id=\"filterDlg_dateModBox\" {$date_ops_invisible}>"; print __("Date") . " "; $filter_params = array("before" => __("before"), "after" => __("after")); print_select_hash("filter_date_modifier", $filter_param, $filter_params, 'dojoType="dijit.form.Select"'); print " </span>"; print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t required=\"1\"\n\t\t\t\t name=\"reg_exp\" style=\"font-size : 16px;\" value=\"{$reg_exp}\">"; print "<span id=\"filterDlg_dateChkBox\" {$date_ops_invisible}>"; print " <button dojoType=\"dijit.form.Button\" onclick=\"return filterDlgCheckDate()\">" . __('Check it') . "</button>"; print "</span>"; print "<hr/> " . __("on field") . " "; print_select_hash("filter_type", $filter_type, $filter_types, 'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"'); print "<hr/>"; print __("in") . " "; $hidden = $cat_filter ? "style='display:none'" : ""; print "<span id='filterDlg_feeds' {$hidden}>"; print_feed_select($this->link, "feed_id", $feed_id, 'dojoType="dijit.form.FilteringSelect"'); print "</span>"; $hidden = $cat_filter ? "" : "style='display:none'"; print "<span id='filterDlg_cats' {$hidden}>"; print_feed_cat_select($this->link, "cat_id", $cat_id, 'dojoType="dijit.form.FilteringSelect"'); print "</span>"; print "</div>"; print "<div class=\"dlgSec\">" . __("Perform Action") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<select name=\"action_id\" dojoType=\"dijit.form.Select\"\n\t\t\tonchange=\"filterDlgCheckAction(this)\">"; $result = db_query($this->link, "SELECT id,description FROM ttrss_filter_actions\n\t\t\tORDER BY name"); while ($line = db_fetch_assoc($result)) { $is_sel = $line["id"] == $action_id ? "selected=\"1\"" : ""; printf("<option value='%d' {$is_sel}>%s</option>", $line["id"], __($line["description"])); } print "</select>"; $param_hidden = $action_id == 4 || $action_id == 6 || $action_id == 7 ? "" : "display : none"; print "<span id=\"filterDlg_paramBox\" style=\"{$param_hidden}\">"; print " " . __("with parameters:") . " "; $param_int_hidden = $action_id != 7 ? "" : "display : none"; print "<input style=\"{$param_int_hidden}\"\n\t\t\t\tdojoType=\"dijit.form.TextBox\" id=\"filterDlg_actionParam\"\n\t\t\t\tname=\"action_param\" value=\"{$action_param}\">"; $param_int_hidden = $action_id == 7 ? "" : "display : none"; print_label_select($this->link, "action_param_label", $action_param, "style=\"{$param_int_hidden}\"" . 'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"'); print "</span>"; print " "; // tiny layout hack print "</div>"; print "<div class=\"dlgSec\">" . __("Options") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<div style=\"line-height : 100%\">"; if ($enabled) { $checked = "checked=\"1\""; } else { $checked = ""; } print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"enabled\" id=\"enabled\" {$checked}>\n\t\t\t\t<label for=\"enabled\">" . __('Enabled') . "</label><hr/>"; if ($inverse) { $checked = "checked=\"1\""; } else { $checked = ""; } print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\" {$checked}>\n\t\t\t<label for=\"inverse\">" . __('Inverse match') . "</label><hr/>"; if ($cat_filter) { $checked = "checked=\"1\""; } else { $checked = ""; } print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"cat_filter\" id=\"cat_filter\" onchange=\"filterDlgCheckCat(this)\" {$checked}>\n\t\t\t\t<label for=\"cat_filter\">" . __('Apply to category') . "</label><hr/>"; print "</div>"; print "</div>"; print "<div class=\"dlgButtons\">"; print "<div style=\"float : left\">"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').removeFilter()\">" . __('Remove') . "</button>"; print "</div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').test()\">" . __('Test') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">" . __('Save') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; }
function batchSubscribe() { print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchaddfeeds\">"; print "<table width='100%'><tr><td>\n\t\t\t" . __("Add one valid RSS feed per line (no feed detection is done)") . "\n\t\t</td><td align='right'>"; if (get_pref('ENABLE_FEED_CATS')) { print __('Place in category:') . " "; print_feed_cat_select("cat", false, 'dojoType="dijit.form.Select"'); } print "</td></tr><tr><td colspan='2'>"; print "<textarea\n\t\t\tstyle='font-size : 12px; width : 98%; height: 200px;'\n\t\t\tplaceHolder=\"" . __("Feeds to subscribe, One per line") . "\"\n\t\t\tdojoType=\"dijit.form.SimpleTextarea\" required=\"1\" name=\"feeds\"></textarea>"; print "</td></tr><tr><td colspan='2'>"; print "<div id='feedDlg_loginContainer' style='display : none'>\n\t\t\t\t" . " <input dojoType=\"dijit.form.TextBox\" name='login'\"\n\t\t\t\t\tplaceHolder=\"" . __("Login") . "\"\n\t\t\t\t\tstyle=\"width : 10em;\"> " . " <input\n\t\t\t\t\tplaceHolder=\"" . __("Password") . "\"\n\t\t\t\t\tdojoType=\"dijit.form.TextBox\" type='password'\n\t\t\t\t\tstyle=\"width : 10em;\" name='pass'\">" . "</div>"; print "</td></tr><tr><td colspan='2'>"; print "<div style=\"clear : both\">\n\t\t\t<input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"\n\t\t\t\t\tonclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>\n\t\t\t\t<label for=\"feedDlg_loginCheck\">" . __('Feeds require authentication.') . "</div>"; print "</form>"; print "</td></tr></table>"; print "<div class=\"dlgButtons\">\n\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').execute()\">" . __('Subscribe') . "</button>\n\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').hide()\">" . __('Cancel') . "</button>\n\t\t\t</div>"; }
function quickAddCat() { $cat = db_escape_string($_REQUEST["cat"]); add_feed_category($this->link, $cat); $result = db_query($this->link, "SELECT id FROM ttrss_feed_categories WHERE\n\t\t\ttitle = '{$cat}' AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) == 1) { $id = db_fetch_result($result, 0, "id"); } else { $id = 0; } print_feed_cat_select($this->link, "cat_id", $id); }
function print_feed_cat_select($id, $default_id, $attributes, $include_all_cats = true, $root_id = false, $nest_level = 0) { if (!$root_id) { print "<select id=\"{$id}\" name=\"{$id}\" default=\"{$default_id}\" onchange=\"catSelectOnChange(this)\" {$attributes}>"; } if ($root_id) { $parent_qpart = "parent_cat = '{$root_id}'"; } else { $parent_qpart = "parent_cat IS NULL"; } $result = db_query("SELECT id,title,\n\t\t\t\t(SELECT COUNT(id) FROM ttrss_feed_categories AS c2 WHERE\n\t\t\t\t\tc2.parent_cat = ttrss_feed_categories.id) AS num_children\n\t\t\t\tFROM ttrss_feed_categories\n\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . " AND {$parent_qpart} ORDER BY title"); while ($line = db_fetch_assoc($result)) { if ($line["id"] == $default_id) { $is_selected = "selected=\"1\""; } else { $is_selected = ""; } for ($i = 0; $i < $nest_level; $i++) { $line["title"] = " - " . $line["title"]; } if ($line["title"]) { printf("<option {$is_selected} value='%d'>%s</option>", $line["id"], htmlspecialchars($line["title"])); } if ($line["num_children"] > 0) { print_feed_cat_select($id, $default_id, $attributes, $include_all_cats, $line["id"], $nest_level + 1); } } if (!$root_id) { if ($include_all_cats) { if (db_num_rows($result) > 0) { print "<option disabled=\"1\">--------</option>"; } if ($default_id == 0) { $is_selected = "selected=\"1\""; } else { $is_selected = ""; } print "<option {$is_selected} value=\"0\">" . __('Uncategorized') . "</option>"; } print "</select>"; } }
function quickAddFeed() { 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=\"addfeed\">"; print "<div id='fadd_multiple_notify' style='display : none'>"; print_notice("Provided URL is a HTML page referencing multiple feeds, please select required feed from the dropdown menu below."); print "<p></div>"; print "<div class=\"dlgSec\">" . __("Feed or site URL") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<div style='float : right'>\n\t\t\t<img style='display : none'\n\t\t\t\tid='feed_add_spinner' src='images/indicator_white.gif'></div>"; print "<input style=\"font-size : 16px; width : 20em;\"\n\t\t\tplaceHolder=\"" . __("Feed or site URL") . "\"\n\t\t\tdojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"feed\" id=\"feedDlg_feedUrl\">"; print "<hr/>"; if (get_pref('ENABLE_FEED_CATS')) { print __('Place in category:') . " "; print_feed_cat_select("cat", false, 'dojoType="dijit.form.Select"'); } print "</div>"; print '<div id="feedDlg_feedsContainer" style="display : none"> <div class="dlgSec">' . __('Available feeds') . '</div> <div class="dlgSecCont">' . '<select id="feedDlg_feedContainerSelect" dojoType="dijit.form.Select" size="3"> <script type="dojo/method" event="onChange" args="value"> dijit.byId("feedDlg_feedUrl").attr("value", value); </script> </select>' . '</div></div>'; print "<div id='feedDlg_loginContainer' style='display : none'>\n\n\t\t\t\t<div class=\"dlgSec\">" . __("Authentication") . "</div>\n\t\t\t\t<div class=\"dlgSecCont\">" . " <input dojoType=\"dijit.form.TextBox\" name='login'\"\n\t\t\t\t\tplaceHolder=\"" . __("Login") . "\"\n\t\t\t\t\tstyle=\"width : 10em;\"> " . " <input\n\t\t\t\t\tplaceHolder=\"" . __("Password") . "\"\n\t\t\t\t\tdojoType=\"dijit.form.TextBox\" type='password'\n\t\t\t\t\tstyle=\"width : 10em;\" name='pass'\">\n\t\t\t</div></div>"; print "<div style=\"clear : both\">\n\t\t\t<input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"\n\t\t\t\t\tonclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>\n\t\t\t\t<label for=\"feedDlg_loginCheck\">" . __('This feed requires authentication.') . "</div>"; print "</form>"; print "<div class=\"dlgButtons\">\n\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">" . __('Subscribe') . "</button>"; if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) { print "<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">" . __('More feeds') . "</button>"; } print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">" . __('Cancel') . "</button>\n\t\t\t</div>"; //return; }
function editfeeds() { global $purge_intervals; global $update_intervals; global $update_methods; $feed_ids = db_escape_string($_REQUEST["ids"]); print "<div class=\"dialogNotice\">" . __("Enable the options you wish to apply using checkboxes on the right:") . "</div>"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"ids\" value=\"{$feed_ids}\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchEditSave\">"; print "<div class=\"dlgSec\">" . __("Feed") . "</div>"; print "<div class=\"dlgSecCont\">"; /* Title */ print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\tdisabled=\"1\" style=\"font-size : 16px; width : 20em;\" required=\"1\"\n\t\t\tname=\"title\" value=\"{$title}\">"; $this->batch_edit_cbox("title"); /* Feed URL */ print "<br/>"; print __('URL:') . " "; print "<input dojoType=\"dijit.form.ValidationTextBox\" disabled=\"1\"\n\t\t\trequired=\"1\" regExp='^(http|https)://.*' style=\"width : 20em\"\n\t\t\tname=\"feed_url\" value=\"{$feed_url}\">"; $this->batch_edit_cbox("feed_url"); /* Category */ if (get_pref($this->link, 'ENABLE_FEED_CATS')) { print "<br/>"; print __('Place in category:') . " "; print_feed_cat_select($this->link, "cat_id", $cat_id, 'disabled="1" dojoType="dijit.form.Select"'); $this->batch_edit_cbox("cat_id"); } print "</div>"; print "<div class=\"dlgSec\">" . __("Update") . "</div>"; print "<div class=\"dlgSecCont\">"; /* Update Interval */ print_select_hash("update_interval", $update_interval, $update_intervals, 'disabled="1" dojoType="dijit.form.Select"'); $this->batch_edit_cbox("update_interval"); /* Update method */ print " " . __('using') . " "; print_select_hash("update_method", $update_method, $update_methods, 'disabled="1" dojoType="dijit.form.Select"'); $this->batch_edit_cbox("update_method"); /* Purge intl */ if (FORCE_ARTICLE_PURGE == 0) { print "<br/>"; print __('Article purging:') . " "; print_select_hash("purge_interval", $purge_interval, $purge_intervals, 'disabled="1" dojoType="dijit.form.Select"'); $this->batch_edit_cbox("purge_interval"); } print "</div>"; print "<div class=\"dlgSec\">" . __("Authentication") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<input dojoType=\"dijit.form.TextBox\"\n\t\t\tplaceHolder=\"" . __("Login") . "\" disabled=\"1\"\n\t\t\tname=\"auth_login\" value=\"{$auth_login}\">"; $this->batch_edit_cbox("auth_login"); print "<br/><input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\"\n\t\t\tplaceHolder=\"" . __("Password") . "\" disabled=\"1\"\n\t\t\tvalue=\"{$auth_pass}\">"; $this->batch_edit_cbox("auth_pass"); print "</div>"; print "<div class=\"dlgSec\">" . __("Options") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<input disabled=\"1\" type=\"checkbox\" name=\"private\" id=\"private\"\n\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"private_l\" class='insensitive' for=\"private\">" . __('Hide from Popular feeds') . "</label>"; print " "; $this->batch_edit_cbox("private", "private_l"); print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"\n\t\t\tdojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"rtl_content_l\" for=\"rtl_content\">" . __('Right-to-left content') . "</label>"; print " "; $this->batch_edit_cbox("rtl_content", "rtl_content_l"); print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"include_in_digest\"\n\t\t\tname=\"include_in_digest\"\n\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"include_in_digest_l\" class='insensitive' for=\"include_in_digest\">" . __('Include in e-mail digest') . "</label>"; print " "; $this->batch_edit_cbox("include_in_digest", "include_in_digest_l"); print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"always_display_enclosures\"\n\t\t\tname=\"always_display_enclosures\"\n\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"always_display_enclosures_l\" class='insensitive' for=\"always_display_enclosures\">" . __('Always display image attachments') . "</label>"; print " "; $this->batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l"); print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"cache_images\"\n\t\t\tname=\"cache_images\"\n\t\t\tdojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"cache_images_l\"\n\t\t\tfor=\"cache_images\">" . __('Cache images locally') . "</label>"; print " "; $this->batch_edit_cbox("cache_images", "cache_images_l"); print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"mark_unread_on_update\"\n\t\t\tname=\"mark_unread_on_update\"\n\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"mark_unread_on_update_l\" class='insensitive' for=\"mark_unread_on_update\">" . __('Mark updated articles as unread') . "</label>"; print " "; $this->batch_edit_cbox("mark_unread_on_update", "mark_unread_on_update_l"); print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"update_on_checksum_change\"\n\t\t\tname=\"update_on_checksum_change\"\n\t\t\tdojoType=\"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>"; print " "; $this->batch_edit_cbox("update_on_checksum_change", "update_on_checksum_change_l"); print "</div>"; print "<div class='dlgButtons'>\n\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return dijit.byId('feedEditDlg').execute()\">" . __('Save') . "</button>\n\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\tonclick=\"return dijit.byId('feedEditDlg').hide()\">" . __('Cancel') . "</button>\n\t\t\t</div>"; return; }
function module_popup_dialog($link) { $id = $_REQUEST["id"]; $param = db_escape_string($_REQUEST["param"]); if ($id == "importOpml") { print "<div id=\"infoBoxTitle\">" . __('OPML Import') . "</div>"; print "<div class=\"infoBoxContents\">"; print "<div class=\"prefFeedCatHolder\">"; $owner_uid = $_SESSION["uid"]; db_query($link, "BEGIN"); /* create Imported feeds category just in case */ $result = db_query($link, "SELECT id FROM\n\t\t\t\tttrss_feed_categories WHERE title = 'Imported feeds' AND\n\t\t\t\towner_uid = '{$owner_uid}' LIMIT 1"); if (db_num_rows($result) == 0) { db_query($link, "INSERT INTO ttrss_feed_categories\n\t\t\t\t\t(title,owner_uid) \n\t\t\t\t\t\tVALUES ('Imported feeds', '{$owner_uid}')"); } db_query($link, "COMMIT"); /* Handle OPML import by DOMXML/DOMDocument */ if (function_exists('domxml_open_file')) { print "<ul class='nomarks'>"; print "<li>" . __("Importing using DOMXML.") . "</li>"; require_once "modules/opml_domxml.php"; opml_import_domxml($link, $owner_uid); print "</ul>"; } else { if (PHP_VERSION >= 5) { print "<ul class='nomarks'>"; print "<li>" . __("Importing using DOMDocument.") . "</li>"; require_once "modules/opml_domdoc.php"; opml_import_domdoc($link, $owner_uid); print "</ul>"; } else { print_error(__("DOMXML extension is not found. It is required for PHP versions below 5.")); } } print "</div>"; print "<div align='center'>"; print "<button onclick=\"return opmlImportDone()\">" . __('Close this window') . "</button>"; print "</div>"; print "<script type=\"text/javascript\">"; print "parent.opmlImportHandler(this)"; print "</script>"; print "</div></div>"; return; } if ($id == "editPrefProfiles") { print "<div id=\"infoBoxTitle\">" . __('Settings Profiles') . "</div>"; print "<div class=\"infoBoxContents\">"; print "<div><input id=\"fadd_profile\" \n\t\t\t\t\tonkeypress=\"return filterCR(event, addPrefProfile)\"\n\t\t\t\t\tsize=\"40\">\n\t\t\t\t\t<button onclick=\"javascript:addPrefProfile()\">" . __('Create profile') . "</button></div>"; print "<p>"; $result = db_query($link, "SELECT title,id FROM ttrss_settings_profiles\n\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY title"); print __('Select:') . " \n\t\t\t\t<a href=\"javascript:selectPrefRows('fcat', true)\">" . __('All') . "</a>,\n\t\t\t\t<a href=\"javascript:selectPrefRows('fcat', false)\">" . __('None') . "</a>"; print "<div class=\"prefFeedCatHolder\">"; print "<form id=\"profile_edit_form\" onsubmit=\"return false\">"; print "<table width=\"100%\" class=\"prefFeedCatList\" \n\t\t\t\tcellspacing=\"0\" id=\"prefFeedCatList\">"; print "<tr class=\"odd\" id=\"FCATR-0\">"; print "<td width='5%' align='center'><input \n\t\t\t\tonclick='toggleSelectPrefRow(this, \"fcat\");' \n\t\t\t\ttype=\"checkbox\" id=\"FCCHK-0\"></td>"; if (!$_SESSION["profile"]) { $is_active = __("(active)"); } else { $is_active = ""; } print "<td><span id=\"FCATT-0\">" . __("Default profile") . " {$is_active}</span></td>"; print "</tr>"; $lnum = 1; while ($line = db_fetch_assoc($result)) { $class = $lnum % 2 ? "even" : "odd"; $cat_id = $line["id"]; $this_row_id = "id=\"FCATR-{$cat_id}\""; print "<tr class=\"{$class}\" {$this_row_id}>"; $edit_title = htmlspecialchars($line["title"]); print "<td width='5%' align='center'><input \n\t\t\t\t\tonclick='toggleSelectPrefRow(this, \"fcat\");' \n\t\t\t\t\ttype=\"checkbox\" id=\"FCCHK-{$cat_id}\"></td>"; if ($_SESSION["profile"] == $line["id"]) { $is_active = __("(active)"); } else { $is_active = ""; } print "<td><span id=\"FCATT-{$cat_id}\">" . $edit_title . "</span> {$is_active}</td>"; print "</tr>"; ++$lnum; } print "</table>"; print "</form>"; print "</div>"; print "<div class='dlgButtons'>\n\t\t\t\t<div style='float : left'>\n\t\t\t\t<button onclick=\"return removeSelectedPrefProfiles()\">" . __('Remove') . "</button>\n\t\t\t\t<button onclick=\"return activatePrefProfile()\">" . __('Activate') . "</button>\n\t\t\t\t</div>"; print "<button onclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div></div>"; return; } if ($id == "pubUrl") { print "<div id=\"infoBoxTitle\">" . __('Published Articles') . "</div>"; print "<div class=\"infoBoxContents\">"; $url_path = article_publish_url($link); print __("Your Published articles feed URL is:"); print "<div class=\"tagCloudContainer\">"; print "<a id='pub_feed_url' href='{$url_path}' target='_blank'>{$url_path}</a>"; print "</div>"; print "<div align='center'>"; print "<button onclick=\"return pubRegenKey()\">" . __('Generate new URL') . "</button> "; print "<input class=\"button\"\n\t\t\t\ttype=\"submit\" onclick=\"return closeInfoBox()\" \n\t\t\t\tvalue=\"" . __('Close this window') . "\">"; print "</div></div>"; return; } if ($id == "pubOPMLUrl") { print "<div id=\"infoBoxTitle\">" . __('Public OPML URL') . "</div>"; print "<div class=\"infoBoxContents\">"; $url_path = opml_publish_url($link); print __("Your Public OPML URL is:"); print "<div class=\"tagCloudContainer\">"; print "<a id='pub_opml_url' href='{$url_path}' target='_blank'>{$url_path}</a>"; print "</div>"; print "<div align='center'>"; print "<button onclick=\"return opmlRegenKey()\">" . __('Generate new URL') . "</button> "; print "<input class=\"button\"\n\t\t\t\ttype=\"submit\" onclick=\"return closeInfoBox()\" \n\t\t\t\tvalue=\"" . __('Close this window') . "\">"; print "</div></div>"; return; } if ($id == "explainError") { print "<div id=\"infoBoxTitle\">" . __('Notice') . "</div>"; print "<div class=\"infoBoxContents\">"; print "<div class=\"errorExplained\">"; if ($param == 1) { 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."); $stamp = (int) read_stampfile("update_daemon.stamp"); print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); } if ($param == 2) { $msg = check_for_update($link); if (!$msg) { print __("You are running the latest version of Tiny Tiny RSS. The fact that you are seeing this dialog is probably a bug."); } else { print $msg; } } if ($param == 3) { 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."); $stamp = (int) read_stampfile("update_daemon.stamp"); print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); } print "</div>"; print "<div align='center'>"; print "<input class=\"button\"\n\t\t\t\ttype=\"submit\" onclick=\"return closeInfoBox()\" \n\t\t\t\tvalue=\"" . __('Close this window') . "\">"; print "</div></div>"; return; } if ($id == "quickAddFeed") { print "<div id=\"infoBoxTitle\">" . __('Subscribe to Feed') . "</div>"; print "<div class=\"infoBoxContents\">"; print "<form id='feed_add_form' onsubmit='return false'>"; print "<input type=\"hidden\" name=\"op\" value=\"rpc\">"; print "<input type=\"hidden\" name=\"subop\" value=\"addfeed\">"; //print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">"; print "<div class=\"dlgSec\">" . __("Feed") . "</div>"; print "<div class=\"dlgSecCont\">"; print __("URL:") . " "; print "<input size=\"40\"\n\t\t\t\t\tonkeypress=\"return filterCR(event, subscribeToFeed)\"\n\t\t\t\t\tname=\"feed\" id=\"feed_url\"></td></tr>"; print "<br/>"; if (get_pref($link, 'ENABLE_FEED_CATS')) { print __('Place in category:') . " "; print_feed_cat_select($link, "cat"); } print "</div>"; print "<div id='fadd_login_container' style='display:none'>\n\t\n\t\t\t\t\t<div class=\"dlgSec\">" . __("Authentication") . "</div>\n\t\t\t\t\t<div class=\"dlgSecCont\">" . __('Login:'******'login' size=\"20\" \n\t\t\t\t\t\t\tonkeypress=\"return filterCR(event, subscribeToFeed)\"> " . __('Password:'******'password'\n\t\t\t\t\t\t\tname='pass' size=\"20\" \n\t\t\t\t\t\t\tonkeypress=\"return filterCR(event, subscribeToFeed)\">\n\t\t\t\t</div></div>"; print "<div style=\"clear : both\">\t\t\t\t\n\t\t\t\t<input type=\"checkbox\" id=\"fadd_login_check\" \n\t\t\t\t\t\tonclick='checkboxToggleElement(this, \"fadd_login_container\")'>\n\t\t\t\t\t<label for=\"fadd_login_check\">" . __('This feed requires authentication.') . "</div>"; print "</form>"; print "<div class=\"dlgButtons\">\n\t\t\t\t<button class=\"button\" id=\"fadd_submit_btn\"\n\t\t\t\t\tonclick=\"return subscribeToFeed()\">" . __('Subscribe') . "</button>\n\t\t\t\t<button onclick=\"return displayDlg('feedBrowser')\">" . __('More feeds') . "</button>\n\t\t\t\t<button onclick=\"return closeInfoBox()\">" . __('Cancel') . "</button></div>"; return; } if ($id == "feedBrowser") { print "<div id=\"infoBoxTitle\">" . __('Feed Browser') . "</div>"; print "<div class=\"infoBoxContents\">"; $browser_search = db_escape_string($_REQUEST["search"]); print "<form onsubmit='return false;' display='inline' \n\t\t\t\tname='feed_browser' id='feed_browser'>"; print "<input type=\"hidden\" name=\"op\" value=\"rpc\">"; print "<input type=\"hidden\" name=\"subop\" value=\"updateFeedBrowser\">"; print "\n\t\t\t\t<div style='float : right'>\n\t\t\t\t<img style='display : none' \n\t\t\t\t\tid='feed_browser_spinner' src='" . theme_image($link, 'images/indicator_white.gif') . "'>\n\t\t\t\t<input name=\"search\" size=\"20\" type=\"search\"\n\t\t\t\t\tonchange=\"javascript:updateFeedBrowser()\" value=\"{$browser_search}\">\n\t\t\t\t<button onclick=\"javascript:updateFeedBrowser()\">" . __('Search') . "</button>\n\t\t\t</div>"; print " <select name=\"mode\" onchange=\"updateFeedBrowser()\">\n\t\t\t\t<option value='1'>" . __('Popular feeds') . "</option>\n\t\t\t\t<option value='2'>" . __('Feed archive') . "</option>\n\t\t\t\t</select> "; print __("limit:"); print " <select name=\"limit\" onchange='updateFeedBrowser()'>"; foreach (array(25, 50, 100, 200) as $l) { $issel = $l == $limit ? "selected" : ""; print "<option {$issel}>{$l}</option>"; } print "</select> "; print "<p>"; $owner_uid = $_SESSION["uid"]; /* print __('Select:')." <a href=\"javascript:selectPrefRows('fbrowse', true)\">".__('All')."</a>, <a href=\"javascript:selectPrefRows('fbrowse', false)\">".__('None')."</a>"; */ print "<ul class='browseFeedList' id='browseFeedList'>"; print_feed_browser($link, $search, 25); print "</ul>"; print "<div align='center'>\n\t\t\t\t<button onclick=\"feedBrowserSubscribe()\">" . __('Subscribe') . "</button>\n\t\t\t\t<button style='display : none' id='feed_archive_remove' onclick=\"feedArchiveRemove()\">" . __('Remove') . "</button>\n\t\t\t\t<button onclick=\"closeInfoBox()\" >" . __('Cancel') . "</button></div>"; print "</div>"; return; } if ($id == "search") { print "<div id=\"infoBoxTitle\">" . __('Search') . "</div>"; print "<div class=\"infoBoxContents\">"; print "<form id='search_form' onsubmit='return false'>"; #$active_feed_id = db_escape_string($_REQUEST["param"]); $params = split(":", db_escape_string($_REQUEST["param"])); $active_feed_id = sprintf("%d", $params[0]); $is_cat = $params[1] == "true"; print "<div class=\"dlgSec\">" . __('Look for') . "</div>"; print "<div class=\"dlgSecCont\">"; print "<input onkeypress=\"return filterCR(event, search)\"\n\t\t\t\tname=\"query\" size=\"20\" type=\"search\"\tvalue=''>"; print " " . __('match on') . " "; $search_fields = array("title" => __("Title"), "content" => __("Content"), "both" => __("Title or content")); print_select_hash("match_on", 3, $search_fields); print "<br/>" . __('Limit search to:') . " "; print "<select name=\"search_mode\">\n\t\t\t\t<option value=\"all_feeds\">" . __('All feeds') . "</option>"; $feed_title = getFeedTitle($link, $active_feed_id); if (!$is_cat) { $feed_cat_title = getFeedCatTitle($link, $active_feed_id); } else { $feed_cat_title = getCategoryTitle($link, $active_feed_id); } if ($active_feed_id && !$is_cat) { print "<option selected value=\"this_feed\">{$feed_title}</option>"; } else { print "<option disabled>" . __('This feed') . "</option>"; } if ($is_cat) { $cat_preselected = "selected"; } if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) { print "<option {$cat_preselected} value=\"this_cat\">{$feed_cat_title}</option>"; } else { //print "<option disabled>".__('This category')."</option>"; } print "</select>"; print "</div>"; print "</form>"; print "<div class=\"dlgButtons\">\n\t\t\t<button onclick=\"javascript:search()\">" . __('Search') . "</button>\n\t\t\t<button onclick=\"javascript:closeInfoBox(true)\">" . __('Cancel') . "</button>\n\t\t\t</div>"; print "</div>"; return; } if ($id == "quickAddFilter") { $active_feed_id = db_escape_string($_REQUEST["param"]); print "<div id=\"infoBoxTitle\">" . __('Create Filter') . "</div>"; print "<div class=\"infoBoxContents\">"; print "<form id=\"filter_add_form\" onsubmit='return false'>"; print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">"; print "<input type=\"hidden\" name=\"quiet\" value=\"1\">"; print "<input type=\"hidden\" name=\"subop\" value=\"add\">"; $result = db_query($link, "SELECT id,description \n\t\t\t\tFROM ttrss_filter_types ORDER BY description"); $filter_types = array(); while ($line = db_fetch_assoc($result)) { //array_push($filter_types, $line["description"]); $filter_types[$line["id"]] = __($line["description"]); } print "<div class=\"dlgSec\">" . __("Match") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<span id=\"filter_dlg_date_mod_box\" style=\"display : none\">"; print __("Date") . " "; $filter_params = array("before" => __("before"), "after" => __("after")); print_select_hash("filter_date_modifier", "before", $filter_params); print " </span>"; print "<input onkeypress=\"return filterCR(event, createFilter)\"\n\t\t\t\t name=\"reg_exp\" size=\"30\" value=\"{$reg_exp}\">"; print "<span id=\"filter_dlg_date_chk_box\" style=\"display : none\">"; print " <input class=\"button\"\n\t\t\t\ttype=\"submit\" onclick=\"return filterDlgCheckDate()\" \n\t\t\t\tvalue=\"" . __('Check it') . "\">"; print "</span>"; print "<br/> " . __("on field") . " "; print_select_hash("filter_type", 1, $filter_types, 'onchange="filterDlgCheckType(this)"'); print "<br/>"; print __("in") . " "; print_feed_select($link, "feed_id", $active_feed_id); print "</div>"; print "<div class=\"dlgSec\">" . __("Perform Action") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<select name=\"action_id\"\n\t\t\t\tonchange=\"filterDlgCheckAction(this)\">"; $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions \n\t\t\t\tORDER BY name"); while ($line = db_fetch_assoc($result)) { printf("<option value='%d'>%s</option>", $line["id"], __($line["description"])); } print "</select>"; print "<span id=\"filter_dlg_param_box\" style=\"display : none\">"; print " " . __("with parameters:") . " "; print "<input size=\"20\"\n\t\t\t\t\tonkeypress=\"return filterCR(event, createFilter)\"\n\t\t\t\t\tname=\"action_param\">"; print_label_select($link, "action_param_label", $action_param); print "</span>"; print " "; // tiny layout hack print "</div>"; print "<div class=\"dlgSec\">" . __("Options") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<div style=\"line-height : 100%\">"; print "<input type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\">\n\t\t\t\t\t<label for=\"enabled\">" . __('Enabled') . "</label><br/>"; print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">\n\t\t\t\t<label for=\"inverse\">" . __('Inverse match') . "</label>"; print "</div>"; print "</div>"; print "</form>"; print "<div class=\"dlgButtons\">"; print "<button onclick=\"return createFilter()\">" . __('Create') . "</button> "; print "<button onclick=\"return closeInfoBox()\">" . __('Cancel') . "</button>"; print "</div>"; // print "</td></tr></table>"; return; } if ($id == "feedUpdateErrors") { print "<div id=\"infoBoxTitle\">" . __('Update Errors') . "</div>"; print "<div class=\"infoBoxContents\">"; print __("These feeds have not been updated because of errors:"); $result = db_query($link, "SELECT id,title,feed_url,last_error\n\t\t\tFROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION["uid"]); print "<ul class='feedErrorsList'>"; while ($line = db_fetch_assoc($result)) { print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " . "<em>" . $line["last_error"] . "</em>"; } print "</ul>"; print "<div align='center'>"; print "<button onclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; return; } if ($id == "editArticleTags") { print "<div id=\"infoBoxTitle\">" . __('Edit Tags') . "</div>"; print "<div class=\"infoBoxContents\">"; print "<form id=\"tag_edit_form\" onsubmit='return false'>"; print __("Tags for this article (separated by commas):") . "<br>"; $tags = get_article_tags($link, $param); $tags_str = join(", ", $tags); print "<table width='100%'>"; print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"{$param}\"></td></tr>"; print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str' \n\t\t\t\tname='tags_str'>{$tags_str}</textarea>\n\t\t\t<div class=\"autocomplete\" id=\"tags_choices\" \n\t\t\t\t\tstyle=\"display:none\"></div>\t\n\t\t\t</td></tr>"; print "</table>"; print "</form>"; print "<div align='right'>"; print "<button onclick=\"return editTagsSave()\">" . __('Save') . "</button> "; print "<button onclick=\"return closeInfoBox()\">" . __('Cancel') . "</button>"; print "</div>"; return; } if ($id == "printTagCloud") { print "<div id=\"infoBoxTitle\">" . __('Tag Cloud') . "</div>"; print "<div class=\"infoBoxContents\">"; print __("Showing most popular tags ") . " (<a \n\t\t\thref='javascript:toggleTags(true)'>" . __('more tags') . "</a>):<br/>"; print "<div class=\"tagCloudContainer\">"; printTagCloud($link); print "</div>"; print "<div align='center'>"; print "<button onclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; print "</div>"; return; } /* if ($id == "offlineDownload") { print "<div id=\"infoBoxTitle\">".__('Download articles')."</div>"; print "<div class=\"infoBoxContents\">"; print "<form name='download_ops_form' id='download_ops_form'>"; print "<div class=\"dlgSec\">".__("Download")."</div>"; print "<div class=\"dlgSecCont\">"; $amount = array( 50 => 50, 100 => 100, 250 => 250, 500 => 500); print_select_hash("amount", 50, $amount); print " " . __("latest articles for offline reading."); print "<br/>"; print "<input checked='yes' type='checkbox' name='unread_only' id='unread_only'>"; print "<label for='unread_only'>".__('Only include unread articles')."</label>"; print "</div>"; print "</form>"; print "<div class=\"dlgButtons\"> <input class=\"button\" type=\"submit\" onclick=\"return initiate_offline_download(0, this)\" value=\"".__('Download')."\"> <input class=\"button\" type=\"submit\" onclick=\"return closeInfoBox()\" value=\"".__('Cancel')."\"></div>"; print "</div>"; return; } */ print "<div id='infoBoxTitle'>Internal Error</div>\n\t\t\t<div id='infoBoxContents'>\n\t\t\t<p>Unknown dialog <b>{$id}</b></p>\n\t\t\t</div></div>"; }
function module_popup_dialog($link) { $id = $_REQUEST["id"]; $param = db_escape_string($_REQUEST["param"]); print "<dlg id=\"{$id}\">"; if ($id == "importOpml") { print "<div class=\"prefFeedOPMLHolder\">"; header("Content-Type: text/html"); # required for iframe $owner_uid = $_SESSION["uid"]; db_query($link, "BEGIN"); /* create Imported feeds category just in case */ $result = db_query($link, "SELECT id FROM\n\t\t\t\tttrss_feed_categories WHERE title = 'Imported feeds' AND\n\t\t\t\towner_uid = '{$owner_uid}' LIMIT 1"); if (db_num_rows($result) == 0) { db_query($link, "INSERT INTO ttrss_feed_categories\n\t\t\t\t\t(title,owner_uid)\n\t\t\t\t\t\tVALUES ('Imported feeds', '{$owner_uid}')"); } db_query($link, "COMMIT"); /* 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($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($link, $owner_uid); print "</ul>"; } else { print_error(__("DOMXML extension is not found. It is required for PHP versions below 5.")); } } print "</div>"; print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('opmlImportDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; print "</div>"; //return; } if ($id == "editPrefProfiles") { print "<div dojoType=\"dijit.Toolbar\">"; # TODO: depends on selectTableRows() being broken for this list # 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\"\n\t\t\t\t\trequired=\"1\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('profileEditDlg').addProfile()\">" . __('Create profile') . "</button></div>"; # print "</div>"; $result = db_query($link, "SELECT title,id FROM ttrss_settings_profiles\n\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY title"); print "<div class=\"prefFeedCatHolder\">"; print "<form id=\"profile_edit_form\" onsubmit=\"return false\">"; print "<table width=\"100%\" class=\"prefFeedProfileList\"\n\t\t\t\tcellspacing=\"0\" id=\"prefFeedProfileList\">"; print "<tr class=\"\" id=\"FCATR-0\">"; #odd print "<td width='5%' align='center'><input\n\t\t\t\tonclick='toggleSelectRow2(this);'\n\t\t\t\tdojoType=\"dijit.form.CheckBox\"\n\t\t\t\ttype=\"checkbox\"></td>"; if (!$_SESSION["profile"]) { $is_active = __("(active)"); } else { $is_active = ""; } print "<td><span>" . __("Default profile") . " {$is_active}</span></td>"; print "</tr>"; $lnum = 1; while ($line = db_fetch_assoc($result)) { $class = $lnum % 2 ? "even" : "odd"; $profile_id = $line["id"]; $this_row_id = "id=\"FCATR-{$profile_id}\""; print "<tr class=\"\" {$this_row_id}>"; $edit_title = htmlspecialchars($line["title"]); print "<td width='5%' align='center'><input\n\t\t\t\t\tonclick='toggleSelectRow2(this);'\n\t\t\t\t\tdojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\ttype=\"checkbox\"></td>"; if ($_SESSION["profile"] == $line["id"]) { $is_active = __("(active)"); } else { $is_active = ""; } print "<td><span dojoType=\"dijit.InlineEditBox\"\n\t\t\t\t\twidth=\"300px\" autoSave=\"false\"\n\t\t\t\t\tprofile-id=\"{$profile_id}\">" . $edit_title . "<script type=\"dojo/method\" event=\"onChange\" args=\"item\">\n\t\t\t\t\t\tvar elem = this;\n\t\t\t\t\t\tdojo.xhrPost({\n\t\t\t\t\t\t\turl: 'backend.php',\n\t\t\t\t\t\t\tcontent: {op: 'rpc', subop: 'saveprofile',\n\t\t\t\t\t\t\t\tvalue: this.value,\n\t\t\t\t\t\t\t\tid: this.srcNodeRef.getAttribute('profile-id')},\n\t\t\t\t\t\t\t\tload: function(response) {\n\t\t\t\t\t\t\t\t\telem.attr('value', response);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>\n\t\t\t\t</span> {$is_active}</td>"; print "</tr>"; ++$lnum; } print "</table>"; print "</form>"; print "</div>"; print "<div class='dlgButtons'>\n\t\t\t\t<div style='float : left'>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').removeSelected()\">" . __('Remove selected profiles') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').activateProfile()\">" . __('Activate profile') . "</button>\n\t\t\t\t</div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; } if ($id == "pubOPMLUrl") { print "<title>" . __('Public OPML URL') . "</title>"; print "<content><![CDATA["; $url_path = opml_publish_url($link); print __("Your Public OPML URL is:"); print "<div class=\"tagCloudContainer\">"; print "<a id='pub_opml_url' href='{$url_path}' target='_blank'>{$url_path}</a>"; print "</div>"; print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">" . __('Generate new URL') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; print "]]></content>"; //return; } if ($id == "explainError") { print "<title>" . __('Notice') . "</title>"; print "<content><![CDATA["; print "<div class=\"errorExplained\">"; if ($param == 1) { 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."); $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); } if ($param == 3) { 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."); $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); } print "</div>"; print "<div align='center'>"; print "<button onclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; print "]]></content>"; //return; } if ($id == "quickAddFeed") { print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"addfeed\">"; print "<div class=\"dlgSec\">" . __("Feed") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<input style=\"font-size : 16px; width : 20em;\"\n\t\t\t\tplaceHolder=\"" . __("Feed URL") . "\"\n\t\t\t\tdojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"feed\" id=\"feedDlg_feedUrl\">"; print "<hr/>"; if (get_pref($link, 'ENABLE_FEED_CATS')) { print __('Place in category:') . " "; print_feed_cat_select($link, "cat", false, 'dojoType="dijit.form.Select"'); } print "</div>"; print '<div id="feedDlg_feedsContainer" style="display : none"> <div class="dlgSec">' . __('Available feeds') . '</div> <div class="dlgSecCont">' . '<select id="feedDlg_feedContainerSelect" dojoType="dijit.form.Select" size="3"> <script type="dojo/method" event="onChange" args="value"> dijit.byId("feedDlg_feedUrl").attr("value", value); </script> </select>' . '</div></div>'; print "<div id='feedDlg_loginContainer' style='display : none'>\n\n\t\t\t\t\t<div class=\"dlgSec\">" . __("Authentication") . "</div>\n\t\t\t\t\t<div class=\"dlgSecCont\">" . " <input dojoType=\"dijit.form.TextBox\" name='login'\"\n\t\t\t\t\t\tplaceHolder=\"" . __("Login") . "\"\n\t\t\t\t\t\tstyle=\"width : 10em;\"> " . " <input\n\t\t\t\t\t\tplaceHolder=\"" . __("Password") . "\"\n\t\t\t\t\t\tdojoType=\"dijit.form.TextBox\" type='password'\n\t\t\t\t\t\tstyle=\"width : 10em;\" name='pass'\">\n\t\t\t\t</div></div>"; print "<div style=\"clear : both\">\n\t\t\t\t<input type=\"checkbox\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"\n\t\t\t\t\t\tonclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>\n\t\t\t\t\t<label for=\"feedDlg_loginCheck\">" . __('This feed requires authentication.') . "</div>"; print "</form>"; print "<div class=\"dlgButtons\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">" . __('Subscribe') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">" . __('More feeds') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">" . __('Cancel') . "</button>\n\t\t\t\t</div>"; //return; } if ($id == "feedBrowser") { $browser_search = db_escape_string($_REQUEST["search"]); # print "<form onsubmit='return false;' display='inline' # name='feed_browser' id='feed_browser'>"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"updateFeedBrowser\">"; print "<div dojoType=\"dijit.Toolbar\">\n\t\t\t\t<div style='float : right'>\n\t\t\t\t<img style='display : none'\n\t\t\t\t\tid='feed_browser_spinner' src='" . theme_image($link, 'images/indicator_white.gif') . "'>\n\t\t\t\t<input name=\"search\" dojoType=\"dijit.form.TextBox\" size=\"20\" type=\"search\"\n\t\t\t\t\tonchange=\"dijit.byId('feedBrowserDlg').update()\" value=\"{$browser_search}\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').update()\">" . __('Search') . "</button>\n\t\t\t</div>"; print " <select name=\"mode\" dojoType=\"dijit.form.Select\" onchange=\"dijit.byId('feedBrowserDlg').update()\">\n\t\t\t\t<option value='1'>" . __('Popular feeds') . "</option>\n\t\t\t\t<option value='2'>" . __('Feed archive') . "</option>\n\t\t\t\t</select> "; print __("limit:"); print " <select dojoType=\"dijit.form.Select\" name=\"limit\" onchange=\"dijit.byId('feedBrowserDlg').update()\">"; foreach (array(25, 50, 100, 200) as $l) { $issel = $l == $limit ? "selected=\"1\"" : ""; print "<option {$issel} value=\"{$l}\">{$l}</option>"; } print "</select> "; print "</div>"; $owner_uid = $_SESSION["uid"]; print "<ul class='browseFeedList' id='browseFeedList'>"; print make_feed_browser($link, $search, 25); print "</ul>"; print "<div align='center'>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').execute()\">" . __('Subscribe') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" style='display : none' id='feed_archive_remove' onclick=\"dijit.byId('feedBrowserDlg').removeFromArchive()\">" . __('Remove') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').hide()\" >" . __('Cancel') . "</button></div>"; } if ($id == "search") { $params = explode(":", db_escape_string($_REQUEST["param"]), 2); $active_feed_id = sprintf("%d", $params[0]); $is_cat = $params[1] != "false"; print "<div class=\"dlgSec\">" . __('Look for') . "</div>"; print "<div class=\"dlgSecCont\">"; if (!SPHINX_ENABLED) { print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\tstyle=\"font-size : 16px; width : 12em;\"\n\t\t\t\t\trequired=\"1\" name=\"query\" type=\"search\" value=''>"; print " " . __('match on') . " "; $search_fields = array("title" => __("Title"), "content" => __("Content"), "both" => __("Title or content")); print_select_hash("match_on", 3, $search_fields, 'dojoType="dijit.form.Select"'); } else { print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\tstyle=\"font-size : 16px; width : 20em;\"\n\t\t\t\t\trequired=\"1\" name=\"query\" type=\"search\" value=''>"; } print "<hr/>" . __('Limit search to:') . " "; print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\">\n\t\t\t\t<option value=\"all_feeds\">" . __('All feeds') . "</option>"; $feed_title = getFeedTitle($link, $active_feed_id); if (!$is_cat) { $feed_cat_title = getFeedCatTitle($link, $active_feed_id); } else { $feed_cat_title = getCategoryTitle($link, $active_feed_id); } if ($active_feed_id && !$is_cat) { print "<option selected=\"1\" value=\"this_feed\">{$feed_title}</option>"; } else { print "<option disabled=\"1\" value=\"false\">" . __('This feed') . "</option>"; } if ($is_cat) { $cat_preselected = "selected=\"1\""; } if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) { print "<option {$cat_preselected} value=\"this_cat\">{$feed_cat_title}</option>"; } else { //print "<option disabled>".__('This category')."</option>"; } print "</select>"; print "</div>"; print "<div class=\"dlgButtons\">"; if (!SPHINX_ENABLED) { print "<div style=\"float : left\">\n\t\t\t\t\t<a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/redmine/wiki/tt-rss/SearchSyntax\">Search syntax</a>\n\t\t\t\t\t</div>"; } print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">" . __('Search') . "</button>\n\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">" . __('Cancel') . "</button>\n\t\t\t</div>"; } if ($id == "quickAddFilter") { $active_feed_id = db_escape_string($_REQUEST["param"]); 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=\"subop\" value=\"add\">"; $result = db_query($link, "SELECT id,description\n\t\t\t\tFROM ttrss_filter_types ORDER BY description"); $filter_types = array(); while ($line = db_fetch_assoc($result)) { //array_push($filter_types, $line["description"]); $filter_types[$line["id"]] = __($line["description"]); } print "<div class=\"dlgSec\">" . __("Match") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<span id=\"filterDlg_dateModBox\" style=\"display : none\">"; $filter_params = array("before" => __("before"), "after" => __("after")); print_select_hash("filter_date_modifier", "before", $filter_params, 'dojoType="dijit.form.Select"'); print " </span>"; print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t required=\"true\" id=\"filterDlg_regExp\"\n\t\t\t\t style=\"font-size : 16px\"\n\t\t\t\t name=\"reg_exp\" value=\"{$reg_exp}\"/>"; print "<span id=\"filterDlg_dateChkBox\" style=\"display : none\">"; print " <button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return filterDlgCheckDate()\">" . __('Check it') . "</button>"; print "</span>"; print "<hr/>" . __("on field") . " "; print_select_hash("filter_type", 1, $filter_types, 'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"'); print "<hr/>"; print __("in") . " "; print_feed_select($link, "feed_id", $active_feed_id, 'dojoType="dijit.form.FilteringSelect"'); print "</div>"; print "<div class=\"dlgSec\">" . __("Perform Action") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<select name=\"action_id\" dojoType=\"dijit.form.Select\"\n\t\t\t\tonchange=\"filterDlgCheckAction(this)\">"; $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions\n\t\t\t\tORDER BY name"); while ($line = db_fetch_assoc($result)) { printf("<option value='%d'>%s</option>", $line["id"], __($line["description"])); } print "</select>"; print "<span id=\"filterDlg_paramBox\" style=\"display : none\">"; print " " . __("with parameters:") . " "; print "<input dojoType=\"dijit.form.TextBox\"\n\t\t\t\tid=\"filterDlg_actionParam\"\n\t\t\t\tname=\"action_param\">"; print_label_select($link, "action_param_label", $action_param, 'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"'); print "</span>"; print " "; // tiny layout hack print "</div>"; print "<div class=\"dlgSec\">" . __("Options") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\">\n\t\t\t\t\t<label for=\"enabled\">" . __('Enabled') . "</label><hr/>"; print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\">\n\t\t\t\t<label for=\"inverse\">" . __('Inverse match') . "</label>"; print "</div>"; print "<div class=\"dlgButtons\">"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').test()\">" . __('Test') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">" . __('Create') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; //return; } if ($id == "inactiveFeeds") { if (DB_TYPE == "pgsql") { $interval_qpart = "NOW() - INTERVAL '3 months'"; } else { $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)"; } $result = db_query($link, "SELECT ttrss_feeds.title, ttrss_feeds.site_url,\n\t\t\t \t\tttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article\n\t\t\t\tFROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE\n\t\t\t\t\t(SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE\n\t\t\t\t\t\tttrss_entries.id = ref_id AND\n\t\t\t\t\t\t\tttrss_user_entries.feed_id = ttrss_feeds.id) < {$interval_qpart}\n\t\t\t\tAND ttrss_feeds.owner_uid = " . $_SESSION["uid"] . " AND\n\t\t\t\t\tttrss_user_entries.feed_id = ttrss_feeds.id AND\n\t\t\t\t\tttrss_entries.id = ref_id\n\t\t\t\tGROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url\n\t\t\t\tORDER BY last_article"); print __("These feeds have not been updated with new content for 3 months (oldest first):"); print "<div class=\"inactiveFeedHolder\">"; print "<table width=\"100%\" cellspacing=\"0\" id=\"prefInactiveFeedList\">"; $lnum = 1; while ($line = db_fetch_assoc($result)) { $class = $lnum % 2 ? "even" : "odd"; $feed_id = $line["id"]; $this_row_id = "id=\"FUPDD-{$feed_id}\""; print "<tr class=\"\" {$this_row_id}>"; $edit_title = htmlspecialchars($line["title"]); print "<td width='5%' align='center'><input\n\t\t\t\t\tonclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\ttype=\"checkbox\"></td>"; print "<td>"; print "<a class=\"visibleLink\" href=\"#\" " . "title=\"" . __("Click to edit feed") . "\" " . "onclick=\"editFeed(" . $line["id"] . ")\">" . htmlspecialchars($line["title"]) . "</a>"; print "</td><td class=\"insensitive\" align='right'>"; print make_local_datetime($link, $line['last_article'], false); print "</td>"; print "</tr>"; ++$lnum; } print "</table>"; print "</div>"; print "<div class='dlgButtons'>"; print "<div style='float : left'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').removeSelected()\">" . __('Unsubscribe from selected feeds') . "</button> "; print "</div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; } if ($id == "feedsWithErrors") { # print "<title>".__('Feeds with update errors')."</title>"; # print "<content><![CDATA["; print __("These feeds have not been updated because of errors:"); $result = db_query($link, "SELECT id,title,feed_url,last_error,site_url\n\t\t\tFROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION["uid"]); print "<div class=\"inactiveFeedHolder\">"; print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">"; $lnum = 1; while ($line = db_fetch_assoc($result)) { $class = $lnum % 2 ? "even" : "odd"; $feed_id = $line["id"]; $this_row_id = "id=\"FUPDD-{$feed_id}\""; print "<tr class=\"\" {$this_row_id}>"; $edit_title = htmlspecialchars($line["title"]); print "<td width='5%' align='center'><input\n\t\t\t\t\tonclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\ttype=\"checkbox\"></td>"; print "<td>"; print "<a class=\"visibleLink\" href=\"#\" " . "title=\"" . __("Click to edit feed") . "\" " . "onclick=\"editFeed(" . $line["id"] . ")\">" . htmlspecialchars($line["title"]) . "</a>: "; print "<span class=\"insensitive\">"; print htmlspecialchars($line["last_error"]); print "</span>"; print "</td>"; print "</tr>"; ++$lnum; } print "</table>"; print "</div>"; print "<div class='dlgButtons'>"; print "<div style='float : left'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').removeSelected()\">" . __('Unsubscribe from selected feeds') . "</button> "; print "</div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; } if ($id == "editArticleTags") { # print "<form id=\"tag_edit_form\" onsubmit='return false'>"; print __("Tags for this article (separated by commas):") . "<br>"; $tags = get_article_tags($link, $param); $tags_str = join(", ", $tags); print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"{$param}\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"setArticleTags\">"; print "<table width='100%'><tr><td>"; print "<textarea dojoType=\"dijit.form.SimpleTextarea\" rows='4'\n\t\t\t\tstyle='font-size : 12px; width : 100%' id=\"tags_str\"\n\t\t\t\tname='tags_str'>{$tags_str}</textarea>\n\t\t\t<div class=\"autocomplete\" id=\"tags_choices\"\n\t\t\t\t\tstyle=\"display:none\"></div>"; print "</td></tr></table>"; # print "</form>"; print "<div class='dlgButtons'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('editTagsDlg').execute()\">" . __('Save') . "</button> "; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('editTagsDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; } if ($id == "printTagCloud") { print "<title>" . __('Tag Cloud') . "</title>"; print "<content><![CDATA["; # print __("Showing most popular tags ")." (<a # href='javascript:toggleTags(true)'>".__('more tags')."</a>):<br/>"; print "<div class=\"tagCloudContainer\">"; printTagCloud($link); print "</div>"; print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; print "]]></content>"; } if ($id == 'printTagSelect') { print "<title>" . __('Select item(s) by tags') . "</title>"; print "<content><![CDATA["; print __("Match:") . " " . "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\"> Any "; print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\"> All "; print " tags."; print "<select id=\"all_tags\" name=\"all_tags\" title=\"" . __('Which Tags?') . "\" multiple=\"multiple\" size=\"10\" style=\"width : 100%\">"; $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = " . $_SESSION['uid'] . "\n\t\t\t\tAND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC"); while ($row = db_fetch_assoc($result)) { $tmp = htmlspecialchars($row["tag_name"]); print "<option value=\"" . str_replace(" ", "%20", $tmp) . "\">{$tmp}</option>"; } print "</select>"; print "<div align='right'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"viewfeed(get_all_tags(\$('all_tags')),\n\t\t\t\tget_radio_checked(\$('tag_mode')));\">" . __('Display entries') . "</button>"; print " "; print "<button dojoType=\"dijit.form.Button\"\n\t\t\tonclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; print "]]></content>"; } if ($id == "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=\"subop\" value=\"sendEmail\">"; $result = db_query($link, "SELECT email, full_name FROM ttrss_users WHERE\n\t\t\t\tid = " . $_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"]); // $tpl->addBlock('header'); $result = db_query($link, "SELECT link, content, title\n\t\t\t\tFROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND\n\t\t\t\tid IN ({$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;\"\n\t\t\t\t\tvalue=\"{$user_name} <{$user_email}>\">"; print "</td></tr><tr><td>"; print __('To:'); print "</td><td>"; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"\n\t\t\t\t\tstyle=\"width : 30em;\"\n\t\t\t\t\tname=\"destination\" id=\"emailArticleDlg_destination\">"; print "<div class=\"autocomplete\" id=\"emailArticleDlg_dst_choices\"\n\t\t\t\t\tstyle=\"z-index: 30; display : none\"></div>"; print "</td></tr><tr><td>"; print __('Subject:'); print "</td><td>"; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"\n\t\t\t\t\tstyle=\"width : 30em;\"\n\t\t\t\t\tname=\"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\"\n\t\t\t\tname='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; } if ($id == "generatedFeed") { print "<title>" . __('View as RSS') . "</title>"; print "<content><![CDATA["; $params = explode(":", $param, 3); $feed_id = db_escape_string($params[0]); $is_cat = (bool) $params[1]; $key = get_feed_access_key($link, $feed_id, $is_cat); $url_path = htmlspecialchars($params[2]) . "&key=" . $key; print __("You can view this feed as RSS using the following URL:"); print "<div class=\"tagCloudContainer\">"; print "<a id='gen_feed_url' href='{$url_path}' target='_blank'>{$url_path}</a>"; print "</div>"; print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('{$feed_id}', '{$is_cat}')\">" . __('Generate new URL') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; print "]]></content>"; //return; } if ($id == "newVersion") { $version_data = check_for_update($link); $version = $version_data['version']; $id = $version_data['version_id']; print "<div class='tagCloudContainer'>"; print T_sprintf("New version of Tiny Tiny RSS is available (%s).", "<b>{$version}</b>"); print "</div>"; $details = "http://tt-rss.org/redmine/versions/show/{$id}"; $download = "http://tt-rss.org/#Download"; print "<div style='text-align : center'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return window.open('{$details}')\">" . __("Details") . "</button>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return window.open('{$download}')\">" . __("Download") . "</button>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return dijit.byId('newVersionDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; } if ($id == "customizeCSS") { $value = get_pref($link, "USER_STYLESHEET"); $value = str_replace("<br/>", "\n", $value); 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 "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"setpref\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">"; print "<table width='100%'><tr><td>"; print "<textarea dojoType=\"dijit.form.SimpleTextarea\"\n\t\t\t\tstyle='font-size : 12px; width : 100%; height: 200px;'\n\t\t\t\tplaceHolder='body#ttrssMain { font-size : 14px; };'\n\t\t\t\tname='value'>{$value}</textarea>"; print "</td></tr></table>"; print "<div class='dlgButtons'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('cssEditDlg').execute()\">" . __('Save') . "</button> "; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('cssEditDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; } if ($id == "editArticleNote") { $result = db_query($link, "SELECT note FROM ttrss_user_entries WHERE\n\t\t\t\tref_id = '{$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=\"{$param}\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"setNote\">"; print "<table width='100%'><tr><td>"; print "<textarea dojoType=\"dijit.form.SimpleTextarea\"\n\t\t\t\tstyle='font-size : 12px; width : 100%; height: 100px;'\n\t\t\t\tplaceHolder='body#ttrssMain { font-size : 14px; };'\n\t\t\t\tname='note'>{$note}</textarea>"; print "</td></tr></table>"; print "<div class='dlgButtons'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('editNoteDlg').execute()\">" . __('Save') . "</button> "; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('editNoteDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; } if ($id == "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>\n\t\t\t\t<strong>Version " . VERSION . "</strong>\n\t\t\t\t<p>Copyright © 2005-" . date('Y') . "\n\t\t\t\t<a target=\"_blank\" class=\"visibleLink\"\n\t\t\t\thref=\"http://fakecake.org/\">Andrew Dolgov</a>\n\t\t\t\tand other contributors.</p>\n\t\t\t\t<p class=\"insensitive\">Licensed under GNU GPL version 2.</p>"; print "<p class=\"insensitive\">\n\t\t\t\t<a class=\"visibleLink\" target=\"_blank\"\n\t\t\t\t\thref=\"http://tt-rss.org/\">Official site</a> —\n\t\t\t\t<a href=\"http://tt-rss.org/redmine/wiki/tt-rss/Donate\"\n\t\t\t\ttarget=\"_blank\" class=\"visibleLink\">\n\t\t\t\tSupport the project.</a></p>"; print "</td></tr>"; print "</table>"; print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\ttype=\"submit\">" . __('Close this window') . "</button>"; print "</div>"; } if ($id == "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=\"subop\" value=\"add\">"; print "<div class=\"dlgSec\">" . __("Instance") . "</div>"; print "<div class=\"dlgSecCont\">"; /* URL */ print __("URL:") . " "; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"\n\t\t\t\tplaceHolder=\"" . __("Instance URL") . "\"\n\t\t\t\tregExp='^(http|https)://.*'\n\t\t\t\tstyle=\"font-size : 16px; width: 20em\" name=\"access_url\">"; print "<hr/>"; $access_key = sha1(uniqid(rand(), true)); /* Access key */ print __("Access key:") . " "; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"\n\t\t\t\tplaceHolder=\"" . __("Access key") . "\" regExp='\\w{40}'\n\t\t\t\tstyle=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\"\n\t\t\t\tvalue=\"{$access_key}\">"; print "<p class='insensitive'>" . __("Use one access key for both linked instances."); print "</div>"; print "<div class=\"dlgButtons\">\n\t\t\t\t<div style='float : left'>\n\t\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\t\tonclick=\"return dijit.byId('instanceAddDlg').regenKey()\">" . __('Generate new key') . "</button>\n\t\t\t\t</div>\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"return dijit.byId('instanceAddDlg').execute()\">" . __('Create link') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"return dijit.byId('instanceAddDlg').hide()\"\">" . __('Cancel') . "</button></div>"; return; } if ($id == "shareArticle") { $result = db_query($link, "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '{$param}'\n\t\t\t\tAND owner_uid = " . $_SESSION['uid']); if (db_num_rows($result) == 0) { print "Article not found."; } else { $uuid = db_fetch_result($result, 0, "uuid"); $ref_id = db_fetch_result($result, 0, "ref_id"); if (!$uuid) { $uuid = db_escape_string(sha1(uniqid(rand(), true))); db_query($link, "UPDATE ttrss_user_entries SET uuid = '{$uuid}' WHERE int_id = '{$param}'\n\t\t\t\t\t\tAND owner_uid = " . $_SESSION['uid']); } print __("You can share this article by the following unique URL:"); $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>"; /* if (!label_find_id($link, __('Shared'), $_SESSION["uid"])) label_create($link, __('Shared'), $_SESSION["uid"]); label_add_article($link, $ref_id, __('Shared'), $_SESSION['uid']); */ } print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('shareArticleDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; return; } print "</dlg>"; }
function quickAddCat() { $cat = $this->dbh->escape_string($_REQUEST["cat"]); add_feed_category($cat); $result = $this->dbh->query("SELECT id FROM ttrss_feed_categories WHERE\n title = '{$cat}' AND owner_uid = " . $_SESSION["uid"]); if ($this->dbh->num_rows($result) == 1) { $id = $this->dbh->fetch_result($result, 0, "id"); } else { $id = 0; } print_feed_cat_select("cat_id", $id, ''); }
function module_pref_feeds($link) { global $update_intervals; global $purge_intervals; global $update_methods; $subop = $_REQUEST["subop"]; $quiet = $_REQUEST["quiet"]; $mode = $_REQUEST["mode"]; if ($subop == "removeicon") { $feed_id = db_escape_string($_REQUEST["feed_id"]); $result = db_query($link, "SELECT id FROM ttrss_feeds\n\t\t\t\tWHERE id = '{$feed_id}' AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) != 0) { unlink(ICONS_DIR . "/{$feed_id}.ico"); } return; } if ($subop == "uploadicon") { $icon_file = $_FILES['icon_file']['tmp_name']; $feed_id = db_escape_string($_REQUEST["feed_id"]); if (is_file($icon_file) && $feed_id) { if (filesize($icon_file) < 20000) { $result = db_query($link, "SELECT id FROM ttrss_feeds\n\t\t\t\t\t\tWHERE id = '{$feed_id}' AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) != 0) { unlink(ICONS_DIR . "/{$feed_id}.ico"); move_uploaded_file($icon_file, ICONS_DIR . "/{$feed_id}.ico"); $rc = 0; } else { $rc = 2; } } else { $rc = 1; } } else { $rc = 2; } print "<script type=\"text/javascript\">"; print "parent.uploadIconHandler({$rc});"; print "</script>"; return; } /* if ($subop == "massSubscribe") { $ids = split(",", db_escape_string($_REQUEST["ids"])); $subscribed = array(); foreach ($ids as $id) { if ($mode == 1) { $result = db_query($link, "SELECT feed_url,title FROM ttrss_feeds WHERE id = '$id'"); } else if ($mode == 2) { $result = db_query($link, "SELECT * FROM ttrss_archived_feeds WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]); $orig_id = db_escape_string(db_fetch_result($result, 0, "id")); $site_url = db_escape_string(db_fetch_result($result, 0, "site_url")); } $feed_url = db_escape_string(db_fetch_result($result, 0, "feed_url")); $title = db_escape_string(db_fetch_result($result, 0, "title")); $title_orig = db_fetch_result($result, 0, "title"); $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) == 0) { if ($mode == 1) { $result = db_query($link, "INSERT INTO ttrss_feeds (owner_uid,feed_url,title,cat_id) VALUES ('".$_SESSION["uid"]."', '$feed_url', '$title', NULL)"); } else if ($mode == 2) { $result = db_query($link, "INSERT INTO ttrss_feeds (id,owner_uid,feed_url,title,cat_id,site_url) VALUES ('$orig_id','".$_SESSION["uid"]."', '$feed_url', '$title', NULL, '$site_url')"); } array_push($subscribed, $title_orig); } } if (count($subscribed) > 0) { $msg = "<b>".__('Subscribed to feeds:')."</b>". "<ul class=\"nomarks\">"; foreach ($subscribed as $title) { $msg .= "<li>$title</li>"; } $msg .= "</ul>"; print format_notice($msg); } return; } */ /* if ($subop == "browse") { print "<div id=\"infoBoxTitle\">".__('Feed Browser')."</div>"; print "<div class=\"infoBoxContents\">"; $browser_search = db_escape_string($_REQUEST["search"]); //print "<p>".__("Showing top 25 registered feeds, sorted by popularity:")."</p>"; print "<form onsubmit='return false;' display='inline' name='feed_browser' id='feed_browser'>"; print " <div style='float : right'> <img style='display : none' id='feed_browser_spinner' src='images/indicator_white.gif'> <input name=\"search\" size=\"20\" type=\"search\" onchange=\"javascript:updateFeedBrowser()\" value=\"$browser_search\"> <button onclick=\"javascript:updateFeedBrowser()\">".__('Search')."</button> </div>"; print " <select name=\"mode\" onchange=\"updateFeedBrowser()\"> <option value='1'>" . __('Popular feeds') . "</option> <option value='2'>" . __('Feed archive') . "</option> </select> "; print __("limit:"); print " <select name=\"limit\" onchange='updateFeedBrowser()'>"; foreach (array(25, 50, 100, 200) as $l) { $issel = ($l == $limit) ? "selected" : ""; print "<option $issel>$l</option>"; } print "</select> "; print "<p>"; $owner_uid = $_SESSION["uid"]; print "<ul class='browseFeedList' id='browseFeedList'>"; print_feed_browser($link, $search, 25); print "</ul>"; print "<div align='center'> <button onclick=\"feedBrowserSubscribe()\">".__('Subscribe')."</button> <button onclick=\"closeInfoBox()\" >".__('Cancel')."</button></div>"; print "</div>"; return; } */ if ($subop == "editfeed") { $feed_id = db_escape_string($_REQUEST["id"]); $result = db_query($link, "SELECT * FROM ttrss_feeds WHERE id = '{$feed_id}' AND\n\t\t\t\t\towner_uid = " . $_SESSION["uid"]); $title = htmlspecialchars(db_fetch_result($result, 0, "title")); $icon_file = ICONS_DIR . "/{$feed_id}.ico"; if (file_exists($icon_file) && filesize($icon_file) > 0) { $feed_icon = "<img width=\"16\" height=\"16\"\n\t\t\t\t\t\tsrc=\"" . ICONS_URL . "/{$feed_id}.ico\">"; } else { $feed_icon = ""; } print "<div id=\"infoBoxTitle\">" . __('Feed Editor') . "</div>"; print "<div class=\"infoBoxContents\">"; print "<form id=\"edit_feed_form\" onsubmit=\"return false\">"; print "<input type=\"hidden\" name=\"id\" value=\"{$feed_id}\">"; print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">"; print "<input type=\"hidden\" name=\"subop\" value=\"editSave\">"; print "<div class=\"dlgSec\">" . __("Feed") . "</div>"; print "<div class=\"dlgSecCont\">"; /* Title */ print "<input style=\"font-size : 16px\" size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\"\n\t\t\t\t name=\"title\" value=\"{$title}\">"; /* Feed URL */ $feed_url = db_fetch_result($result, 0, "feed_url"); $feed_url = htmlspecialchars(db_fetch_result($result, 0, "feed_url")); print "<br/>"; print __('URL:') . " "; print "<input size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\"\n\t\t\t\tname=\"feed_url\" value=\"{$feed_url}\">"; /* Category */ if (get_pref($link, 'ENABLE_FEED_CATS')) { $cat_id = db_fetch_result($result, 0, "cat_id"); print "<br/>"; print __('Place in category:') . " "; $parent_feed = db_fetch_result($result, 0, "parent_feed"); if (sprintf("%d", $parent_feed) > 0) { $disabled = "disabled"; } else { $disabled = ""; } print_feed_cat_select($link, "cat_id", $cat_id, $disabled); } /* Link to */ print "<br/>"; print __('Link to feed:') . " "; $tmp_result = db_query($link, "SELECT COUNT(id) AS count\n\t\t\t\tFROM ttrss_feeds WHERE parent_feed = '{$feed_id}'"); $linked_count = db_fetch_result($tmp_result, 0, "count"); $parent_feed = db_fetch_result($result, 0, "parent_feed"); if ($linked_count > 0) { $disabled = "disabled"; } else { $disabled = ""; } print "<select {$disabled} name=\"parent_feed\">"; print "<option value=\"0\">" . __('Not linked') . "</option>"; if (get_pref($link, 'ENABLE_FEED_CATS')) { if ($cat_id) { $cat_qpart = "AND cat_id = '{$cat_id}'"; } else { $cat_qpart = "AND cat_id IS NULL"; } } $tmp_result = db_query($link, "SELECT id,title FROM ttrss_feeds\n\t\t\t\tWHERE id != '{$feed_id}' AND owner_uid = " . $_SESSION["uid"] . " AND\n\t\t\t \t\t(SELECT COUNT(id) FROM ttrss_feeds AS T2 WHERE T2.id = ttrss_feeds.parent_feed) = 0\n\t\t\t\t\t{$cat_qpart} ORDER BY title"); if (db_num_rows($tmp_result) > 0) { print "<option disabled>--------</option>"; } while ($tmp_line = db_fetch_assoc($tmp_result)) { if ($tmp_line["id"] == $parent_feed) { $is_selected = "selected"; } else { $is_selected = ""; } $linked_title = truncate_string(htmlspecialchars($tmp_line["title"]), 40); printf("<option {$is_selected} value='%d'>%s</option>", $tmp_line["id"], $linked_title); } print "</select>"; print "</div>"; print "<div class=\"dlgSec\">" . __("Update") . "</div>"; print "<div class=\"dlgSecCont\">"; /* Update Interval */ $update_interval = db_fetch_result($result, 0, "update_interval"); print_select_hash("update_interval", $update_interval, $update_intervals); /* Update method */ if (ALLOW_SELECT_UPDATE_METHOD) { $update_method = db_fetch_result($result, 0, "update_method"); print " " . __('using') . " "; print_select_hash("update_method", $update_method, $update_methods); } $purge_interval = db_fetch_result($result, 0, "purge_interval"); if (FORCE_ARTICLE_PURGE == 0) { /* Purge intl */ print "<br/>"; print __('Article purging:') . " "; print_select_hash("purge_interval", $purge_interval, $purge_intervals); } else { print "<input type='hidden' name='purge_interval' value='{$purge_interval}'>"; } print "</div>"; print "<div class=\"dlgSec\">" . __("Authentication") . "</div>"; print "<div class=\"dlgSecCont\">"; $auth_login = htmlspecialchars(db_fetch_result($result, 0, "auth_login")); print "<table>"; print "<tr><td>" . __('Login:'******'Hide from Popular feeds') . "</label>"; $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content")); if ($rtl_content) { $checked = "checked"; } else { $checked = ""; } print "<br/><input type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"\n\t\t\t\t{$checked}> <label for=\"rtl_content\">" . __('Right-to-left content') . "</label>"; $include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest")); if ($include_in_digest) { $checked = "checked"; } else { $checked = ""; } print "<br/><input type=\"checkbox\" id=\"include_in_digest\" \n\t\t\t\tname=\"include_in_digest\"\n\t\t\t\t{$checked}> <label for=\"include_in_digest\">" . __('Include in e-mail digest') . "</label>"; $always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures")); if ($always_display_enclosures) { $checked = "checked"; } else { $checked = ""; } print "<br/><input type=\"checkbox\" id=\"always_display_enclosures\" \n\t\t\t\tname=\"always_display_enclosures\"\n\t\t\t\t{$checked}> <label for=\"always_display_enclosures\">" . __('Always display image attachments') . "</label>"; $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images")); if ($cache_images) { $checked = "checked"; } else { $checked = ""; } if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { $disabled = ""; $label_class = ""; } else { $disabled = "disabled"; $label_class = "class='insensitive'"; } print "<br/><input type=\"checkbox\" id=\"cache_images\" \n\t\t\t\tname=\"cache_images\" {$disabled}\n\t\t\t\t{$checked}> <label {$label_class} for=\"cache_images\">" . __('Cache images locally') . "</label>"; print "</div>"; print "</div>"; print "</form>"; /* Icon */ print "<br/>"; print "<div class=\"dlgSec\">" . __("Icon") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<iframe name=\"icon_upload_iframe\"\n\t\t\t\tstyle=\"width: 400px; height: 100px; display: none;\"></iframe>"; print "<form style='display : block' target=\"icon_upload_iframe\"\n\t\t\t\tenctype=\"multipart/form-data\" method=\"POST\" \n\t\t\t\taction=\"backend.php\">\n\t\t\t\t<input id=\"icon_file\" size=\"10\" name=\"icon_file\" type=\"file\">\n\t\t\t\t<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">\n\t\t\t\t<input type=\"hidden\" name=\"feed_id\" value=\"{$feed_id}\">\n\t\t\t\t<input type=\"hidden\" name=\"subop\" value=\"uploadicon\">\n\t\t\t\t<button onclick=\"return uploadFeedIcon();\"\n\t\t\t\t\ttype=\"submit\">" . __('Replace') . "</button>\n\t\t\t\t<button onclick=\"return removeFeedIcon({$feed_id});\"\n\t\t\t\t\ttype=\"submit\">" . __('Remove') . "</button>\n\t\t\t\t</form>"; print "</div>"; $title = htmlspecialchars($title, ENT_QUOTES); print "<div class='dlgButtons'>\n\t\t\t\t<div style=\"float : left\">\n\t\t\t\t<button onclick='return unsubscribeFeed({$feed_id}, \"{$title}\")'>" . __('Unsubscribe') . "</button>\n\t\t\t\t</div>\n\t\t\t\t<button onclick=\"return feedEditSave()\">" . __('Save') . "</button>\n\t\t\t\t<button onclick=\"return feedEditCancel()\">" . __('Cancel') . "</button>\n\t\t\t\t</div>"; return; } if ($subop == "editfeeds") { $feed_ids = db_escape_string($_REQUEST["ids"]); print "<div id=\"infoBoxTitle\">" . __('Multiple Feed Editor') . "</div>"; print "<div class=\"infoBoxContents\">"; print "<form id=\"batch_edit_feed_form\" onsubmit=\"return false\">"; print "<input type=\"hidden\" name=\"ids\" value=\"{$feed_ids}\">"; print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">"; print "<input type=\"hidden\" name=\"subop\" value=\"batchEditSave\">"; print "<div class=\"dlgSec\">" . __("Feed") . "</div>"; print "<div class=\"dlgSecCont\">"; /* Title */ print "<input disabled style=\"font-size : 16px\" size=\"35\" onkeypress=\"return filterCR(event, feedEditSave)\"\n\t\t\t\t name=\"title\" value=\"{$title}\">"; batch_edit_cbox("title"); /* Feed URL */ print "<br/>"; print __('URL:') . " "; print "<input disabled size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\"\n\t\t\t\tname=\"feed_url\" value=\"{$feed_url}\">"; batch_edit_cbox("feed_url"); /* Category */ if (get_pref($link, 'ENABLE_FEED_CATS')) { print "<br/>"; print __('Place in category:') . " "; print_feed_cat_select($link, "cat_id", $cat_id, "disabled"); batch_edit_cbox("cat_id"); } print "</div>"; print "<div class=\"dlgSec\">" . __("Update") . "</div>"; print "<div class=\"dlgSecCont\">"; /* Update Interval */ print_select_hash("update_interval", $update_interval, $update_intervals, "disabled"); batch_edit_cbox("update_interval"); /* Update method */ if (ALLOW_SELECT_UPDATE_METHOD) { print " " . __('using') . " "; print_select_hash("update_method", $update_method, $update_methods, "disabled"); batch_edit_cbox("update_method"); } /* Purge intl */ if (FORCE_ARTICLE_PURGE != 0) { print "<br/>"; print __('Article purging:') . " "; print_select_hash("purge_interval", $purge_interval, $purge_intervals, "disabled"); batch_edit_cbox("purge_interval"); } print "</div>"; print "<div class=\"dlgSec\">" . __("Authentication") . "</div>"; print "<div class=\"dlgSecCont\">"; print __('Login:'******'insensitive' for=\"private\">" . __('Hide from Popular feeds') . "</label>"; print " "; batch_edit_cbox("private", "private_l"); print "<br/><input disabled type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"\n\t\t\t\t{$checked}> <label class='insensitive' id=\"rtl_content_l\" for=\"rtl_content\">" . __('Right-to-left content') . "</label>"; print " "; batch_edit_cbox("rtl_content", "rtl_content_l"); print "<br/><input disabled type=\"checkbox\" id=\"include_in_digest\" \n\t\t\t\tname=\"include_in_digest\" \n\t\t\t\t{$checked}> <label id=\"include_in_digest_l\" class='insensitive' for=\"include_in_digest\">" . __('Include in e-mail digest') . "</label>"; print " "; batch_edit_cbox("include_in_digest", "include_in_digest_l"); print "<br/><input disabled type=\"checkbox\" id=\"always_display_enclosures\" \n\t\t\t\tname=\"always_display_enclosures\" \n\t\t\t\t{$checked}> <label id=\"always_display_enclosures_l\" class='insensitive' for=\"always_display_enclosures\">" . __('Always display image attachments') . "</label>"; print " "; batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l"); print "<br/><input disabled type=\"checkbox\" id=\"cache_images\" \n\t\t\t\tname=\"cache_images\" \n\t\t\t\t{$checked}> <label class='insensitive' id=\"cache_images_l\" \n\t\t\t\t\tfor=\"cache_images\">" . __('Cache images locally') . "</label>"; if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { print " "; batch_edit_cbox("cache_images", "cache_images_l"); } print "</div>"; print "</div>"; print "</form>"; print "<div class='dlgButtons'>\n\t\t\t\t<input type=\"submit\" class=\"button\" \n\t\t\t\tonclick=\"return feedsEditSave()\" value=\"" . __('Save') . "\">\n\t\t\t\t<input type='submit' class='button'\t\t\t\n\t\t\t\tonclick=\"return feedEditCancel()\" value=\"" . __('Cancel') . "\">\n\t\t\t\t</div>"; return; } if ($subop == "editSave" || $subop == "batchEditSave") { $feed_title = db_escape_string(trim($_POST["title"])); $feed_link = db_escape_string(trim($_POST["feed_url"])); $upd_intl = db_escape_string($_POST["update_interval"]); $purge_intl = db_escape_string($_POST["purge_interval"]); $feed_id = db_escape_string($_POST["id"]); /* editSave */ $feed_ids = db_escape_string($_POST["ids"]); /* batchEditSave */ $cat_id = db_escape_string($_POST["cat_id"]); $auth_login = db_escape_string(trim($_POST["auth_login"])); $auth_pass = db_escape_string(trim($_POST["auth_pass"])); $parent_feed = db_escape_string($_POST["parent_feed"]); $private = checkbox_to_sql_bool(db_escape_string($_POST["private"])); $rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"])); $include_in_digest = checkbox_to_sql_bool(db_escape_string($_POST["include_in_digest"])); $cache_images = checkbox_to_sql_bool(db_escape_string($_POST["cache_images"])); $update_method = (int) db_escape_string($_POST["update_method"]); $always_display_enclosures = checkbox_to_sql_bool(db_escape_string($_POST["always_display_enclosures"])); if (get_pref($link, 'ENABLE_FEED_CATS')) { if ($cat_id && $cat_id != 0) { $category_qpart = "cat_id = '{$cat_id}',"; $category_qpart_nocomma = "cat_id = '{$cat_id}'"; } else { $category_qpart = 'cat_id = NULL,'; $category_qpart_nocomma = 'cat_id = NULL'; } } else { $category_qpart = ""; $category_qpart_nocomma = ""; } if ($parent_feed && $parent_feed != 0) { $parent_qpart = "parent_feed = '{$parent_feed}'"; } else { $parent_qpart = 'parent_feed = NULL'; } if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { $cache_images_qpart = "cache_images = {$cache_images},"; } else { $cache_images_qpart = ""; } if ($subop == "editSave") { $result = db_query($link, "UPDATE ttrss_feeds SET \n\t\t\t\t\t{$category_qpart} {$parent_qpart},\n\t\t\t\t\ttitle = '{$feed_title}', feed_url = '{$feed_link}',\n\t\t\t\t\tupdate_interval = '{$upd_intl}',\n\t\t\t\t\tpurge_interval = '{$purge_intl}',\n\t\t\t\t\tauth_login = '******',\n\t\t\t\t\tauth_pass = '******',\n\t\t\t\t\tprivate = {$private},\n\t\t\t\t\trtl_content = {$rtl_content},\n\t\t\t\t\t{$cache_images_qpart}\n\t\t\t\t\tinclude_in_digest = {$include_in_digest},\n\t\t\t\t\talways_display_enclosures = {$always_display_enclosures},\n\t\t\t\t\tupdate_method = '{$update_method}'\n\t\t\t\t\tWHERE id = '{$feed_id}' AND owner_uid = " . $_SESSION["uid"]); if (get_pref($link, 'ENABLE_FEED_CATS')) { # update linked feed categories $result = db_query($link, "UPDATE ttrss_feeds SET\n\t\t\t\t\t\t{$category_qpart_nocomma} WHERE parent_feed = '{$feed_id}' AND\n\t\t\t\t\t\towner_uid = " . $_SESSION["uid"]); } } else { if ($subop == "batchEditSave") { $feed_data = array(); foreach (array_keys($_POST) as $k) { if ($k != "op" && $k != "subop" && $k != "ids") { $feed_data[$k] = $_POST[$k]; } } db_query($link, "BEGIN"); foreach (array_keys($feed_data) as $k) { $qpart = ""; switch ($k) { case "title": $qpart = "title = '{$feed_title}'"; break; case "feed_url": $qpart = "feed_url = '{$feed_link}'"; break; case "update_interval": $qpart = "update_interval = '{$upd_intl}'"; break; case "purge_interval": $qpart = "purge_interval = '{$purge_intl}'"; break; case "auth_login": $qpart = "auth_login = '******'"; break; case "auth_pass": $qpart = "auth_pass = '******'"; break; case "private": $qpart = "private = '{$private}'"; break; case "include_in_digest": $qpart = "include_in_digest = '{$include_in_digest}'"; break; case "always_display_enclosures": $qpart = "always_display_enclosures = '{$always_display_enclosures}'"; break; case "cache_images": $qpart = "cache_images = '{$cache_images}'"; break; case "rtl_content": $qpart = "rtl_content = '{$rtl_content}'"; break; case "update_method": $qpart = "update_method = '{$update_method}'"; break; case "cat_id": $qpart = $category_qpart_nocomma; break; } if ($qpart) { db_query($link, "UPDATE ttrss_feeds SET {$qpart} WHERE id IN ({$feed_ids})\n\t\t\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]); print "<br/>"; } } db_query($link, "COMMIT"); } } } if ($subop == "remove") { $ids = split(",", db_escape_string($_REQUEST["ids"])); foreach ($ids as $id) { remove_feed($link, $id, $_SESSION["uid"]); } return; } if ($subop == "clear") { $id = db_escape_string($_REQUEST["id"]); clear_feed_articles($link, $id); } if ($subop == "rescore") { $ids = split(",", db_escape_string($_REQUEST["ids"])); foreach ($ids as $id) { $filters = load_filters($link, $id, $_SESSION["uid"], 6); $result = db_query($link, "SELECT title, content, link, ref_id FROM\n\t\t\t\t\t\tttrss_user_entries, ttrss_entries \n\t\t\t\t\t\tWHERE ref_id = id AND feed_id = '{$id}' AND \n\t\t\t\t\t\t\towner_uid = " . $_SESSION['uid'] . "\n\t\t\t\t\t\t"); $scores = array(); while ($line = db_fetch_assoc($result)) { $article_filters = get_article_filters($filters, $line['title'], $line['content'], $line['link']); $new_score = calculate_article_score($article_filters); if (!$scores[$new_score]) { $scores[$new_score] = array(); } array_push($scores[$new_score], $line['ref_id']); } foreach (array_keys($scores) as $s) { if ($s > 1000) { db_query($link, "UPDATE ttrss_user_entries SET score = '{$s}', \n\t\t\t\t\t\t\tmarked = true WHERE\n\t\t\t\t\t\t\tref_id IN (" . join(',', $scores[$s]) . ")"); } else { if ($s < -500) { db_query($link, "UPDATE ttrss_user_entries SET score = '{$s}', \n\t\t\t\t\t\t\tunread = false WHERE\n\t\t\t\t\t\t\tref_id IN (" . join(',', $scores[$s]) . ")"); } else { db_query($link, "UPDATE ttrss_user_entries SET score = '{$s}' WHERE\n\t\t\t\t\t\t\tref_id IN (" . join(',', $scores[$s]) . ")"); } } } } print __("All done."); } if ($subop == "rescoreAll") { $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']); while ($feed_line = db_fetch_assoc($result)) { $id = $feed_line["id"]; $filters = load_filters($link, $id, $_SESSION["uid"], 6); $tmp_result = db_query($link, "SELECT title, content, link, ref_id FROM\n\t\t\t\t\t\tttrss_user_entries, ttrss_entries \n\t\t\t\t\t\tWHERE ref_id = id AND feed_id = '{$id}' AND \n\t\t\t\t\t\t\towner_uid = " . $_SESSION['uid'] . "\n\t\t\t\t\t\t"); $scores = array(); while ($line = db_fetch_assoc($tmp_result)) { $article_filters = get_article_filters($filters, $line['title'], $line['content'], $line['link']); $new_score = calculate_article_score($article_filters); if (!$scores[$new_score]) { $scores[$new_score] = array(); } array_push($scores[$new_score], $line['ref_id']); } foreach (array_keys($scores) as $s) { if ($s > 1000) { db_query($link, "UPDATE ttrss_user_entries SET score = '{$s}', \n\t\t\t\t\t\t\tmarked = true WHERE\n\t\t\t\t\t\t\tref_id IN (" . join(',', $scores[$s]) . ")"); } else { db_query($link, "UPDATE ttrss_user_entries SET score = '{$s}' WHERE\n\t\t\t\t\t\t\tref_id IN (" . join(',', $scores[$s]) . ")"); } } } print __("All done."); } if ($subop == "add") { $feed_url = db_escape_string(trim($_REQUEST["feed_url"])); $cat_id = db_escape_string($_REQUEST["cat_id"]); $p_from = db_escape_string($_REQUEST["from"]); /* only read authentication information from POST */ $auth_login = db_escape_string(trim($_POST["auth_login"])); $auth_pass = db_escape_string(trim($_POST["auth_pass"])); if ($p_from != 'tt-rss') { print "<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<title>Tiny Tiny RSS</title>\n\t\t\t\t\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"utility.css\">\n\t\t\t\t\t</head>\n\t\t\t\t\t<body>\n\t\t\t\t\t<img class=\"floatingLogo\" src=\"images/ttrss_logo.png\"\n\t\t\t\t \t\talt=\"Tiny Tiny RSS\"/>\t\n\t\t\t\t\t<h1>Subscribe to feed...</h1>"; } $rc = subscribe_to_feed($link, $feed_url, $cat_id, $auth_login, $auth_pass); switch ($rc) { case 1: print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url)); break; case 2: print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url)); break; case 0: print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url)); break; } if ($p_from != 'tt-rss') { $tt_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\\.php.*$/', 'tt-rss.php', $_SERVER["REQUEST_URI"]); $tp_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\\.php.*$/', 'prefs.php', $_SERVER["REQUEST_URI"]); $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE\n\t\t\t\t\tfeed_url = '{$feed_url}' AND owner_uid = " . $_SESSION["uid"]); $feed_id = db_fetch_result($result, 0, "id"); print "<p>"; if ($feed_id) { print "<form method=\"GET\" style='display: inline' \n\t\t\t\t\t\taction=\"{$tp_uri}\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"tab\" value=\"feedConfig\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"subop\" value=\"editFeed\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"subopparam\" value=\"{$feed_id}\">\n\t\t\t\t\t\t<input type=\"submit\" value=\"" . __("Edit subscription options") . "\">\n\t\t\t\t\t\t</form>"; } print "<form style='display: inline' method=\"GET\" action=\"{$tt_uri}\">\n\t\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t\t</form></p>"; print "</body></html>"; return; } } if ($subop == "categorize") { if (!WEB_DEMO_MODE) { $ids = split(",", db_escape_string($_REQUEST["ids"])); $cat_id = db_escape_string($_REQUEST["cat_id"]); if ($cat_id == 0) { $cat_id_qpart = 'NULL'; } else { $cat_id_qpart = "'{$cat_id}'"; } db_query($link, "BEGIN"); foreach ($ids as $id) { db_query($link, "UPDATE ttrss_feeds SET cat_id = {$cat_id_qpart}\n\t\t\t\t\t\tWHERE id = '{$id}' AND parent_feed IS NULL\n\t\t\t\t\t \tAND owner_uid = " . $_SESSION["uid"]); # update linked feed categories db_query($link, "UPDATE ttrss_feeds SET\n\t\t\t\t\t\tcat_id = {$cat_id_qpart} WHERE parent_feed = '{$id}' AND \n\t\t\t\t\t\towner_uid = " . $_SESSION["uid"]); } db_query($link, "COMMIT"); } } if ($subop == "editCats") { $action = $_REQUEST["action"]; if ($action == "save") { $cat_title = db_escape_string(trim($_REQUEST["value"])); $cat_id = db_escape_string($_REQUEST["cid"]); db_query($link, "BEGIN"); $result = db_query($link, "SELECT title FROM ttrss_feed_categories\n\t\t\t\t\tWHERE id = '{$cat_id}' AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) == 1) { $old_title = db_fetch_result($result, 0, "title"); if ($cat_title != "") { $result = db_query($link, "UPDATE ttrss_feed_categories SET\n\t\t\t\t\t\t\ttitle = '{$cat_title}' WHERE id = '{$cat_id}' AND \n\t\t\t\t\t\t\towner_uid = " . $_SESSION["uid"]); print $cat_title; } else { print $old_title; } } else { print $_REQUEST["value"]; } db_query($link, "COMMIT"); return; } print "<div id=\"infoBoxTitle\">" . __('Category editor') . "</div>"; print "<div class=\"infoBoxContents\">"; if ($action == "add") { if (!WEB_DEMO_MODE) { $feed_cat = db_escape_string(trim($_REQUEST["cat"])); $result = db_query($link, "SELECT id FROM ttrss_feed_categories\n\t\t\t\t\t\tWHERE title = '{$feed_cat}' AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) == 0) { $result = db_query($link, "INSERT INTO ttrss_feed_categories (owner_uid,title) \n\t\t\t\t\t\t\tVALUES ('" . $_SESSION["uid"] . "', '{$feed_cat}')"); } else { print_warning(T_sprintf("Category <b>\$%s</b> already exists in the database.", $feed_cat)); } } } if ($action == "remove") { $ids = split(",", db_escape_string($_REQUEST["ids"])); foreach ($ids as $id) { remove_feed_category($link, $id, $_SESSION["uid"]); } } print "<div>\n\t\t\t\t<input id=\"fadd_cat\" \n\t\t\t\t\tonkeypress=\"return filterCR(event, addFeedCat)\"\n\t\t\t\t\tsize=\"40\">\n\t\t\t\t\t<button onclick=\"javascript:addFeedCat()\">" . __('Create category') . "</button></div>"; $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories\n\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . "\n\t\t\t\tORDER BY title"); print "<p>"; if (db_num_rows($result) != 0) { print __('Select:') . " \n\t\t\t\t\t<a href=\"javascript:selectPrefRows('fcat', true)\">" . __('All') . "</a>,\n\t\t\t\t\t<a href=\"javascript:selectPrefRows('fcat', false)\">" . __('None') . "</a>"; print "<div class=\"prefFeedCatHolder\">"; print "<form id=\"feed_cat_edit_form\" onsubmit=\"return false\">"; print "<table width=\"100%\" class=\"prefFeedCatList\" \n\t\t\t\t\tcellspacing=\"0\" id=\"prefFeedCatList\">"; $lnum = 0; while ($line = db_fetch_assoc($result)) { $class = $lnum % 2 ? "even" : "odd"; $cat_id = $line["id"]; $this_row_id = "id=\"FCATR-{$cat_id}\""; print "<tr class=\"{$class}\" {$this_row_id}>"; $edit_title = htmlspecialchars($line["title"]); print "<td width='5%' align='center'><input \n\t\t\t\t\t\tonclick='toggleSelectPrefRow(this, \"fcat\");' \n\t\t\t\t\t\ttype=\"checkbox\" id=\"FCCHK-{$cat_id}\"></td>"; print "<td><span id=\"FCATT-{$cat_id}\">" . $edit_title . "</span></td>"; print "</tr>"; ++$lnum; } print "</table>"; print "</form>"; print "</div>"; } else { print "<p>" . __('No feed categories defined.') . "</p>"; } print "<div class='dlgButtons'>\n\t\t\t\t<div style='float : left'>\n\t\t\t\t<button onclick=\"return removeSelectedFeedCats()\">" . __('Remove') . "</button>\n\t\t\t\t</div>"; print "<button onclick=\"selectTab('feedConfig')\">" . __('Close this window') . "</button></div>"; print "</div>"; return; } if ($quiet) { return; } set_pref($link, "_PREFS_ACTIVE_TAB", "feedConfig"); $result = db_query($link, "SELECT COUNT(id) AS num_errors\n\t\t\tFROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION["uid"]); $num_errors = db_fetch_result($result, 0, "num_errors"); if ($num_errors > 0) { print format_notice("<a href=\"javascript:showFeedsWithErrors()\">" . __('Some feeds have update errors (click for details)') . "</a>"); } $feed_search = db_escape_string($_REQUEST["search"]); if (array_key_exists("search", $_REQUEST)) { $_SESSION["prefs_feed_search"] = $feed_search; } else { $feed_search = $_SESSION["prefs_feed_search"]; } print "<div style='float : right'> \n\t\t\t<input id=\"feed_search\" size=\"20\" type=\"search\"\n\t\t\t\tonfocus=\"javascript:disableHotkeys();\" \n\t\t\t\tonblur=\"javascript:enableHotkeys();\"\n\t\t\t\tonchange=\"javascript:updateFeedList()\" value=\"{$feed_search}\">\n\t\t\t<button onclick=\"javascript:updateFeedList()\">" . __('Search') . "</button>\n\t\t\t</div>"; print "<button onclick=\"quickAddFeed()\">" . __('Subscribe to feed') . "</button> "; print "<button onclick=\"editSelectedFeed()\">" . __('Edit feeds') . "</button> "; if (get_pref($link, 'ENABLE_FEED_CATS')) { print "<button onclick=\"javascript:editFeedCats()\">" . __('Edit categories') . "</button> "; } print "<button onclick=\"javascript:removeSelectedFeeds()\">" . __('Unsubscribe') . "</button> "; if (defined('_ENABLE_FEED_DEBUGGING')) { print "<select id=\"feedActionChooser\" onchange=\"feedActionChange()\">\n\t\t\t\t<option value=\"facDefault\" selected>" . __('More actions...') . "</option>"; if (FORCE_ARTICLE_PURGE == 0) { print "<option value=\"facPurge\">" . __('Manual purge') . "</option>"; } print "\n\t\t\t\t<option value=\"facClear\">" . __('Clear feed data') . "</option>\n\t\t\t\t<option value=\"facRescore\">" . __('Rescore articles') . "</option>"; print "</select>"; } $feeds_sort = db_escape_string($_REQUEST["sort"]); if (!$feeds_sort || $feeds_sort == "undefined") { $feeds_sort = $_SESSION["pref_sort_feeds"]; if (!$feeds_sort) { $feeds_sort = "title"; } } $_SESSION["pref_sort_feeds"] = $feeds_sort; if ($feed_search) { $feed_search = split(" ", $feed_search); $tokens = array(); foreach ($feed_search as $token) { $token = trim($token); array_push($tokens, "(UPPER(F1.title) LIKE UPPER('%{$token}%') OR\n\t\t\t\t\tUPPER(C1.title) LIKE UPPER('%{$token}%') OR\n\t\t\t\t\tUPPER(F1.feed_url) LIKE UPPER('%{$token}%'))"); } $search_qpart = "(" . join($tokens, " AND ") . ") AND "; } else { $search_qpart = ""; } $show_last_article_info = false; $show_last_article_checked = ""; $show_last_article_qpart = ""; if ($_REQUEST["slat"] == "true") { $show_last_article_info = true; $show_last_article_checked = "checked"; $show_last_article_qpart = ", (SELECT " . SUBSTRING_FOR_DATE . "(MAX(updated),1,16) FROM ttrss_user_entries,\n\t\t\t\tttrss_entries WHERE ref_id = ttrss_entries.id\n\t\t\t\tAND feed_id = F1.id) AS last_article"; } else { if ($feeds_sort == "last_article") { $feeds_sort = "title"; } } if (get_pref($link, 'ENABLE_FEED_CATS')) { $order_by_qpart = "category,{$feeds_sort},title"; } else { $order_by_qpart = "{$feeds_sort},title"; } $result = db_query($link, "SELECT \n\t\t\t\tF1.id,\n\t\t\t\tF1.title,\n\t\t\t\tF1.feed_url,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(F1.last_updated,1,16) AS last_updated,\n\t\t\t\tF1.parent_feed,\n\t\t\t\tF1.update_interval,\n\t\t\t\tF1.last_error,\n\t\t\t\tF1.purge_interval,\n\t\t\t\tF1.cat_id,\n\t\t\t\tF2.title AS parent_title,\n\t\t\t\tC1.title AS category,\n\t\t\t\tF1.include_in_digest\n\t\t\t\t{$show_last_article_qpart}\n\t\t\tFROM \n\t\t\t\tttrss_feeds AS F1 \n\t\t\t\tLEFT JOIN ttrss_feeds AS F2\n\t\t\t\t\tON (F1.parent_feed = F2.id)\n\t\t\t\tLEFT JOIN ttrss_feed_categories AS C1\n\t\t\t\t\tON (F1.cat_id = C1.id)\n\t\t\tWHERE \n\t\t\t\t{$search_qpart} F1.owner_uid = '" . $_SESSION["uid"] . "' \t\t\t\n\t\t\tORDER by {$order_by_qpart}"); if (db_num_rows($result) != 0) { // print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>"; print "<p><table width=\"100%\" cellspacing=\"0\" \n\t\t\t\tclass=\"prefFeedList\" id=\"prefFeedList\">"; print "<tr><td class=\"selectPrompt\" colspan=\"8\">" . "<div style='float : right'>" . "<input id='show_last_article_times' type='checkbox' onchange='feedlistToggleSLAT()'\n\t\t\t\t{$show_last_article_checked}><label \n\t\t\t\t\tfor='show_last_article_times'>" . __('Show last article times') . "</label></div>" . __('Select:') . "\n\t\t\t\t\t<a href=\"javascript:selectPrefRows('feed', true)\">" . __('All') . "</a>,\n\t\t\t\t\t<a href=\"javascript:selectPrefRows('feed', false)\">" . __('None') . "</a>\n\t\t\t\t</td</tr>"; if (!get_pref($link, 'ENABLE_FEED_CATS')) { print "<tr class=\"title\">\n\t\t\t\t\t<td width='5%' align='center'> </td>"; if (get_pref($link, 'ENABLE_FEED_ICONS')) { print "<td width='3%'> </td>"; } print "<td width='60%'><a href=\"javascript:updateFeedList('title')\">" . __('Title') . "</a></td>"; if ($show_last_article_info) { print "<td width='20%' align='right'><a href=\"javascript:updateFeedList('last_article')\">" . __('Last Article') . "</a></td>"; } print "<td width='20%' align='right'><a href=\"javascript:updateFeedList('last_updated')\">" . __('Updated') . "</a></td>"; } $lnum = 0; $cur_cat_id = -1; while ($line = db_fetch_assoc($result)) { $feed_id = $line["id"]; $cat_id = $line["cat_id"]; $edit_title = htmlspecialchars($line["title"]); $edit_cat = htmlspecialchars($line["category"]); $last_error = $line["last_error"]; if (!$edit_cat) { $edit_cat = __("Uncategorized"); } $last_updated = $line["last_updated"]; if (!$last_updated) { $last_updated = "—"; } else { if (get_pref($link, 'HEADLINES_SMART_DATE')) { $last_updated = smart_date_time(strtotime($last_updated)); } else { $short_date = get_pref($link, 'SHORT_DATE_FORMAT'); $last_updated = date($short_date, strtotime($last_updated)); } } $last_article = $line["last_article"]; if (!$last_article) { $last_article = "—"; } else { if (get_pref($link, 'HEADLINES_SMART_DATE')) { $last_article = smart_date_time(strtotime($last_article)); } else { $short_date = get_pref($link, 'SHORT_DATE_FORMAT'); $last_article = date($short_date, strtotime($last_article)); } } if (get_pref($link, 'ENABLE_FEED_CATS') && $cur_cat_id != $cat_id) { $lnum = 0; print "<tr><td colspan=\"6\" class=\"feedEditCat\">{$edit_cat}</td></tr>"; print "<tr class=\"title\">\n\t\t\t\t\t\t<td width='5%'> </td>"; if (get_pref($link, 'ENABLE_FEED_ICONS')) { print "<td width='3%'> </td>"; } print "<td width='60%'><a href=\"javascript:updateFeedList('title')\">" . __('Title') . "</a></td>"; if ($show_last_article_info) { print "<td width='20%' align='right'>\n\t\t\t\t\t\t\t<a href=\"javascript:updateFeedList('last_article')\">" . __('Last Article') . "</a></td>"; } print "<td width='20%' align='right'>\n\t\t\t\t\t\t<a href=\"javascript:updateFeedList('last_updated')\">" . __('Updated') . "</a></td>"; $cur_cat_id = $cat_id; } $class = $lnum % 2 ? "even" : "odd"; $this_row_id = "id=\"FEEDR-{$feed_id}\""; print "<tr class=\"{$class}\" {$this_row_id}>"; $icon_file = ICONS_DIR . "/{$feed_id}.ico"; if (file_exists($icon_file) && filesize($icon_file) > 0) { $feed_icon = "<img class=\"tinyFeedIcon\"\tsrc=\"" . ICONS_URL . "/{$feed_id}.ico\">"; } else { $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">"; } print "<td class='feedSelect'><input onclick='toggleSelectPrefRow(this, \"feed\");' \n\t\t\t\ttype=\"checkbox\" id=\"FRCHK-" . $line["id"] . "\"></td>"; $onclick = "onclick='editFeed({$feed_id})' title='" . __('Click to edit') . "'"; if (get_pref($link, 'ENABLE_FEED_ICONS')) { print "<td {$onclick} class='feedIcon'>{$feed_icon}</td>"; } if ($last_error) { $edit_title = "<span class=\"feed_error\">{$edit_title}</span>"; $last_updated = "<span class=\"feed_error\">{$last_updated}</span>"; $last_article = "<span class=\"feed_error\">{$last_article}</span>"; } $parent_title = $line["parent_title"]; if ($parent_title) { $linked_to = sprintf(__("(linked to %s)"), $parent_title); $parent_title = "<span class='groupPrompt'>{$linked_to}</span>"; } print "<td {$onclick}>" . "{$edit_title} {$parent_title}" . "</td>"; if ($show_last_article_info) { print "<td align='right' {$onclick}>" . "{$last_article}</td>"; } print "<td {$onclick} align='right'>{$last_updated}</td>"; print "</tr>"; ++$lnum; } print "</table>"; print "<p>"; } else { print "<p>"; if (!$feed_search) { print_warning(__("You don't have any subscribed feeds.")); } else { print_warning(__('No matching feeds found.')); } print "</p>"; } print "<h3>" . __('OPML') . "</h3>"; /* print "<div style='float : left'> <form enctype=\"multipart/form-data\" method=\"POST\" action=\"opml.php\"> ".__('File:')." <input id=\"opml_file\" name=\"opml_file\" type=\"file\"> <input type=\"hidden\" name=\"op\" value=\"Import\"> <button onclick=\"return validateOpmlImport();\" type=\"submit\">".__('Import')."</button> </form></div>"; print " "; */ print "<iframe name=\"upload_iframe\"\n\t\t\tstyle=\"width: 400px; height: 100px; display: none;\"></iframe>"; print "<div style='float : left'>"; print "<form style='display : block' target=\"upload_iframe\"\n\t\t\tenctype=\"multipart/form-data\" method=\"POST\" \n\t\t\t\taction=\"backend.php\">\n\t\t\t<input id=\"opml_file\" name=\"opml_file\" type=\"file\"> \n\t\t\t<input type=\"hidden\" name=\"op\" value=\"dlg\">\n\t\t\t<input type=\"hidden\" name=\"id\" value=\"importOpml\">\n\t\t\t<button onclick=\"return opmlImport();\"\n\t\t\t\ttype=\"submit\">" . __('Import') . "</button>\n\t\t\t</form>"; print "</div> "; print "<button onclick=\"gotoExportOpml()\">" . __('Export OPML') . "</button>"; print "<h3>" . __("Firefox Integration") . "</h3>"; print "<p>" . __('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.') . "</p>"; print "<p"; print "<button onclick='window.navigator.registerContentHandler(" . "\"application/vnd.mozilla.maybe.feed\", " . "\"" . add_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" . __('Click here to register this site as a feed reader.') . "</button>"; print "</p>"; print "<h3>" . __("Published articles") . "</h3>"; if (!get_pref($link, "_PREFS_PUBLISH_KEY")) { set_pref($link, "_PREFS_PUBLISH_KEY", generate_publish_key()); } if (!get_pref($link, "_PREFS_OPML_PUBLISH_KEY")) { set_pref($link, "_PREFS_OPML_PUBLISH_KEY", generate_publish_key()); } print "<p>" . __('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.') . "</p>"; print "<button onclick=\"return displayDlg('pubUrl')\">" . __('Display URL') . "</button> "; print "<p>" . __('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . "</p>"; print "<button onclick=\"return displayDlg('pubOPMLUrl')\">" . __('Display URL') . "</button> "; }
function module_pref_feeds($link) { global $update_intervals; global $purge_intervals; global $update_methods; $subop = $_REQUEST["subop"]; $quiet = $_REQUEST["quiet"]; $mode = $_REQUEST["mode"]; if ($subop == "renamecat") { $title = db_escape_string($_REQUEST['title']); $id = db_escape_string($_REQUEST['id']); if ($title) { db_query($link, "UPDATE ttrss_feed_categories SET\n\t\t\t\t\ttitle = '{$title}' WHERE id = '{$id}' AND owner_uid = " . $_SESSION["uid"]); } return; } if ($subop == "remtwitterinfo") { db_query($link, "UPDATE ttrss_users SET twitter_oauth = NULL\n\t\t\t\tWHERE id = " . $_SESSION['uid']); return; } if ($subop == "getfeedtree") { $search = $_SESSION["prefs_feed_search"]; if ($search) { $search_qpart = " AND LOWER(title) LIKE LOWER('%{$search}%')"; } $root = array(); $root['id'] = 'root'; $root['name'] = __('Feeds'); $root['items'] = array(); $root['type'] = 'category'; if (get_pref($link, 'ENABLE_FEED_CATS')) { $result = db_query($link, "SELECT id, title FROM ttrss_feed_categories\n\t\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY order_id, title"); while ($line = db_fetch_assoc($result)) { $cat = array(); $cat['id'] = 'CAT:' . $line['id']; $cat['bare_id'] = $feed_id; $cat['name'] = $line['title']; $cat['items'] = array(); $cat['checkbox'] = false; $cat['type'] = 'category'; $feed_result = db_query($link, "SELECT id, title, last_error,\n\t\t\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\t\tFROM ttrss_feeds\n\t\t\t\t\t\tWHERE cat_id = '" . $line['id'] . "' AND owner_uid = " . $_SESSION["uid"] . "{$search_qpart} ORDER BY order_id, title"); while ($feed_line = db_fetch_assoc($feed_result)) { $feed = array(); $feed['id'] = 'FEED:' . $feed_line['id']; $feed['bare_id'] = $feed_line['id']; $feed['name'] = $feed_line['title']; $feed['checkbox'] = false; $feed['error'] = $feed_line['last_error']; $feed['icon'] = getFeedIcon($feed_line['id']); $feed['param'] = make_local_datetime($link, $feed_line['last_updated'], true); array_push($cat['items'], $feed); } $cat['param'] = T_sprintf('(%d feeds)', count($cat['items'])); if (count($cat['items']) > 0) { array_push($root['items'], $cat); } $root['param'] += count($cat['items']); } /* Uncategorized is a special case */ $cat = array(); $cat['id'] = 'CAT:0'; $cat['bare_id'] = 0; $cat['name'] = __("Uncategorized"); $cat['items'] = array(); $cat['type'] = 'category'; $cat['checkbox'] = false; $feed_result = db_query($link, "SELECT id, title,last_error,\n\t\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\tFROM ttrss_feeds\n\t\t\t\t\tWHERE cat_id IS NULL AND owner_uid = " . $_SESSION["uid"] . "{$search_qpart} ORDER BY order_id, title"); while ($feed_line = db_fetch_assoc($feed_result)) { $feed = array(); $feed['id'] = 'FEED:' . $feed_line['id']; $feed['bare_id'] = $feed_line['id']; $feed['name'] = $feed_line['title']; $feed['checkbox'] = false; $feed['error'] = $feed_line['last_error']; $feed['icon'] = getFeedIcon($feed_line['id']); $feed['param'] = make_local_datetime($link, $feed_line['last_updated'], true); array_push($cat['items'], $feed); } $cat['param'] = T_sprintf('(%d feeds)', count($cat['items'])); if (count($cat['items']) > 0) { array_push($root['items'], $cat); } $root['param'] += count($cat['items']); $root['param'] = T_sprintf('(%d feeds)', $root['param']); } else { $feed_result = db_query($link, "SELECT id, title, last_error,\n\t\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\tFROM ttrss_feeds\n\t\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . "{$search_qpart} ORDER BY order_id, title"); while ($feed_line = db_fetch_assoc($feed_result)) { $feed = array(); $feed['id'] = 'FEED:' . $feed_line['id']; $feed['bare_id'] = $feed_line['id']; $feed['name'] = $feed_line['title']; $feed['checkbox'] = false; $feed['error'] = $feed_line['last_error']; $feed['icon'] = getFeedIcon($feed_line['id']); $feed['param'] = make_local_datetime($link, $feed_line['last_updated'], true); array_push($root['items'], $feed); } $root['param'] = T_sprintf('(%d feeds)', count($root['items'])); } $fl = array(); $fl['identifier'] = 'id'; $fl['label'] = 'name'; $fl['items'] = array($root); print json_encode($fl); return; } if ($subop == "catsortreset") { db_query($link, "UPDATE ttrss_feed_categories\n\t\t\t\t\tSET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]); return; } if ($subop == "feedsortreset") { db_query($link, "UPDATE ttrss_feeds\n\t\t\t\t\tSET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]); return; } if ($subop == "savefeedorder") { # if ($_POST['payload']) { # file_put_contents("/tmp/blahblah.txt", $_POST['payload']); # $data = json_decode($_POST['payload'], true); # } else { # $data = json_decode(file_get_contents("/tmp/blahblah.txt"), true); # } $data = json_decode($_POST['payload'], true); if (is_array($data) && is_array($data['items'])) { $cat_order_id = 0; $data_map = array(); foreach ($data['items'] as $item) { if ($item['id'] != 'root') { if (is_array($item['items'])) { if (isset($item['items']['_reference'])) { $data_map[$item['id']] = array($item['items']); } else { $data_map[$item['id']] =& $item['items']; } } } } foreach ($data['items'][0]['items'] as $item) { $id = $item['_reference']; $bare_id = substr($id, strpos($id, ':') + 1); ++$cat_order_id; if ($bare_id > 0) { db_query($link, "UPDATE ttrss_feed_categories\n\t\t\t\t\t\t\tSET order_id = '{$cat_order_id}' WHERE id = '{$bare_id}' AND\n\t\t\t\t\t\t\towner_uid = " . $_SESSION["uid"]); } $feed_order_id = 0; if (is_array($data_map[$id])) { foreach ($data_map[$id] as $feed) { $id = $feed['_reference']; $feed_id = substr($id, strpos($id, ':') + 1); if ($bare_id != 0) { $cat_query = "cat_id = '{$bare_id}'"; } else { $cat_query = "cat_id = NULL"; } db_query($link, "UPDATE ttrss_feeds\n\t\t\t\t\t\t\t\tSET order_id = '{$feed_order_id}',\n\t\t\t\t\t\t\t\t{$cat_query}\n\t\t\t\t\t\t\t\tWHERE id = '{$feed_id}' AND\n\t\t\t\t\t\t\t\t\towner_uid = " . $_SESSION["uid"]); ++$feed_order_id; } } } } return; } if ($subop == "removeicon") { $feed_id = db_escape_string($_REQUEST["feed_id"]); $result = db_query($link, "SELECT id FROM ttrss_feeds\n\t\t\t\tWHERE id = '{$feed_id}' AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) != 0) { unlink(ICONS_DIR . "/{$feed_id}.ico"); } return; } if ($subop == "uploadicon") { $icon_file = $_FILES['icon_file']['tmp_name']; $feed_id = db_escape_string($_REQUEST["feed_id"]); if (is_file($icon_file) && $feed_id) { if (filesize($icon_file) < 20000) { $result = db_query($link, "SELECT id FROM ttrss_feeds\n\t\t\t\t\t\tWHERE id = '{$feed_id}' AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) != 0) { unlink(ICONS_DIR . "/{$feed_id}.ico"); move_uploaded_file($icon_file, ICONS_DIR . "/{$feed_id}.ico"); $rc = 0; } else { $rc = 2; } } else { $rc = 1; } } else { $rc = 2; } print "<script type=\"text/javascript\">"; print "parent.uploadIconHandler({$rc});"; print "</script>"; return; } if ($subop == "editfeed") { $feed_id = db_escape_string($_REQUEST["id"]); $result = db_query($link, "SELECT * FROM ttrss_feeds WHERE id = '{$feed_id}' AND\n\t\t\t\t\towner_uid = " . $_SESSION["uid"]); $title = htmlspecialchars(db_fetch_result($result, 0, "title")); print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"{$feed_id}\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"editSave\">"; print "<div class=\"dlgSec\">" . __("Feed") . "</div>"; print "<div class=\"dlgSecCont\">"; /* Title */ print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"\n\t\t\t\tplaceHolder=\"" . __("Feed Title") . "\"\n\t\t\t\tstyle=\"font-size : 16px; width: 20em\" name=\"title\" value=\"{$title}\">"; /* Feed URL */ $feed_url = db_fetch_result($result, 0, "feed_url"); $feed_url = htmlspecialchars(db_fetch_result($result, 0, "feed_url")); print "<hr/>"; print __('URL:') . " "; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"\n\t\t\t\tplaceHolder=\"" . __("Feed URL") . "\"\n\t\t\t\tregExp='^(http|https)://.*' style=\"width : 20em\"\n\t\t\t\tname=\"feed_url\" value=\"{$feed_url}\">"; $last_error = db_fetch_result($result, 0, "last_error"); if ($last_error) { print " <span title=\"" . htmlspecialchars($last_error) . "\"\n\t\t\t\t\tclass=\"feed_error\">(error)</span>"; } /* Category */ if (get_pref($link, 'ENABLE_FEED_CATS')) { $cat_id = db_fetch_result($result, 0, "cat_id"); print "<hr/>"; print __('Place in category:') . " "; print_feed_cat_select($link, "cat_id", $cat_id, 'dojoType="dijit.form.Select"'); } print "</div>"; print "<div class=\"dlgSec\">" . __("Update") . "</div>"; print "<div class=\"dlgSecCont\">"; /* Update Interval */ $update_interval = db_fetch_result($result, 0, "update_interval"); print_select_hash("update_interval", $update_interval, $update_intervals, 'dojoType="dijit.form.Select"'); /* Update method */ $update_method = db_fetch_result($result, 0, "update_method", 'dojoType="dijit.form.Select"'); print " " . __('using') . " "; print_select_hash("update_method", $update_method, $update_methods, 'dojoType="dijit.form.Select"'); $purge_interval = db_fetch_result($result, 0, "purge_interval"); /* Purge intl */ print "<hr/>"; print __('Article purging:') . " "; print_select_hash("purge_interval", $purge_interval, $purge_intervals, 'dojoType="dijit.form.Select" ' . (FORCE_ARTICLE_PURGE == 0 ? "" : 'disabled="1"')); print "</div>"; print "<div class=\"dlgSec\">" . __("Authentication") . "</div>"; print "<div class=\"dlgSecCont\">"; $auth_login = htmlspecialchars(db_fetch_result($result, 0, "auth_login")); # print "<table>"; # print "<tr><td>" . __('Login:'******'<b>Hint:</b> you need to fill in your login information if your feed requires authentication, except for Twitter feeds.') . "\n\t\t\t\t</div>"; # print "</td></tr></table>"; print "</div>"; print "<div class=\"dlgSec\">" . __("Options") . "</div>"; print "<div class=\"dlgSecCont\">"; # print "<div style=\"line-height : 100%\">"; $private = sql_bool_to_bool(db_fetch_result($result, 0, "private")); if ($private) { $checked = "checked=\"1\""; } else { $checked = ""; } print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"private\" id=\"private\"\n\t\t\t\t{$checked}> <label for=\"private\">" . __('Hide from Popular feeds') . "</label>"; $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content")); if ($rtl_content) { $checked = "checked=\"1\""; } else { $checked = ""; } print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"\n\t\t\t\t{$checked}> <label for=\"rtl_content\">" . __('Right-to-left content') . "</label>"; $include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest")); if ($include_in_digest) { $checked = "checked=\"1\""; } else { $checked = ""; } print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"include_in_digest\"\n\t\t\t\tname=\"include_in_digest\"\n\t\t\t\t{$checked}> <label for=\"include_in_digest\">" . __('Include in e-mail digest') . "</label>"; $always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures")); if ($always_display_enclosures) { $checked = "checked"; } else { $checked = ""; } print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"always_display_enclosures\"\n\t\t\t\tname=\"always_display_enclosures\"\n\t\t\t\t{$checked}> <label for=\"always_display_enclosures\">" . __('Always display image attachments') . "</label>"; $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images")); if ($cache_images) { $checked = "checked=\"1\""; } else { $checked = ""; } if (SIMPLEPIE_CACHE_IMAGES) { print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"cache_images\"\n\t\t\t\tname=\"cache_images\"\n\t\t\t\t{$checked}> <label for=\"cache_images\">" . __('Cache images locally (SimplePie only)') . "</label>"; } $mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update")); if ($mark_unread_on_update) { $checked = "checked"; } else { $checked = ""; } print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"mark_unread_on_update\"\n\t\t\t\tname=\"mark_unread_on_update\"\n\t\t\t\t{$checked}> <label for=\"mark_unread_on_update\">" . __('Mark updated articles as unread') . "</label>"; $update_on_checksum_change = sql_bool_to_bool(db_fetch_result($result, 0, "update_on_checksum_change")); if ($update_on_checksum_change) { $checked = "checked"; } else { $checked = ""; } print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"update_on_checksum_change\"\n\t\t\t\tname=\"update_on_checksum_change\"\n\t\t\t\t{$checked}> <label for=\"update_on_checksum_change\">" . __('Mark posts as updated on content change') . "</label>"; # print "</div>"; print "</div>"; /* Icon */ print "<div class=\"dlgSec\">" . __("Icon") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<iframe name=\"icon_upload_iframe\"\n\t\t\t\tstyle=\"width: 400px; height: 100px; display: none;\"></iframe>"; print "<form style='display : block' target=\"icon_upload_iframe\"\n\t\t\t\tenctype=\"multipart/form-data\" method=\"POST\"\n\t\t\t\taction=\"backend.php\">\n\t\t\t\t<input id=\"icon_file\" size=\"10\" name=\"icon_file\" type=\"file\">\n\t\t\t\t<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">\n\t\t\t\t<input type=\"hidden\" name=\"feed_id\" value=\"{$feed_id}\">\n\t\t\t\t<input type=\"hidden\" name=\"subop\" value=\"uploadicon\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return uploadFeedIcon();\"\n\t\t\t\t\ttype=\"submit\">" . __('Replace') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return removeFeedIcon({$feed_id});\"\n\t\t\t\t\ttype=\"submit\">" . __('Remove') . "</button>\n\t\t\t\t</form>"; print "</div>"; $title = htmlspecialchars($title, ENT_QUOTES); print "<div class='dlgButtons'>\n\t\t\t\t<div style=\"float : left\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick='return unsubscribeFeed({$feed_id}, \"{$title}\")'>" . __('Unsubscribe') . "</button>"; if (PUBSUBHUBBUB_ENABLED) { $pubsub_state = db_fetch_result($result, 0, "pubsub_state"); $pubsub_btn_disabled = $pubsub_state == 2 ? "" : "disabled=\"1\""; print "<button dojoType=\"dijit.form.Button\" id=\"pubsubReset_Btn\" {$pubsub_btn_disabled}\n\t\t\t\t\t\tonclick='return resetPubSub({$feed_id}, \"{$title}\")'>" . __('Resubscribe to push updates') . "</button>"; } print "</div>"; print "<div dojoType=\"dijit.Tooltip\" connectId=\"pubsubReset_Btn\" position=\"below\">" . __('Resets PubSubHubbub subscription status for push-enabled feeds.') . "</div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedEditDlg').execute()\">" . __('Save') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedEditDlg').hide()\">" . __('Cancel') . "</button>\n\t\t\t</div>"; return; } if ($subop == "editfeeds") { $feed_ids = db_escape_string($_REQUEST["ids"]); print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"ids\" value=\"{$feed_ids}\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"batchEditSave\">"; print "<div class=\"dlgSec\">" . __("Feed") . "</div>"; print "<div class=\"dlgSecCont\">"; /* Title */ print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\tdisabled=\"1\" style=\"font-size : 16px; width : 20em;\" required=\"1\"\n\t\t\t\tname=\"title\" value=\"{$title}\">"; batch_edit_cbox("title"); /* Feed URL */ print "<br/>"; print __('URL:') . " "; print "<input dojoType=\"dijit.form.ValidationTextBox\" disabled=\"1\"\n\t\t\t\trequired=\"1\" regExp='^(http|https)://.*' style=\"width : 20em\"\n\t\t\t\tname=\"feed_url\" value=\"{$feed_url}\">"; batch_edit_cbox("feed_url"); /* Category */ if (get_pref($link, 'ENABLE_FEED_CATS')) { print "<br/>"; print __('Place in category:') . " "; print_feed_cat_select($link, "cat_id", $cat_id, 'disabled="1" dojoType="dijit.form.Select"'); batch_edit_cbox("cat_id"); } print "</div>"; print "<div class=\"dlgSec\">" . __("Update") . "</div>"; print "<div class=\"dlgSecCont\">"; /* Update Interval */ print_select_hash("update_interval", $update_interval, $update_intervals, 'disabled="1" dojoType="dijit.form.Select"'); batch_edit_cbox("update_interval"); /* Update method */ print " " . __('using') . " "; print_select_hash("update_method", $update_method, $update_methods, 'disabled="1" dojoType="dijit.form.Select"'); batch_edit_cbox("update_method"); /* Purge intl */ if (FORCE_ARTICLE_PURGE == 0) { print "<br/>"; print __('Article purging:') . " "; print_select_hash("purge_interval", $purge_interval, $purge_intervals, 'disabled="1" dojoType="dijit.form.Select"'); batch_edit_cbox("purge_interval"); } print "</div>"; print "<div class=\"dlgSec\">" . __("Authentication") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<input dojoType=\"dijit.form.TextBox\"\n\t\t\t\tplaceHolder=\"" . __("Login") . "\" disabled=\"1\"\n\t\t\t\tname=\"auth_login\" value=\"{$auth_login}\">"; batch_edit_cbox("auth_login"); print "<br/><input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\"\n\t\t\t\tplaceHolder=\"" . __("Password") . "\" disabled=\"1\"\n\t\t\t\tvalue=\"{$auth_pass}\">"; batch_edit_cbox("auth_pass"); print "</div>"; print "<div class=\"dlgSec\">" . __("Options") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<input disabled=\"1\" type=\"checkbox\" name=\"private\" id=\"private\"\n\t\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"private_l\" class='insensitive' for=\"private\">" . __('Hide from Popular feeds') . "</label>"; print " "; batch_edit_cbox("private", "private_l"); print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"\n\t\t\t\tdojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"rtl_content_l\" for=\"rtl_content\">" . __('Right-to-left content') . "</label>"; print " "; batch_edit_cbox("rtl_content", "rtl_content_l"); print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"include_in_digest\"\n\t\t\t\tname=\"include_in_digest\"\n\t\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"include_in_digest_l\" class='insensitive' for=\"include_in_digest\">" . __('Include in e-mail digest') . "</label>"; print " "; batch_edit_cbox("include_in_digest", "include_in_digest_l"); print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"always_display_enclosures\"\n\t\t\t\tname=\"always_display_enclosures\"\n\t\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"always_display_enclosures_l\" class='insensitive' for=\"always_display_enclosures\">" . __('Always display image attachments') . "</label>"; print " "; batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l"); if (SIMPLEPIE_CACHE_IMAGES) { print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"cache_images\"\n\t\t\t\t\tname=\"cache_images\"\n\t\t\t\t\tdojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"cache_images_l\"\n\t\t\t\t\tfor=\"cache_images\">" . __('Cache images locally') . "</label>"; print " "; batch_edit_cbox("cache_images", "cache_images_l"); } print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"mark_unread_on_update\"\n\t\t\t\tname=\"mark_unread_on_update\"\n\t\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"mark_unread_on_update_l\" class='insensitive' for=\"mark_unread_on_update\">" . __('Mark updated articles as unread') . "</label>"; print " "; batch_edit_cbox("mark_unread_on_update", "mark_unread_on_update_l"); print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"update_on_checksum_change\"\n\t\t\t\tname=\"update_on_checksum_change\"\n\t\t\t\tdojoType=\"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>"; print " "; batch_edit_cbox("update_on_checksum_change", "update_on_checksum_change_l"); print "</div>"; print "<div class='dlgButtons'>\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"return dijit.byId('feedEditDlg').execute()\">" . __('Save') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return dijit.byId('feedEditDlg').hide()\">" . __('Cancel') . "</button>\n\t\t\t\t</div>"; return; } if ($subop == "editSave" || $subop == "batchEditSave") { $feed_title = db_escape_string(trim($_POST["title"])); $feed_link = db_escape_string(trim($_POST["feed_url"])); $upd_intl = (int) db_escape_string($_POST["update_interval"]); $purge_intl = (int) db_escape_string($_POST["purge_interval"]); $feed_id = (int) db_escape_string($_POST["id"]); /* editSave */ $feed_ids = db_escape_string($_POST["ids"]); /* batchEditSave */ $cat_id = (int) db_escape_string($_POST["cat_id"]); $auth_login = db_escape_string(trim($_POST["auth_login"])); $auth_pass = db_escape_string(trim($_POST["auth_pass"])); $private = checkbox_to_sql_bool(db_escape_string($_POST["private"])); $rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"])); $include_in_digest = checkbox_to_sql_bool(db_escape_string($_POST["include_in_digest"])); $cache_images = checkbox_to_sql_bool(db_escape_string($_POST["cache_images"])); $update_method = (int) db_escape_string($_POST["update_method"]); $always_display_enclosures = checkbox_to_sql_bool(db_escape_string($_POST["always_display_enclosures"])); $mark_unread_on_update = checkbox_to_sql_bool(db_escape_string($_POST["mark_unread_on_update"])); $update_on_checksum_change = checkbox_to_sql_bool(db_escape_string($_POST["update_on_checksum_change"])); if (get_pref($link, 'ENABLE_FEED_CATS')) { if ($cat_id && $cat_id != 0) { $category_qpart = "cat_id = '{$cat_id}',"; $category_qpart_nocomma = "cat_id = '{$cat_id}'"; } else { $category_qpart = 'cat_id = NULL,'; $category_qpart_nocomma = 'cat_id = NULL'; } } else { $category_qpart = ""; $category_qpart_nocomma = ""; } if (SIMPLEPIE_CACHE_IMAGES) { $cache_images_qpart = "cache_images = {$cache_images},"; } else { $cache_images_qpart = ""; } if ($subop == "editSave") { $result = db_query($link, "UPDATE ttrss_feeds SET\n\t\t\t\t\t{$category_qpart}\n\t\t\t\t\ttitle = '{$feed_title}', feed_url = '{$feed_link}',\n\t\t\t\t\tupdate_interval = '{$upd_intl}',\n\t\t\t\t\tpurge_interval = '{$purge_intl}',\n\t\t\t\t\tauth_login = '******',\n\t\t\t\t\tauth_pass = '******',\n\t\t\t\t\tprivate = {$private},\n\t\t\t\t\trtl_content = {$rtl_content},\n\t\t\t\t\t{$cache_images_qpart}\n\t\t\t\t\tinclude_in_digest = {$include_in_digest},\n\t\t\t\t\talways_display_enclosures = {$always_display_enclosures},\n\t\t\t\t\tmark_unread_on_update = {$mark_unread_on_update},\n\t\t\t\t\tupdate_on_checksum_change = {$update_on_checksum_change},\n\t\t\t\t\tupdate_method = '{$update_method}'\n\t\t\t\t\tWHERE id = '{$feed_id}' AND owner_uid = " . $_SESSION["uid"]); } else { if ($subop == "batchEditSave") { $feed_data = array(); foreach (array_keys($_POST) as $k) { if ($k != "op" && $k != "subop" && $k != "ids") { $feed_data[$k] = $_POST[$k]; } } db_query($link, "BEGIN"); foreach (array_keys($feed_data) as $k) { $qpart = ""; switch ($k) { case "title": $qpart = "title = '{$feed_title}'"; break; case "feed_url": $qpart = "feed_url = '{$feed_link}'"; break; case "update_interval": $qpart = "update_interval = '{$upd_intl}'"; break; case "purge_interval": $qpart = "purge_interval = '{$purge_intl}'"; break; case "auth_login": $qpart = "auth_login = '******'"; break; case "auth_pass": $qpart = "auth_pass = '******'"; break; case "private": $qpart = "private = '{$private}'"; break; case "include_in_digest": $qpart = "include_in_digest = '{$include_in_digest}'"; break; case "always_display_enclosures": $qpart = "always_display_enclosures = '{$always_display_enclosures}'"; break; case "mark_unread_on_update": $qpart = "mark_unread_on_update = '{$mark_unread_on_update}'"; break; case "update_on_checksum_change": $qpart = "update_on_checksum_change = '{$update_on_checksum_change}'"; break; case "cache_images": $qpart = "cache_images = '{$cache_images}'"; break; case "rtl_content": $qpart = "rtl_content = '{$rtl_content}'"; break; case "update_method": $qpart = "update_method = '{$update_method}'"; break; case "cat_id": $qpart = $category_qpart_nocomma; break; } if ($qpart) { db_query($link, "UPDATE ttrss_feeds SET {$qpart} WHERE id IN ({$feed_ids})\n\t\t\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]); print "<br/>"; } } db_query($link, "COMMIT"); } } return; } if ($subop == "resetPubSub") { $ids = db_escape_string($_REQUEST["ids"]); db_query($link, "UPDATE ttrss_feeds SET pubsub_state = 0 WHERE id IN ({$ids})\n\t\t\t\tAND owner_uid = " . $_SESSION["uid"]); return; } if ($subop == "remove") { $ids = split(",", db_escape_string($_REQUEST["ids"])); foreach ($ids as $id) { remove_feed($link, $id, $_SESSION["uid"]); } return; } if ($subop == "clear") { $id = db_escape_string($_REQUEST["id"]); clear_feed_articles($link, $id); } if ($subop == "rescore") { $ids = split(",", db_escape_string($_REQUEST["ids"])); foreach ($ids as $id) { $filters = load_filters($link, $id, $_SESSION["uid"], 6); $result = db_query($link, "SELECT\n\t\t\t\t\ttitle, content, link, ref_id, author," . SUBSTRING_FOR_DATE . "(updated, 1, 19) AS updated\n\t\t\t\t \tFROM\n\t\t\t\t\t\tttrss_user_entries, ttrss_entries\n\t\t\t\t\t\tWHERE ref_id = id AND feed_id = '{$id}' AND\n\t\t\t\t\t\t\towner_uid = " . $_SESSION['uid'] . "\n\t\t\t\t\t\t"); $scores = array(); while ($line = db_fetch_assoc($result)) { $tags = get_article_tags($link, $line["ref_id"]); $article_filters = get_article_filters($filters, $line['title'], $line['content'], $line['link'], strtotime($line['updated']), $line['author'], $tags); $new_score = calculate_article_score($article_filters); if (!$scores[$new_score]) { $scores[$new_score] = array(); } array_push($scores[$new_score], $line['ref_id']); } foreach (array_keys($scores) as $s) { if ($s > 1000) { db_query($link, "UPDATE ttrss_user_entries SET score = '{$s}',\n\t\t\t\t\t\t\tmarked = true WHERE\n\t\t\t\t\t\t\tref_id IN (" . join(',', $scores[$s]) . ")"); } else { if ($s < -500) { db_query($link, "UPDATE ttrss_user_entries SET score = '{$s}',\n\t\t\t\t\t\t\tunread = false WHERE\n\t\t\t\t\t\t\tref_id IN (" . join(',', $scores[$s]) . ")"); } else { db_query($link, "UPDATE ttrss_user_entries SET score = '{$s}' WHERE\n\t\t\t\t\t\t\tref_id IN (" . join(',', $scores[$s]) . ")"); } } } } print __("All done."); } if ($subop == "rescoreAll") { $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']); while ($feed_line = db_fetch_assoc($result)) { $id = $feed_line["id"]; $filters = load_filters($link, $id, $_SESSION["uid"], 6); $tmp_result = db_query($link, "SELECT\n\t\t\t\t\ttitle, content, link, ref_id, author," . SUBSTRING_FOR_DATE . "(updated, 1, 19) AS updated\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\tttrss_user_entries, ttrss_entries\n\t\t\t\t\t\tWHERE ref_id = id AND feed_id = '{$id}' AND\n\t\t\t\t\t\t\towner_uid = " . $_SESSION['uid'] . "\n\t\t\t\t\t\t"); $scores = array(); while ($line = db_fetch_assoc($tmp_result)) { $tags = get_article_tags($link, $line["ref_id"]); $article_filters = get_article_filters($filters, $line['title'], $line['content'], $line['link'], strtotime($line['updated']), $line['author'], $tags); $new_score = calculate_article_score($article_filters); if (!$scores[$new_score]) { $scores[$new_score] = array(); } array_push($scores[$new_score], $line['ref_id']); } foreach (array_keys($scores) as $s) { if ($s > 1000) { db_query($link, "UPDATE ttrss_user_entries SET score = '{$s}',\n\t\t\t\t\t\t\tmarked = true WHERE\n\t\t\t\t\t\t\tref_id IN (" . join(',', $scores[$s]) . ")"); } else { db_query($link, "UPDATE ttrss_user_entries SET score = '{$s}' WHERE\n\t\t\t\t\t\t\tref_id IN (" . join(',', $scores[$s]) . ")"); } } } print __("All done."); } if ($subop == "add") { $feed_url = db_escape_string(trim($_REQUEST["feed_url"])); $cat_id = db_escape_string($_REQUEST["cat_id"]); $p_from = db_escape_string($_REQUEST["from"]); /* only read authentication information from POST */ $auth_login = db_escape_string(trim($_POST["auth_login"])); $auth_pass = db_escape_string(trim($_POST["auth_pass"])); if ($p_from != 'tt-rss') { header("Content-Type: text/html"); print "<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<title>Tiny Tiny RSS</title>\n\t\t\t\t\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"utility.css\">\n\t\t\t\t\t</head>\n\t\t\t\t\t<body>\n\t\t\t\t\t<img class=\"floatingLogo\" src=\"images/ttrss_logo.png\"\n\t\t\t\t \t\talt=\"Tiny Tiny RSS\"/>\n\t\t\t\t\t<h1>Subscribe to feed...</h1>"; } $rc = subscribe_to_feed($link, $feed_url, $cat_id, $auth_login, $auth_pass); switch ($rc) { case 1: print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url)); break; case 2: print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url)); break; case 3: print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url)); break; case 0: print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url)); break; case 4: print_notice("Multiple feed URLs found."); $feed_urls = get_feeds_from_html($feed_url); break; case 5: print_error(T_sprintf("Could not subscribe to <b>%s</b>.<br>Can't download the Feed URL.", $feed_url)); break; } if ($p_from != 'tt-rss') { if ($feed_urls) { print "<form action=\"backend.php\">"; print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">"; print "<input type=\"hidden\" name=\"quiet\" value=\"1\">"; print "<input type=\"hidden\" name=\"subop\" value=\"add\">"; print "<select name=\"feed_url\">"; foreach ($feed_urls as $url => $name) { $url = htmlspecialchars($url); $name = htmlspecialchars($name); print "<option value=\"{$url}\">{$name}</option>"; } print "<input type=\"submit\" value=\"" . __("Subscribe to selected feed") . "\">"; print "</form>"; } $tp_uri = get_self_url_prefix() . "/prefs.php"; $tt_uri = get_self_url_prefix(); if ($rc <= 2) { $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE\n\t\t\t\t\t\tfeed_url = '{$feed_url}' AND owner_uid = " . $_SESSION["uid"]); $feed_id = db_fetch_result($result, 0, "id"); } else { $feed_id = 0; } print "<p>"; if ($feed_id) { print "<form method=\"GET\" style='display: inline'\n\t\t\t\t\t\taction=\"{$tp_uri}\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"tab\" value=\"feedConfig\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"subop\" value=\"editFeed\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"subopparam\" value=\"{$feed_id}\">\n\t\t\t\t\t\t<input type=\"submit\" value=\"" . __("Edit subscription options") . "\">\n\t\t\t\t\t\t</form>"; } print "<form style='display: inline' method=\"GET\" action=\"{$tt_uri}\">\n\t\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t\t</form></p>"; print "</body></html>"; return; } } if ($subop == "categorize") { $ids = split(",", db_escape_string($_REQUEST["ids"])); $cat_id = db_escape_string($_REQUEST["cat_id"]); if ($cat_id == 0) { $cat_id_qpart = 'NULL'; } else { $cat_id_qpart = "'{$cat_id}'"; } db_query($link, "BEGIN"); foreach ($ids as $id) { db_query($link, "UPDATE ttrss_feeds SET cat_id = {$cat_id_qpart}\n\t\t\t\t\tWHERE id = '{$id}'\n\t\t\t\t \tAND owner_uid = " . $_SESSION["uid"]); } db_query($link, "COMMIT"); } if ($subop == "editCats") { $action = $_REQUEST["action"]; if ($action == "save") { $cat_title = db_escape_string(trim($_REQUEST["value"])); $cat_id = db_escape_string($_REQUEST["cid"]); db_query($link, "BEGIN"); $result = db_query($link, "SELECT title FROM ttrss_feed_categories\n\t\t\t\t\tWHERE id = '{$cat_id}' AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) == 1) { $old_title = db_fetch_result($result, 0, "title"); if ($cat_title != "") { $result = db_query($link, "UPDATE ttrss_feed_categories SET\n\t\t\t\t\t\t\ttitle = '{$cat_title}' WHERE id = '{$cat_id}' AND\n\t\t\t\t\t\t\towner_uid = " . $_SESSION["uid"]); print $cat_title; } else { print $old_title; } } else { print $_REQUEST["value"]; } db_query($link, "COMMIT"); return; } if ($action == "add") { $feed_cat = db_escape_string(trim($_REQUEST["cat"])); if (!add_feed_category($link, $feed_cat)) { print_warning(T_sprintf("Category <b>\$%s</b> already exists in the database.", $feed_cat)); } } if ($action == "remove") { $ids = split(",", db_escape_string($_REQUEST["ids"])); foreach ($ids as $id) { remove_feed_category($link, $id, $_SESSION["uid"]); } } print "<div dojoType=\"dijit.Toolbar\">\n\t\t\t\t<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"newcat\">\n\t\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedCatEditDlg').addCategory()\">" . __('Create category') . "</button></div>"; $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories\n\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . "\n\t\t\t\tORDER BY title"); # print "<p>"; if (db_num_rows($result) != 0) { print "<div class=\"prefFeedCatHolder\">"; # print "<form id=\"feed_cat_edit_form\" onsubmit=\"return false\">"; print "<table width=\"100%\" class=\"prefFeedCatList\"\n\t\t\t\t\tcellspacing=\"0\" id=\"prefFeedCatList\">"; $lnum = 0; while ($line = db_fetch_assoc($result)) { $class = $lnum % 2 ? "even" : "odd"; $cat_id = $line["id"]; $this_row_id = "id=\"FCATR-{$cat_id}\""; print "<tr class=\"\" {$this_row_id}>"; $edit_title = htmlspecialchars($line["title"]); print "<td width='5%' align='center'><input\n\t\t\t\t\t\tonclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\t\ttype=\"checkbox\"></td>"; print "<td>"; # print "<span id=\"FCATT-$cat_id\">" . # $edit_title . "</span>"; print "<span dojoType=\"dijit.InlineEditBox\"\n\t\t\t\t\t\twidth=\"300px\" autoSave=\"false\"\n\t\t\t\t\t\tcat-id=\"{$cat_id}\">" . $edit_title . "<script type=\"dojo/method\" event=\"onChange\" args=\"item\">\n\t\t\t\t\t\t\tvar elem = this;\n\t\t\t\t\t\t\tdojo.xhrPost({\n\t\t\t\t\t\t\t\turl: 'backend.php',\n\t\t\t\t\t\t\t\tcontent: {op: 'pref-feeds', subop: 'editCats',\n\t\t\t\t\t\t\t\t\taction: 'save',\n\t\t\t\t\t\t\t\t\tvalue: this.value,\n\t\t\t\t\t\t\t\t\tcid: this.srcNodeRef.getAttribute('cat-id')},\n\t\t\t\t\t\t\t\t\tload: function(response) {\n\t\t\t\t\t\t\t\t\t\telem.attr('value', response);\n\t\t\t\t\t\t\t\t\t\tupdateFeedList();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t</script>\n\t\t\t\t\t</span>"; print "</td></tr>"; ++$lnum; } print "</table>"; # print "</form>"; print "</div>"; } else { print "<p>" . __('No feed categories defined.') . "</p>"; } print "<div class='dlgButtons'>\n\t\t\t\t<div style='float : left'>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedCatEditDlg').removeSelected()\">" . __('Remove selected categories') . "</button>\n\t\t\t\t</div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedCatEditDlg').hide()\">" . __('Close this window') . "</button></div>"; return; } if ($quiet) { return; } print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">"; print "<div id=\"pref-feeds-feeds\" dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Feeds') . "\">"; /* print "<div dojoType=\"dijit.layout.BorderContainer\">"; print "< print "</div>"; */ $result = db_query($link, "SELECT COUNT(id) AS num_errors\n\t\t\tFROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION["uid"]); $num_errors = db_fetch_result($result, 0, "num_errors"); if ($num_errors > 0) { $error_button = "<button dojoType=\"dijit.form.Button\"\n\t\t\t \t\tonclick=\"showFeedsWithErrors()\" id=\"errorButton\">" . __("Feeds with errors") . "</button>"; // print format_notice("<a href=\"javascript:showFeedsWithErrors()\">". // __('Some feeds have update errors (click for details)')."</a>"); } if (DB_TYPE == "pgsql") { $interval_qpart = "NOW() - INTERVAL '3 months'"; } else { $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)"; } $result = db_query($link, "SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE\n\t\t\t\t\t(SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE\n\t\t\t\t\t\tttrss_entries.id = ref_id AND\n\t\t\t\t\t\t\tttrss_user_entries.feed_id = ttrss_feeds.id) < {$interval_qpart} AND\n\t\t\tttrss_feeds.owner_uid = " . $_SESSION["uid"]); $num_inactive = db_fetch_result($result, 0, "num_inactive"); if ($num_inactive > 0) { $inactive_button = "<button dojoType=\"dijit.form.Button\"\n\t\t\t \t\tonclick=\"showInactiveFeeds()\">" . __("Inactive feeds") . "</button>"; } $feed_search = db_escape_string($_REQUEST["search"]); if (array_key_exists("search", $_REQUEST)) { $_SESSION["prefs_feed_search"] = $feed_search; } else { $feed_search = $_SESSION["prefs_feed_search"]; } print '<div dojoType="dijit.layout.BorderContainer" gutters="false">'; print "<div region='top' dojoType=\"dijit.Toolbar\">"; #toolbar print "<div style='float : right; padding-right : 4px;'>\n\t\t\t<input dojoType=\"dijit.form.TextBox\" id=\"feed_search\" size=\"20\" type=\"search\"\n\t\t\t\tvalue=\"{$feed_search}\">\n\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"updateFeedList()\">" . __('Search') . "</button>\n\t\t\t</div>"; print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Select') . "</span>"; print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(true)\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('All') . "</div>"; print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(false)\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('None') . "</div>"; print "</div></div>"; print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Feeds') . "</span>"; print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; print "<div onclick=\"quickAddFeed()\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('Subscribe to feed') . "</div>"; print "<div onclick=\"editSelectedFeed()\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('Edit selected feeds') . "</div>"; print "<div onclick=\"resetFeedOrder()\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('Reset sort order') . "</div>"; print "</div></div>"; if (get_pref($link, 'ENABLE_FEED_CATS')) { print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Categories') . "</span>"; print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; print "<div onclick=\"editFeedCats()\"\n\t\t\t\tdojoType=\"dijit.MenuItem\">" . __('Edit categories') . "</div>"; print "<div onclick=\"resetCatOrder()\"\n\t\t\t\tdojoType=\"dijit.MenuItem\">" . __('Reset sort order') . "</div>"; print "</div></div>"; } print $error_button; print $inactive_button; print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedFeeds()\">" . __('Unsubscribe') . "</button dojoType=\"dijit.form.Button\"> "; if (defined('_ENABLE_FEED_DEBUGGING')) { print "<select id=\"feedActionChooser\" onchange=\"feedActionChange()\">\n\t\t\t\t<option value=\"facDefault\" selected>" . __('More actions...') . "</option>"; if (FORCE_ARTICLE_PURGE == 0) { print "<option value=\"facPurge\">" . __('Manual purge') . "</option>"; } print "\n\t\t\t\t<option value=\"facClear\">" . __('Clear feed data') . "</option>\n\t\t\t\t<option value=\"facRescore\">" . __('Rescore articles') . "</option>"; print "</select>"; } print "</div>"; # toolbar //print '</div>'; print '<div dojoType="dijit.layout.ContentPane" region="center">'; print "<div id=\"feedlistLoading\">\n\t\t<img src='images/indicator_tiny.gif'>" . __("Loading, please wait...") . "</div>"; print "<div dojoType=\"fox.PrefFeedStore\" jsId=\"feedStore\"\n\t\t\turl=\"backend.php?op=pref-feeds&subop=getfeedtree\">\n\t\t</div>\n\t\t<div dojoType=\"lib.CheckBoxStoreModel\" jsId=\"feedModel\" store=\"feedStore\"\n\t\tquery=\"{id:'root'}\" rootId=\"root\" rootLabel=\"Feeds\"\n\t\t\tchildrenAttrs=\"items\" checkboxStrict=\"false\" checkboxAll=\"false\">\n\t\t</div>\n\t\t<div dojoType=\"fox.PrefFeedTree\" id=\"feedTree\"\n\t\t\tdndController=\"dijit.tree.dndSource\"\n\t\t\tbetweenThreshold=\"5\"\n\t\t\tmodel=\"feedModel\" openOnClick=\"false\">\n\t\t<script type=\"dojo/method\" event=\"onClick\" args=\"item\">\n\t\t\tvar id = String(item.id);\n\t\t\tvar bare_id = id.substr(id.indexOf(':')+1);\n\n\t\t\tif (id.match('FEED:')) {\n\t\t\t\teditFeed(bare_id);\n\t\t\t} else if (id.match('CAT:')) {\n\t\t\t\teditCat(bare_id, item);\n\t\t\t}\n\t\t</script>\n\t\t<script type=\"dojo/method\" event=\"onLoad\" args=\"item\">\n\t\t\tElement.hide(\"feedlistLoading\");\n\t\t</script>\n\t\t</div>"; print "<div dojoType=\"dijit.Tooltip\" connectId=\"feedTree\" position=\"below\">\n\t\t\t" . __('<b>Hint:</b> you can drag feeds and categories around.') . "\n\t\t\t</div>"; print '</div>'; print '</div>'; print "</div>"; # feeds pane print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('OPML') . "\">"; print "<p>" . __("Using OPML you can export and import your feeds and Tiny Tiny RSS settings.") . " "; print "<span class=\"insensitive\">" . __("Note: Only main settings profile can be migrated using OPML.") . "</span>"; print "</p>"; print "<h3>" . __("Import") . "</h3>"; print "<br/><iframe id=\"upload_iframe\"\n\t\t\tname=\"upload_iframe\" onload=\"opmlImportComplete(this)\"\n\t\t\tstyle=\"width: 400px; height: 100px; display: none;\"></iframe>"; print "<form name=\"opml_form\" style='display : block' target=\"upload_iframe\"\n\t\t\tenctype=\"multipart/form-data\" method=\"POST\"\n\t\t\t\taction=\"backend.php\">\n\t\t\t<input id=\"opml_file\" name=\"opml_file\" type=\"file\"> \n\t\t\t<input type=\"hidden\" name=\"op\" value=\"dlg\">\n\t\t\t<input type=\"hidden\" name=\"id\" value=\"importOpml\">\n\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return opmlImport();\" type=\"submit\">" . __('Import') . "</button>"; print "<h3>" . __("Export") . "</h3>"; print "<p>" . __('Filename:') . " <input type=\"text\" id=\"filename\" value=\"TinyTinyRSS.opml\" /> " . __('Include settings') . "<input type=\"checkbox\" id=\"settings\" CHECKED />" . "<button dojoType=\"dijit.form.Button\"\n\t\t\tonclick=\"gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked)\" >" . __('Export') . "</button></p></form>"; print "<h3>" . __("Publish") . "</h3>"; print "<p>" . __('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . " "; print "<span class=\"insensitive\">" . __("Note: Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") . "</span>" . "</p>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return displayDlg('pubOPMLUrl')\">" . __('Display URL') . "</button> "; print "</div>"; # pane if (strpos($_SERVER['HTTP_USER_AGENT'], "Firefox") !== false) { print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Firefox integration') . "\">"; print "<p>" . __('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.') . "</p>"; print "<p>"; print "<button onclick='window.navigator.registerContentHandler(" . "\"application/vnd.mozilla.maybe.feed\", " . "\"" . add_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" . __('Click here to register this site as a feed reader.') . "</button>"; print "</p>"; print "</div>"; # pane } print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Subscribing using bookmarklet') . "\">"; 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>"; $bm_subscribe_url = str_replace('%s', '', add_feed_url()); $confirm_str = __('Subscribe to %s in Tiny Tiny RSS?'); $bm_url = htmlspecialchars("javascript:{if(confirm('{$confirm_str}'.replace('%s',window.location.href)))window.location.href='{$bm_subscribe_url}'+window.location.href}"); print "<a href=\"{$bm_url}\" class='bookmarklet'>" . __('Subscribe in Tiny Tiny RSS') . "</a>"; print "</div>"; #pane print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Published & shared articles and generated feeds') . "\">"; print "<h3>" . __("Published articles and generated feeds") . "</h3>"; print "<p>" . __('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.') . "</p>"; $rss_url = '-2::' . htmlspecialchars(get_self_url_prefix() . "/public.php?op=rss&id=-2&view-mode=all_articles"); print "<button dojoType=\"dijit.form.Button\" onclick=\"return displayDlg('generatedFeed', '{$rss_url}')\">" . __('Display URL') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return clearFeedAccessKeys()\">" . __('Clear all generated URLs') . "</button> "; print "<h3>" . __("Articles shared by URL") . "</h3>"; print "<p>" . __("You can disable all articles shared by unique URLs here.") . "</p>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return clearArticleAccessKeys()\">" . __('Unshare all articles') . "</button> "; print "</div>"; #pane if (defined('CONSUMER_KEY') && CONSUMER_KEY != '') { print "<div id=\"pref-feeds-twitter\" dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Twitter') . "\">"; $result = db_query($link, "SELECT COUNT(*) AS cid FROM ttrss_users\n\t\t\t\tWHERE twitter_oauth IS NOT NULL AND twitter_oauth != '' AND\n\t\t\t\tid = " . $_SESSION['uid']); $is_registered = db_fetch_result($result, 0, "cid") != 0; if (!$is_registered) { print_notice(__('Before you can update your Twitter feeds, you must register this instance of Tiny Tiny RSS with Twitter.com.')); } else { print_notice(__('You have been successfully registered with Twitter.com and should be able to access your Twitter feeds.')); } print "<button dojoType=\"dijit.form.Button\" onclick=\"window.location.href = 'twitter.php?op=register'\">" . __("Register with Twitter.com") . "</button>"; print " "; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return clearTwitterCredentials()\">" . __("Clear stored credentials") . "</button>"; print "</div>"; # pane } print "</div>"; #container }