function index() { print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">"; print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Error Log') . "\">"; if (LOG_DESTINATION == "sql") { $result = $this->dbh->query("SELECT errno, errstr, filename, lineno,\n\t\t\t\tcreated_at, login FROM ttrss_error_log\n\t\t\t\tLEFT JOIN ttrss_users ON (owner_uid = ttrss_users.id)\n\t\t\t\tORDER BY ttrss_error_log.id DESC\n\t\t\t\tLIMIT 100"); print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"updateSystemList()\">" . __('Refresh') . "</button> "; print " <button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"clearSqlLog()\">" . __('Clear log') . "</button> "; print "<p><table width=\"100%\" cellspacing=\"10\" class=\"prefErrorLog\">"; print "<tr class=\"title\">\n\t\t\t\t<td width='5%'>" . __("Error") . "</td>\n\t\t\t\t<td>" . __("Filename") . "</td>\n\t\t\t\t<td>" . __("Message") . "</td>\n\t\t\t\t<td width='5%'>" . __("User") . "</td>\n\t\t\t\t<td width='5%'>" . __("Date") . "</td>\n\t\t\t\t</tr>"; while ($line = $this->dbh->fetch_assoc($result)) { print "<tr class=\"errrow\">"; foreach ($line as $k => $v) { $line[$k] = htmlspecialchars($v); } print "<td class='errno'>" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")</td>"; print "<td class='filename'>" . $line["filename"] . ":" . $line["lineno"] . "</td>"; print "<td class='errstr'>" . $line["errstr"] . "</td>"; print "<td class='login'>" . $line["login"] . "</td>"; print "<td class='timestamp'>" . make_local_datetime($line["created_at"], false) . "</td>"; print "</tr>"; } print "</table>"; } else { print_notice("Please set LOG_DESTINATION to 'sql' in config.php to enable database logging."); } print "</div>"; PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefSystem"); print "</div>"; #container }
function catchall($method) { $plugin = PluginHost::getInstance()->get_plugin($_REQUEST["plugin"]); if ($plugin) { if (method_exists($plugin, $method)) { $plugin->{$method}(); } else { print error_json(13); } } else { print error_json(14); } }
function catchall($method) { $plugin = PluginHost::getInstance()->get_plugin($_REQUEST["plugin"]); if (!$plugin) { print json_encode(array("error" => "PLUGIN_NOT_FOUND")); return; } if (!method_exists($plugin, $method)) { print json_encode(array("error" => "METHOD_NOT_FOUND")); return; } $plugin->{$method}(); }
function index() { print "<div id=\"pref-label-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">"; print "<div id=\"pref-label-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">"; print "<div id=\"pref-label-toolbar\" dojoType=\"dijit.Toolbar\">"; print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Select') . "</span>"; print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; print "<div onclick=\"dijit.byId('labelTree').model.setAllChecked(true)\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('All') . "</div>"; print "<div onclick=\"dijit.byId('labelTree').model.setAllChecked(false)\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('None') . "</div>"; print "</div></div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return addLabel()\">" . __('Create label') . "</button dojoType=\"dijit.form.Button\"> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedLabels()\">" . __('Remove') . "</button dojoType=\"dijit.form.Button\"> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"labelColorReset()\">" . __('Clear colors') . "</button dojoType=\"dijit.form.Button\">"; print "</div>"; #toolbar print "</div>"; #pane print "<div id=\"pref-label-content\" dojoType=\"dijit.layout.ContentPane\" region=\"center\">"; print "<div id=\"labellistLoading\">\n\t\t<img src='images/indicator_tiny.gif'>" . __("Loading, please wait...") . "</div>"; print "<div dojoType=\"dojo.data.ItemFileWriteStore\" jsId=\"labelStore\"\n\t\t\turl=\"backend.php?op=pref-labels&method=getlabeltree\">\n\t\t</div>\n\t\t<div dojoType=\"lib.CheckBoxStoreModel\" jsId=\"labelModel\" store=\"labelStore\"\n\t\tquery=\"{id:'root'}\" rootId=\"root\"\n\t\t\tchildrenAttrs=\"items\" checkboxStrict=\"false\" checkboxAll=\"false\">\n\t\t</div>\n\t\t<div dojoType=\"fox.PrefLabelTree\" id=\"labelTree\"\n\t\t\tmodel=\"labelModel\" openOnClick=\"true\">\n\t\t<script type=\"dojo/method\" event=\"onLoad\" args=\"item\">\n\t\t\tElement.hide(\"labellistLoading\");\n\t\t</script>\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('LABEL:')) {\n\t\t\t\teditLabel(bare_id);\n\t\t\t}\n\t\t</script>\n\t\t</div>"; print "</div>"; #pane PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefLabels"); print "</div>"; #container }
static function api_get_headlines($feed_id, $limit, $offset, $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order, $include_attachments, $since_id, $search = "", $include_nested = false, $sanitize_content = true, $force_update = false, $excerpt_length = 100, $check_first_id = false) { if ($force_update && $feed_id > 0 && is_numeric($feed_id)) { // Update the feed if required with some basic flood control $result = db_query("SELECT cache_images," . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\t\tFROM ttrss_feeds WHERE id = '{$feed_id}'"); if (db_num_rows($result) != 0) { $last_updated = strtotime(db_fetch_result($result, 0, "last_updated")); $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images")); if (!$cache_images && time() - $last_updated > 120) { include "rssfuncs.php"; update_rss_feed($feed_id, true, true); } else { db_query("UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'\n\t\t\t\t\t\t\tWHERE id = '{$feed_id}'"); } } } /*$qfh_ret = queryFeedHeadlines($feed_id, $limit, $view_mode, $is_cat, $search, false, $order, $offset, 0, false, $since_id, $include_nested);*/ //function queryFeedHeadlines($feed, $limit, // $view_mode, $cat_view, $search, $search_mode, // $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, // $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false, $check_top_id = false) { $params = array("feed" => $feed_id, "limit" => $limit, "view_mode" => $view_mode, "cat_view" => $is_cat, "search" => $search, "override_order" => $order, "offset" => $offset, "since_id" => $since_id, "include_children" => $include_nested, "check_first_id" => $check_first_id, "api_request" => true); $qfh_ret = queryFeedHeadlines($params); $result = $qfh_ret[0]; $feed_title = $qfh_ret[1]; $first_id = $qfh_ret[6]; $headlines = array(); $headlines_header = array('id' => $feed_id, 'first_id' => $first_id, 'is_cat' => $is_cat); if (!is_numeric($result)) { while ($line = db_fetch_assoc($result)) { $line["content_preview"] = truncate_string(strip_tags($line["content"]), $excerpt_length); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { $line = $p->hook_query_headlines($line, $excerpt_length, true); } $is_updated = $line["last_read"] == "" && ($line["unread"] != "t" && $line["unread"] != "1"); $tags = explode(",", $line["tag_cache"]); $label_cache = $line["label_cache"]; $labels = false; if ($label_cache) { $label_cache = json_decode($label_cache, true); if ($label_cache) { if ($label_cache["no-labels"] == 1) { $labels = array(); } else { $labels = $label_cache; } } } if (!is_array($labels)) { $labels = get_article_labels($line["id"]); } //if (!$tags) $tags = get_article_tags($line["id"]); //if (!$labels) $labels = get_article_labels($line["id"]); $headline_row = array("id" => (int) $line["id"], "unread" => sql_bool_to_bool($line["unread"]), "marked" => sql_bool_to_bool($line["marked"]), "published" => sql_bool_to_bool($line["published"]), "updated" => (int) strtotime($line["updated"]), "is_updated" => $is_updated, "title" => $line["title"], "link" => $line["link"], "feed_id" => $line["feed_id"], "tags" => $tags); if ($include_attachments) { $headline_row['attachments'] = get_article_enclosures($line['id']); } if ($show_excerpt) { $headline_row["excerpt"] = $line["content_preview"]; } if ($show_content) { if ($sanitize_content) { $headline_row["content"] = sanitize($line["content"], sql_bool_to_bool($line['hide_images']), false, $line["site_url"], false, $line["id"]); } else { $headline_row["content"] = $line["content"]; } } // unify label output to ease parsing if ($labels["no-labels"] == 1) { $labels = array(); } $headline_row["labels"] = $labels; $headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : $feed_title; $headline_row["comments_count"] = (int) $line["num_comments"]; $headline_row["comments_link"] = $line["comments"]; $headline_row["always_display_attachments"] = sql_bool_to_bool($line["always_display_enclosures"]); $headline_row["author"] = $line["author"]; $headline_row["score"] = (int) $line["score"]; $headline_row["note"] = $line["note"]; $headline_row["lang"] = $line["lang"]; foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_API) as $p) { $headline_row = $p->hook_render_article_api(array("headline" => $headline_row)); } array_push($headlines, $headline_row); } } else { if (is_numeric($result) && $result == -1) { $headlines_header['first_id_changed'] = true; } } return array($headlines, $headlines_header); }
?> <div id="userConfigTab" dojoType="dijit.layout.ContentPane" href="backend.php?op=pref-users" title="<?php echo __('Users'); ?> "></div> <div id="systemConfigTab" dojoType="dijit.layout.ContentPane" href="backend.php?op=pref-system" title="<?php echo __('System'); ?> "></div> <?php } PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TABS, "hook_prefs_tabs", false); ?> </div> <div id="footer" dojoType="dijit.layout.ContentPane" region="bottom"> <a class="insensitive" target="_blank" href="http://tt-rss.org/"> Tiny Tiny RSS</a> <?php if (!defined('HIDE_VERSION')) { ?> v<?php echo VERSION; ?> <?php } ?>
function clearplugindata() { $name = $this->dbh->escape_string($_REQUEST["name"]); PluginHost::getInstance()->clear_data(PluginHost::getInstance()->get_plugin($name)); }
function housekeeping_common($debug) { expire_cached_files($debug); expire_lock_files($debug); expire_error_log($debug); $count = update_feedbrowser_cache(); _debug("Feedbrowser updated, {$count} feeds processed."); purge_orphans(true); $rc = cleanup_tags(14, 50000); _debug("Cleaned {$rc} cached tags."); PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING, "hook_house_keeping", ""); }
function index() { $pluginhost = PluginHost::getInstance(); $json_conf = $pluginhost->get($this, 'json_conf'); $showInfoEnabled = $pluginhost->get($this, 'af_fullpost_showinfo'); if ($showInfoEnabled) { $fullPostChecked = "checked=\"1\""; } else { $fullPostChecked = ""; } print "<p>Comma-separated list or one address per lin of webaddresses, for which you don't would fetch the full post.<br>Example: site1.com, site2.org, site3.de</p>"; print "<form dojoType=\"dijit.form.Form\">"; print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\t\tevt.preventDefault();\n\t\t\tif (this.validate()) {\n\t\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\t\tif (transport.responseText.indexOf('error')>=0) notify_error(transport.responseText);\n\t\t\t\t\t\telse notify_info(transport.responseText);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t//this.reset();\n\t\t\t}\n\t\t\t</script>"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"af_fullpost\">"; print "<table width='100%'><tr><td>"; print "Show processed by Readability info on article bottom: <input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"af_fullpost_showinfo\" id=\"af_fullpost_showinfo\" {$fullPostChecked}>"; print "</tr></td>"; print "<tr><td>"; print "<textarea dojoType=\"dijit.form.SimpleTextarea\" name=\"json_conf\" style=\"font-size: 12px; width: 99%; height: 500px;\">{$json_conf}</textarea>"; print "</td></tr></table>"; print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Save") . "</button>"; print "</form>"; }
function newaction() { $action = json_decode($_REQUEST["action"], true); if ($action) { $action_param = $this->dbh->escape_string($action["action_param"]); $action_id = (int) $action["action_id"]; } else { $action_param = ""; $action_id = 0; } print "<form name='filter_new_action_form' id='filter_new_action_form'>"; 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 = $this->dbh->query("SELECT id,description FROM ttrss_filter_actions\n\t\t\tORDER BY name"); while ($line = $this->dbh->fetch_assoc($result)) { $is_selected = $line["id"] == $action_id ? "selected='1'" : ""; printf("<option {$is_selected} value='%d'>%s</option>", $line["id"], __($line["description"])); } print "</select>"; $param_box_hidden = $action_id == 7 || $action_id == 4 || $action_id == 6 || $action_id == 9 ? "" : "display : none"; $param_hidden = $action_id == 4 || $action_id == 6 ? "" : "display : none"; $label_param_hidden = $action_id == 7 ? "" : "display : none"; $plugin_param_hidden = $action_id == 9 ? "" : "display : none"; print "<span id=\"filterDlg_paramBox\" style=\"{$param_box_hidden}\">"; print " "; //print " " . __("with parameters:") . " "; print "<input dojoType=\"dijit.form.TextBox\"\n\t\t\tid=\"filterDlg_actionParam\" style=\"{$param_hidden}\"\n\t\t\tname=\"action_param\" value=\"{$action_param}\">"; print_label_select("action_param_label", $action_param, "id=\"filterDlg_actionParamLabel\" style=\"{$label_param_hidden}\"\n\t\t\tdojoType=\"dijit.form.Select\""); $filter_actions = PluginHost::getInstance()->get_filter_actions(); $filter_action_hash = array(); foreach ($filter_actions as $fclass => $factions) { foreach ($factions as $faction) { $filter_action_hash[$fclass . ":" . $faction["action"]] = $fclass . ": " . $faction["description"]; } } if (count($filter_action_hash) == 0) { $filter_plugin_disabled = "disabled"; $filter_action_hash["no-data"] = __("No actions available"); } else { $filter_plugin_disabled = ""; } print_select_hash("filterDlg_actionParamPlugin", $action_param, $filter_action_hash, "style=\"{$plugin_param_hidden}\" dojoType=\"dijit.form.Select\" {$filter_plugin_disabled}", "action_param_plugin"); print "</span>"; print " "; // tiny layout hack print "</div>"; print "<div class=\"dlgButtons\">"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterNewActionDlg').execute()\">" . ($action ? __("Save action") : __('Add action')) . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterNewActionDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; print "</form>"; }
function globalUpdateFeeds() { RPC::updaterandomfeed_real($this->dbh); PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", false); }
function index() { $pluginhost = PluginHost::getInstance(); $json_conf = $pluginhost->get($this, 'json_conf'); $test_conf = $pluginhost->get($this, 'test_conf'); print Feediron_PrefTab::get_pref_tab($json_conf, $test_conf); }
private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view, $next_unread_feed, $offset, $vgr_last_feed = false, $override_order = false, $include_children = false) { if (isset($_REQUEST["DevForceUpdate"])) { header("Content-Type: text/plain"); } $disable_cache = false; $reply = array(); $rgba_cache = array(); $timing_info = microtime(true); $topmost_article_ids = array(); if (!$offset) { $offset = 0; } if ($method == "undefined") { $method = ""; } $method_split = explode(":", $method); if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) { // Update the feed if required with some basic flood control $result = $this->dbh->query("SELECT cache_images," . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\tFROM ttrss_feeds WHERE id = '{$feed}'"); if ($this->dbh->num_rows($result) != 0) { $last_updated = strtotime($this->dbh->fetch_result($result, 0, "last_updated")); $cache_images = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "cache_images")); if (!$cache_images && time() - $last_updated > 120 || isset($_REQUEST['DevForceUpdate'])) { include "rssfuncs.php"; update_rss_feed($feed, true, true); } else { $this->dbh->query("UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'\n\t\t\t\t\t\t\tWHERE id = '{$feed}'"); } } } if ($method_split[0] == "MarkAllReadGR") { catchup_feed($method_split[1], false); } // FIXME: might break tag display? if (is_numeric($feed) && $feed > 0 && !$cat_view) { $result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE id = '{$feed}' LIMIT 1"); if ($this->dbh->num_rows($result) == 0) { $reply['content'] = "<div align='center'>" . __('Feed not found.') . "</div>"; } } @($search = $this->dbh->escape_string($_REQUEST["query"])); if ($search) { $disable_cache = true; } @($search_mode = $this->dbh->escape_string($_REQUEST["search_mode"])); if ($_REQUEST["debug"]) { $timing_info = print_checkpoint("H0", $timing_info); } // error_log("format_headlines_list: [" . $feed . "] method [" . $method . "]"); if ($search_mode == '' && $method != '') { $search_mode = $method; } // error_log("search_mode: " . $search_mode); if (!$cat_view && is_numeric($feed) && $feed < PLUGIN_FEED_BASE_INDEX && $feed > LABEL_BASE_INDEX) { $handler = PluginHost::getInstance()->get_feed_handler(PluginHost::feed_to_pfeed_id($feed)); // function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false) { if ($handler) { $options = array("limit" => $limit, "view_mode" => $view_mode, "cat_view" => $cat_view, "search" => $search, "search_mode" => $search_mode, "override_order" => $override_order, "offset" => $offset, "owner_uid" => $_SESSION["uid"], "filter" => false, "since_id" => 0, "include_children" => $include_children); $qfh_ret = $handler->get_headlines(PluginHost::feed_to_pfeed_id($feed), $options); } } else { $qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order, $offset, 0, false, 0, $include_children); } if ($_REQUEST["debug"]) { $timing_info = print_checkpoint("H1", $timing_info); } $result = $qfh_ret[0]; $feed_title = $qfh_ret[1]; $feed_site_url = $qfh_ret[2]; $last_error = $qfh_ret[3]; $last_updated = strpos($qfh_ret[4], '1970-') === FALSE ? make_local_datetime($qfh_ret[4], false) : __("Never"); $vgroup_last_feed = $vgr_last_feed; $reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url, $feed_title, $feed, $cat_view, $search, $search_mode, $view_mode, $last_error, $last_updated); $headlines_count = $this->dbh->num_rows($result); /* if (get_pref('COMBINED_DISPLAY_MODE')) { $button_plugins = array(); foreach (explode(",", ARTICLE_BUTTON_PLUGINS) as $p) { $pclass = "button_" . trim($p); if (class_exists($pclass)) { $plugin = new $pclass(); array_push($button_plugins, $plugin); } } } */ if ($this->dbh->num_rows($result) > 0) { $lnum = $offset; $num_unread = 0; $cur_feed_title = ''; $fresh_intl = get_pref("FRESH_ARTICLE_MAX_AGE") * 60 * 60; if ($_REQUEST["debug"]) { $timing_info = print_checkpoint("PS", $timing_info); } $expand_cdm = get_pref('CDM_EXPANDED'); while ($line = $this->dbh->fetch_assoc($result)) { $line["content_preview"] = "— " . truncate_string(strip_tags($line["content_preview"]), 250); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { $line = $p->hook_query_headlines($line, 250, false); } if (get_pref('SHOW_CONTENT_PREVIEW')) { $content_preview = $line["content_preview"]; } $id = $line["id"]; $feed_id = $line["feed_id"]; $label_cache = $line["label_cache"]; $labels = false; if ($label_cache) { $label_cache = json_decode($label_cache, true); if ($label_cache) { if ($label_cache["no-labels"] == 1) { $labels = array(); } else { $labels = $label_cache; } } } if (!is_array($labels)) { $labels = get_article_labels($id); } $labels_str = "<span class=\"HLLCTR-{$id}\">"; $labels_str .= format_article_labels($labels, $id); $labels_str .= "</span>"; if (count($topmost_article_ids) < 3) { array_push($topmost_article_ids, $id); } $class = ""; if (sql_bool_to_bool($line["unread"])) { $class .= " Unread"; ++$num_unread; } if (sql_bool_to_bool($line["marked"])) { $marked_pic = "<img\n\t\t\t\t\t\tsrc=\"images/mark_set.png\"\n\t\t\t\t\t\tclass=\"markedPic\" alt=\"Unstar article\"\n\t\t\t\t\t\tonclick='toggleMark({$id})'>"; $class .= " marked"; } else { $marked_pic = "<img\n\t\t\t\t\t\tsrc=\"images/mark_unset.png\"\n\t\t\t\t\t\tclass=\"markedPic\" alt=\"Star article\"\n\t\t\t\t\t\tonclick='toggleMark({$id})'>"; } if (sql_bool_to_bool($line["published"])) { $published_pic = "<img src=\"images/pub_set.png\"\n\t\t\t\t\t\tclass=\"pubPic\"\n\t\t\t\t\t\t\talt=\"Unpublish article\" onclick='togglePub({$id})'>"; $class .= " published"; } else { $published_pic = "<img src=\"images/pub_unset.png\"\n\t\t\t\t\t\tclass=\"pubPic\"\n\t\t\t\t\t\talt=\"Publish article\" onclick='togglePub({$id})'>"; } # $content_link = "<a target=\"_blank\" href=\"".$line["link"]."\">" . # $line["title"] . "</a>"; # $content_link = "<a # href=\"" . htmlspecialchars($line["link"]) . "\" # onclick=\"view($id,$feed_id);\">" . # $line["title"] . "</a>"; # $content_link = "<a href=\"javascript:viewContentUrl('".$line["link"]."');\">" . # $line["title"] . "</a>"; $updated_fmt = make_local_datetime($line["updated"], false); $date_entered_fmt = T_sprintf("Imported at %s", make_local_datetime($line["date_entered"], false)); $score = $line["score"]; $score_pic = "images/" . get_score_pic($score); /* $score_title = __("(Click to change)"); $score_pic = "<img class='hlScorePic' src=\"images/$score_pic\" onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">"; */ $score_pic = "<img class='hlScorePic' score='{$score}' onclick='changeScore({$id}, this)' src=\"{$score_pic}\"\n\t\t\t\t\ttitle=\"{$score}\">"; if ($score > 500) { $hlc_suffix = "high"; } else { if ($score < -100) { $hlc_suffix = "low"; } else { $hlc_suffix = ""; } } $entry_author = $line["author"]; if ($entry_author) { $entry_author = " — {$entry_author}"; } $has_feed_icon = feed_has_icon($feed_id); if ($has_feed_icon) { $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . "/{$feed_id}.ico\" alt=\"\">"; } else { $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/pub_set.png\" alt=\"\">"; } $entry_site_url = $line["site_url"]; //setting feed headline background color, needs to change text color based on dark/light $fav_color = $line['favicon_avg_color']; require_once "colors.php"; if ($fav_color && $fav_color != 'fail') { if (!isset($rgba_cache[$feed_id])) { $rgba_cache[$feed_id] = join(",", _color_unpack($fav_color)); } } if (!get_pref('COMBINED_DISPLAY_MODE')) { if (get_pref('VFEED_GROUP_BY_FEED')) { if ($feed_id != $vgroup_last_feed && $line["feed_title"]) { $cur_feed_title = $line["feed_title"]; $vgroup_last_feed = $feed_id; $cur_feed_title = htmlspecialchars($cur_feed_title); $vf_catchup_link = "(<a class='catchup' onclick='catchupFeedInGroup({$feed_id});' href='#'>" . __('Mark as read') . "</a>)"; $reply['content'] .= "<div class='cdmFeedTitle'>" . "<div style=\"float : right\">{$feed_icon_img}</div>" . "<a class='title' href=\"#\" onclick=\"viewfeed({$feed_id})\">" . $line["feed_title"] . "</a> {$vf_catchup_link}</div>"; } } $mouseover_attrs = "onmouseover='postMouseIn(event, {$id})'\n\t\t\t\t\t\tonmouseout='postMouseOut({$id})'"; $reply['content'] .= "<div class='hl {$class}' id='RROW-{$id}' {$mouseover_attrs}>"; $reply['content'] .= "<div class='hlLeft'>"; $reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\t\t\ttype=\"checkbox\" onclick=\"toggleSelectRow2(this)\"\n\t\t\t\t\t\t\tclass='rchk'>"; $reply['content'] .= "{$marked_pic}"; $reply['content'] .= "{$published_pic}"; $reply['content'] .= "</div>"; $reply['content'] .= "<div onclick='return hlClicked(event, {$id})'\n\t\t\t\t\t\tclass=\"hlTitle\"><span class='hlContent {$hlc_suffix}'>"; $reply['content'] .= "<a id=\"RTITLE-{$id}\" class=\"title {$hlc_suffix}\"\n\t\t\t\t\t\thref=\"" . htmlspecialchars($line["link"]) . "\"\n\t\t\t\t\t\tonclick=\"\">" . truncate_string($line["title"], 200); if (get_pref('SHOW_CONTENT_PREVIEW')) { $reply['content'] .= "<span class=\"contentPreview\">" . $line["content_preview"] . "</span>"; } $reply['content'] .= "</a></span>"; $reply['content'] .= $labels_str; $reply['content'] .= "</div>"; $reply['content'] .= "<span class=\"hlUpdated\">"; if (!get_pref('VFEED_GROUP_BY_FEED')) { if (@$line["feed_title"]) { $rgba = @$rgba_cache[$feed_id]; $reply['content'] .= "<a class=\"hlFeed\" style=\"background : rgba({$rgba}, 0.3)\" href=\"#\" onclick=\"viewfeed({$feed_id})\">" . truncate_string($line["feed_title"], 30) . "</a>"; } } $reply['content'] .= "<div title='{$date_entered_fmt}'>{$updated_fmt}</div>\n\t\t\t\t\t\t</span>"; $reply['content'] .= "<div class=\"hlRight\">"; $reply['content'] .= $score_pic; if ($line["feed_title"] && !get_pref('VFEED_GROUP_BY_FEED')) { $reply['content'] .= "<span onclick=\"viewfeed({$feed_id})\"\n\t\t\t\t\t\t\tstyle=\"cursor : pointer\"\n\t\t\t\t\t\t\ttitle=\"" . htmlspecialchars($line['feed_title']) . "\">\n\t\t\t\t\t\t\t{$feed_icon_img}<span>"; } $reply['content'] .= "</div>"; $reply['content'] .= "</div>"; } else { if ($line["tag_cache"]) { $tags = explode(",", $line["tag_cache"]); } else { $tags = false; } $line["content"] = sanitize($line["content"], sql_bool_to_bool($line['hide_images']), false, $entry_site_url); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) { $line = $p->hook_render_article_cdm($line); } if (get_pref('VFEED_GROUP_BY_FEED') && $line["feed_title"]) { if ($feed_id != $vgroup_last_feed) { $cur_feed_title = $line["feed_title"]; $vgroup_last_feed = $feed_id; $cur_feed_title = htmlspecialchars($cur_feed_title); $vf_catchup_link = "(<a class='catchup' onclick='javascript:catchupFeedInGroup({$feed_id});' href='#'>" . __('mark as read') . "</a>)"; $has_feed_icon = feed_has_icon($feed_id); if ($has_feed_icon) { $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . "/{$feed_id}.ico\" alt=\"\">"; } else { //$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\" alt=\"\">"; } $reply['content'] .= "<div class='cdmFeedTitle'>" . "<div style=\"float : right\">{$feed_icon_img}</div>" . "<a href=\"#\" class='title' onclick=\"viewfeed({$feed_id})\">" . $line["feed_title"] . "</a> {$vf_catchup_link}</div>"; } } $mouseover_attrs = "onmouseover='postMouseIn(event, {$id})'\n\t\t\t\t\t\tonmouseout='postMouseOut({$id})'"; $expanded_class = $expand_cdm ? "expanded" : "expandable"; $reply['content'] .= "<div class=\"cdm {$hlc_suffix} {$expanded_class} {$class}\"\n\t\t\t\t\t\tid=\"RROW-{$id}\" {$mouseover_attrs}>"; $reply['content'] .= "<div class=\"cdmHeader\" style=\"{$row_background}\">"; $reply['content'] .= "<div style=\"vertical-align : middle\">"; $reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\t\t\ttype=\"checkbox\" onclick=\"toggleSelectRow2(this, false, true)\"\n\t\t\t\t\t\t\tclass='rchk'>"; $reply['content'] .= "{$marked_pic}"; $reply['content'] .= "{$published_pic}"; $reply['content'] .= "</div>"; $reply['content'] .= "<span id=\"RTITLE-{$id}\"\n\t\t\t\t\t\tonclick=\"return cdmClicked(event, {$id});\"\n\t\t\t\t\t\tclass=\"titleWrap {$hlc_suffix}\">\n\t\t\t\t\t\t<a class=\"title {$hlc_suffix}\"\n\t\t\t\t\t\ttarget=\"_blank\" href=\"" . htmlspecialchars($line["link"]) . "\">" . $line["title"] . "</a> <span class=\"author\">{$entry_author}</span>"; $reply['content'] .= $labels_str; $reply['content'] .= "<span class='collapseBtn' style='display : none'>\n\t\t\t\t\t\t<img src=\"images/collapse.png\" onclick=\"cdmCollapseArticle(event, {$id})\"\n\t\t\t\t\t\ttitle=\"" . __("Collapse article") . "\"/></span>"; if (!$expand_cdm) { $content_hidden = "style=\"display : none\""; } else { $excerpt_hidden = "style=\"display : none\""; } $reply['content'] .= "<span {$excerpt_hidden} id=\"CEXC-{$id}\" class=\"cdmExcerpt\">" . $content_preview . "</span>"; $reply['content'] .= "</span>"; if (!get_pref('VFEED_GROUP_BY_FEED')) { if (@$line["feed_title"]) { $rgba = @$rgba_cache[$feed_id]; $reply['content'] .= "<div class=\"hlFeed\">\n\t\t\t\t\t\t\t\t<a href=\"#\" style=\"background-color: rgba({$rgba},0.3)\"\n\t\t\t\t\t\t\t\tonclick=\"viewfeed({$feed_id})\">" . truncate_string($line["feed_title"], 30) . "</a>\n\t\t\t\t\t\t\t</div>"; } } $reply['content'] .= "<span class='updated' title='{$date_entered_fmt}'>\n\t\t\t\t\t\t{$updated_fmt}</span>"; $reply['content'] .= "<div class='scoreWrap' style=\"vertical-align : middle\">"; $reply['content'] .= "{$score_pic}"; if (!get_pref("VFEED_GROUP_BY_FEED") && $line["feed_title"]) { $reply['content'] .= "<span style=\"cursor : pointer\"\n\t\t\t\t\t\t\ttitle=\"" . htmlspecialchars($line["feed_title"]) . "\"\n\t\t\t\t\t\t\tonclick=\"viewfeed({$feed_id})\">{$feed_icon_img}</span>"; } $reply['content'] .= "</div>"; $reply['content'] .= "</div>"; $reply['content'] .= "<div class=\"cdmContent\" {$content_hidden}\n\t\t\t\t\t\tonclick=\"return cdmClicked(event, {$id});\"\n\t\t\t\t\t\tid=\"CICD-{$id}\">"; $reply['content'] .= "<div id=\"POSTNOTE-{$id}\">"; if ($line['note']) { $reply['content'] .= format_article_note($id, $line['note']); } $reply['content'] .= "</div>"; $reply['content'] .= "<div class=\"cdmContentInner\">"; if ($line["orig_feed_id"]) { $tmp_result = $this->dbh->query("SELECT * FROM ttrss_archived_feeds\n\t\t\t\t\tWHERE id = " . $line["orig_feed_id"]); if ($this->dbh->num_rows($tmp_result) != 0) { $reply['content'] .= "<div clear='both'>"; $reply['content'] .= __("Originally from:"); $reply['content'] .= " "; $tmp_line = $this->dbh->fetch_assoc($tmp_result); $reply['content'] .= "<a target='_blank'\n\t\t\t\t\t\t\t\thref=' " . htmlspecialchars($tmp_line['site_url']) . "'>" . $tmp_line['title'] . "</a>"; $reply['content'] .= " "; $reply['content'] .= "<a target='_blank' href='" . htmlspecialchars($tmp_line['feed_url']) . "'>"; $reply['content'] .= "<img title='" . __('Feed URL') . "'class='tinyFeedIcon' src='images/pub_unset.png'></a>"; $reply['content'] .= "</div>"; } } $reply['content'] .= "<span id=\"CWRAP-{$id}\">"; // if (!$expand_cdm) { $reply['content'] .= "<span id=\"CENCW-{$id}\" style=\"display : none\">"; $reply['content'] .= htmlspecialchars($line["content"]); $reply['content'] .= "</span."; // } else { // $reply['content'] .= $line["content"]; // } $reply['content'] .= "</span>"; $always_display_enclosures = sql_bool_to_bool($line["always_display_enclosures"]); $reply['content'] .= format_article_enclosures($id, $always_display_enclosures, $line["content"], sql_bool_to_bool($line["hide_images"])); $reply['content'] .= "</div>"; $reply['content'] .= "<div class=\"cdmFooter\">"; foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { $reply['content'] .= $p->hook_article_left_button($line); } $tags_str = format_tags_string($tags, $id); $reply['content'] .= "<img src='images/tag.png' alt='Tags' title='Tags'>\n\t\t\t\t\t\t<span id=\"ATSTR-{$id}\">{$tags_str}</span>\n\t\t\t\t\t\t<a title=\"" . __('Edit tags for this article') . "\"\n\t\t\t\t\t\thref=\"#\" onclick=\"editArticleTags({$id})\">(+)</a>"; $num_comments = $line["num_comments"]; $entry_comments = ""; if ($num_comments > 0) { if ($line["comments"]) { $comments_url = htmlspecialchars($line["comments"]); } else { $comments_url = htmlspecialchars($line["link"]); } $entry_comments = "<a target='_blank' href=\"{$comments_url}\">{$num_comments} comments</a>"; } else { if ($line["comments"] && $line["link"] != $line["comments"]) { $entry_comments = "<a target='_blank' href=\"" . htmlspecialchars($line["comments"]) . "\">comments</a>"; } } if ($entry_comments) { $reply['content'] .= " ({$entry_comments})"; } $reply['content'] .= "<div style=\"float : right\">"; // $reply['content'] .= "$marked_pic"; // $reply['content'] .= "$published_pic"; foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) { $reply['content'] .= $p->hook_article_button($line); } $reply['content'] .= "</div>"; $reply['content'] .= "</div>"; $reply['content'] .= "</div><hr/>"; $reply['content'] .= "</div>"; } ++$lnum; } if ($_REQUEST["debug"]) { $timing_info = print_checkpoint("PE", $timing_info); } } else { $message = ""; switch ($view_mode) { case "unread": $message = __("No unread articles found to display."); break; case "updated": $message = __("No updated articles found to display."); break; case "marked": $message = __("No starred articles found to display."); break; default: if ($feed < LABEL_BASE_INDEX) { $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter."); } else { $message = __("No articles found to display."); } } if (!$offset && $message) { $reply['content'] .= "<div class='whiteBox'>{$message}"; $reply['content'] .= "<p><span class=\"insensitive\">"; $result = $this->dbh->query("SELECT " . SUBSTRING_FOR_DATE . "(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds\n\t\t\t\t\tWHERE owner_uid = " . $_SESSION['uid']); $last_updated = $this->dbh->fetch_result($result, 0, "last_updated"); $last_updated = make_local_datetime($last_updated, false); $reply['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated); $result = $this->dbh->query("SELECT COUNT(id) AS num_errors\n\t\t\t\t\tFROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION["uid"]); $num_errors = $this->dbh->fetch_result($result, 0, "num_errors"); if ($num_errors > 0) { $reply['content'] .= "<br/>"; $reply['content'] .= "<a class=\"insensitive\" href=\"#\" onclick=\"showFeedsWithErrors()\">" . __('Some feeds have update errors (click for details)') . "</a>"; } $reply['content'] .= "</span></p></div>"; } } if ($_REQUEST["debug"]) { $timing_info = print_checkpoint("H2", $timing_info); } return array($topmost_article_ids, $headlines_count, $feed, $disable_cache, $vgroup_last_feed, $reply); }
static function api_get_headlines($feed_id, $limit, $offset, $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order, $include_attachments, $since_id, $search = "", $search_mode = "", $include_nested = false, $sanitize_content = true) { $qfh_ret = queryFeedHeadlines($feed_id, $limit, $view_mode, $is_cat, $search, $search_mode, $order, $offset, 0, false, $since_id, $include_nested); $result = $qfh_ret[0]; $feed_title = $qfh_ret[1]; $headlines = array(); while ($line = db_fetch_assoc($result)) { $line["content_preview"] = truncate_string(strip_tags($line["content"]), 100); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { $line = $p->hook_query_headlines($line, 100, true); } $is_updated = $line["last_read"] == "" && ($line["unread"] != "t" && $line["unread"] != "1"); $tags = explode(",", $line["tag_cache"]); $labels = json_decode($line["label_cache"], true); //if (!$tags) $tags = get_article_tags($line["id"]); //if (!$labels) $labels = get_article_labels($line["id"]); $headline_row = array("id" => (int) $line["id"], "unread" => sql_bool_to_bool($line["unread"]), "marked" => sql_bool_to_bool($line["marked"]), "published" => sql_bool_to_bool($line["published"]), "updated" => (int) strtotime($line["updated"]), "is_updated" => $is_updated, "title" => $line["title"], "link" => $line["link"], "feed_id" => $line["feed_id"], "tags" => $tags); if ($include_attachments) { $headline_row['attachments'] = get_article_enclosures($line['id']); } if ($show_excerpt) { $headline_row["excerpt"] = $line["content_preview"]; } if ($show_content) { if ($sanitize_content) { $headline_row["content"] = sanitize($line["content"], sql_bool_to_bool($line['hide_images']), false, $line["site_url"], false, $line["id"]); } else { $headline_row["content"] = $line["content"]; } } // unify label output to ease parsing if ($labels["no-labels"] == 1) { $labels = array(); } $headline_row["labels"] = $labels; $headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : $feed_title; $headline_row["comments_count"] = (int) $line["num_comments"]; $headline_row["comments_link"] = $line["comments"]; $headline_row["always_display_attachments"] = sql_bool_to_bool($line["always_display_enclosures"]); $headline_row["author"] = $line["author"]; $headline_row["score"] = (int) $line["score"]; $headline_row["note"] = $line["note"]; $headline_row["lang"] = $line["lang"]; foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_API) as $p) { $headline_row = $p->hook_render_article_api(array("headline" => $headline_row)); } array_push($headlines, $headline_row); } return $headlines; }
function init_plugins() { PluginHost::getInstance()->load(PLUGINS, PluginHost::KIND_ALL); return true; }
authenticate_user("admin", null); } if ($_SESSION["uid"]) { if (!validate_session()) { header("Content-Type: text/json"); print error_json(6); return; } load_user_plugins($_SESSION["uid"]); } $purge_intervals = array(0 => __("Use default"), -1 => __("Never purge"), 5 => __("1 week old"), 14 => __("2 weeks old"), 31 => __("1 month old"), 60 => __("2 months old"), 90 => __("3 months old")); $update_intervals = array(0 => __("Default interval"), -1 => __("Disable updates"), 15 => __("Each 15 minutes"), 30 => __("Each 30 minutes"), 60 => __("Hourly"), 240 => __("Each 4 hours"), 720 => __("Each 12 hours"), 1440 => __("Daily"), 10080 => __("Weekly")); $update_intervals_nodefault = array(-1 => __("Disable updates"), 15 => __("Each 15 minutes"), 30 => __("Each 30 minutes"), 60 => __("Hourly"), 240 => __("Each 4 hours"), 720 => __("Each 12 hours"), 1440 => __("Daily"), 10080 => __("Weekly")); $access_level_names = array(0 => __("User"), 5 => __("Power User"), 10 => __("Administrator")); $op = str_replace("-", "_", $op); $override = PluginHost::getInstance()->lookup_handler($op, $method); if (class_exists($op) || $override) { if ($override) { $handler = $override; } else { $handler = new $op($_REQUEST); } if ($handler && implements_interface($handler, 'IHandler')) { if (validate_csrf($csrf_token) || $handler->csrf_ignore($method)) { if ($handler->before($method)) { if ($method && method_exists($handler, $method)) { $handler->{$method}(); } else { if (method_exists($handler, "catchall")) { $handler->catchall($method); }
require_once "sessions.php"; require_once "functions.php"; require_once "sanity_check.php"; require_once "config.php"; require_once "db.php"; require_once "db-prefs.php"; startup_gettext(); $script_started = microtime(true); if (!init_plugins()) { return; } if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) { ob_start("ob_gzhandler"); } $method = $_REQUEST["op"]; $override = PluginHost::getInstance()->lookup_handler("public", $method); if ($override) { $handler = $override; } else { $handler = new Handler_Public($_REQUEST); } if (implements_interface($handler, "IHandler") && $handler->before($method)) { if ($method && method_exists($handler, $method)) { $handler->{$method}(); } else { if (method_exists($handler, 'index')) { $handler->index(); } } $handler->after(); return;
function index() { $sort = $this->dbh->escape_string($_REQUEST["sort"]); if (!$sort || $sort == "undefined") { $sort = "reg_exp"; } $filter_search = $this->dbh->escape_string($_REQUEST["search"]); if (array_key_exists("search", $_REQUEST)) { $_SESSION["prefs_filter_search"] = $filter_search; } else { $filter_search = $_SESSION["prefs_filter_search"]; } print "<div id=\"pref-filter-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">"; print "<div id=\"pref-filter-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">"; print "<div id=\"pref-filter-toolbar\" dojoType=\"dijit.Toolbar\">"; $filter_search = $this->dbh->escape_string($_REQUEST["search"]); if (array_key_exists("search", $_REQUEST)) { $_SESSION["prefs_filter_search"] = $filter_search; } else { $filter_search = $_SESSION["prefs_filter_search"]; } print "<div style='float : right; padding-right : 4px;'>\n\t\t\t<input dojoType=\"dijit.form.TextBox\" id=\"filter_search\" size=\"20\" type=\"search\"\n\t\t\t\tvalue=\"{$filter_search}\">\n\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"updateFilterList()\">" . __('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('filterTree').model.setAllChecked(true)\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('All') . "</div>"; print "<div onclick=\"dijit.byId('filterTree').model.setAllChecked(false)\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('None') . "</div>"; print "</div></div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return quickAddFilter()\">" . __('Create filter') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return joinSelectedFilters()\">" . __('Combine') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return editSelectedFilter()\">" . __('Edit') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return resetFilterOrder()\">" . __('Reset sort order') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return removeSelectedFilters()\">" . __('Remove') . "</button> "; if (defined('_ENABLE_FEED_DEBUGGING')) { print "<button dojoType=\"dijit.form.Button\" onclick=\"rescore_all_feeds()\">" . __('Rescore articles') . "</button> "; } print "</div>"; # toolbar print "</div>"; # toolbar-frame print "<div id=\"pref-filter-content\" dojoType=\"dijit.layout.ContentPane\" region=\"center\">"; print "<div id=\"filterlistLoading\">\n\t\t<img src='images/indicator_tiny.gif'>" . __("Loading, please wait...") . "</div>"; print "<div dojoType=\"fox.PrefFilterStore\" jsId=\"filterStore\"\n\t\t\turl=\"backend.php?op=pref-filters&method=getfiltertree\">\n\t\t</div>\n\t\t<div dojoType=\"lib.CheckBoxStoreModel\" jsId=\"filterModel\" store=\"filterStore\"\n\t\t\tquery=\"{id:'root'}\" rootId=\"root\" rootLabel=\"Filters\"\n\t\t\tchildrenAttrs=\"items\" checkboxStrict=\"false\" checkboxAll=\"false\">\n\t\t</div>\n\t\t<div dojoType=\"fox.PrefFilterTree\" id=\"filterTree\"\n\t\t\tdndController=\"dijit.tree.dndSource\"\n\t\t\tbetweenThreshold=\"5\"\n\t\t\tmodel=\"filterModel\" openOnClick=\"true\">\n\t\t<script type=\"dojo/method\" event=\"onLoad\" args=\"item\">\n\t\t\tElement.hide(\"filterlistLoading\");\n\t\t</script>\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('FILTER:')) {\n\t\t\t\teditFilter(bare_id);\n\t\t\t}\n\t\t</script>\n\n\t\t</div>"; print "</div>"; #pane PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefFilters"); print "</div>"; #container }
function format_article_enclosures($id, $always_display_enclosures, $article_content, $hide_images = false) { $result = get_article_enclosures($id); $rv = ''; foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FORMAT_ENCLOSURES) as $plugin) { $retval = $plugin->hook_format_enclosures($rv, $result, $id, $always_display_enclosures, $article_content, $hide_images); if (is_array($retval)) { $rv = $retval[0]; $result = $retval[1]; } else { $rv = $retval; } } if ($rv === '' && !empty($result)) { $entries_html = array(); $entries = array(); $entries_inline = array(); foreach ($result as $line) { $url = $line["content_url"]; $ctype = $line["content_type"]; $title = $line["title"]; $width = $line["width"]; $height = $line["height"]; if (!$ctype) { $ctype = __("unknown type"); } $filename = substr($url, strrpos($url, "/") + 1); $player = format_inline_player($url, $ctype); if ($player) { array_push($entries_inline, $player); } # $entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" . # $filename . " (" . $ctype . ")" . "</a>"; $entry = "<div onclick=\"window.open('" . htmlspecialchars($url) . "')\"\n\t\t\t\t\tdojoType=\"dijit.MenuItem\">{$filename} ({$ctype})</div>"; array_push($entries_html, $entry); $entry = array(); $entry["type"] = $ctype; $entry["filename"] = $filename; $entry["url"] = $url; $entry["title"] = $title; $entry["width"] = $width; $entry["height"] = $height; array_push($entries, $entry); } if ($_SESSION['uid'] && !get_pref("STRIP_IMAGES") && !$_SESSION["bw_limit"]) { if ($always_display_enclosures || !preg_match("/<img/i", $article_content)) { foreach ($entries as $entry) { if (preg_match("/image/", $entry["type"]) || preg_match("/\\.(jpg|png|gif|bmp)/i", $entry["filename"])) { if (!$hide_images) { $encsize = ''; if ($entry['height'] > 0) { $encsize .= ' height="' . intval($entry['width']) . '"'; } if ($entry['width'] > 0) { $encsize .= ' width="' . intval($entry['height']) . '"'; } $rv .= "<p><img\n\t\t\t\t\t\t\t\t\talt=\"" . htmlspecialchars($entry["filename"]) . "\"\n\t\t\t\t\t\t\t\t\tsrc=\"" . htmlspecialchars($entry["url"]) . "\"\n\t\t\t\t\t\t\t\t\t" . $encsize . " /></p>"; } else { $rv .= "<p><a target=\"_blank\"\n\t\t\t\t\t\t\t\t\thref=\"" . htmlspecialchars($entry["url"]) . "\"\n\t\t\t\t\t\t\t\t\t>" . htmlspecialchars($entry["url"]) . "</a></p>"; } if ($entry['title']) { $rv .= "<div class=\"enclosure_title\">{$entry['title']}</div>"; } } } } } if (count($entries_inline) > 0) { $rv .= "<hr clear='both'/>"; foreach ($entries_inline as $entry) { $rv .= $entry; } $rv .= "<hr clear='both'/>"; } $rv .= "<select class=\"attachments\" onchange=\"openSelectedAttachment(this)\">" . "<option value=''>" . __('Attachments') . "</option>"; foreach ($entries as $entry) { if ($entry["title"]) { $title = "— " . truncate_string($entry["title"], 30); } else { $title = ""; } $rv .= "<option value=\"" . htmlspecialchars($entry["url"]) . "\">" . htmlspecialchars($entry["filename"]) . "{$title}</option>"; } $rv .= "</select>"; } return $rv; }
function globalUpdateFeeds() { include "rssfuncs.php"; // Update all feeds needing a update. update_daemon_common(0, true, false); housekeeping_common(false); PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op); }
</div> <!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddLabel')"><?php echo __('Create label...'); ?> </div> <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFilter')"><?php echo __('Create filter...'); ?> </div> --> <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help'); ?> </div> <?php foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ACTION_ITEM) as $p) { echo $p->hook_action_item(); } ?> <?php if (!$_SESSION["hide_logout"]) { ?> <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcLogout')"><?php echo __('Logout'); ?> </div> <?php } ?> </div>
function search() { $this->params = explode(":", $this->dbh->escape_string($_REQUEST["param"]), 2); $active_feed_id = sprintf("%d", $this->params[0]); $is_cat = $this->params[1] != "false"; print "<div class=\"dlgSec\">" . __('Look for') . "</div>"; print "<div class=\"dlgSecCont\">"; print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\tstyle=\"font-size : 16px; width : 20em;\"\n\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<option value=\"all_feeds\">" . __('All feeds') . "</option>"; $feed_title = getFeedTitle($active_feed_id); if (!$is_cat) { $feed_cat_title = getFeedCatTitle($active_feed_id); } else { $feed_cat_title = getCategoryTitle($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('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 (count(PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH)) == 0) { print "<div style=\"float : left\">\n\t\t\t\t<a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/wiki/SearchSyntax\">" . __("Search syntax") . "</a>\n\t\t\t\t</div>"; } print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">" . __('Search') . "</button>\n\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">" . __('Cancel') . "</button>\n\t\t</div>"; }
function index() { if (!function_exists('curl_init')) { print "<div style='padding : 1em'>"; print_error("This functionality requires CURL functions. Please enable CURL in your PHP configuration (you might also want to disable open_basedir in php.ini) and reload this page."); print "</div>"; } print "<div id=\"pref-instance-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">"; print "<div id=\"pref-instance-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">"; print "<div id=\"pref-instance-toolbar\" dojoType=\"dijit.Toolbar\">"; $sort = db_escape_string($_REQUEST["sort"]); if (!$sort || $sort == "undefined") { $sort = "access_url"; } print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Select') . "</span>"; print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; print "<div onclick=\"selectTableRows('prefInstanceList', 'all')\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('All') . "</div>"; print "<div onclick=\"selectTableRows('prefInstanceList', 'none')\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('None') . "</div>"; print "</div></div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"addInstance()\">" . __('Link instance') . "</button>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"editSelectedInstance()\">" . __('Edit') . "</button>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedInstances()\">" . __('Remove') . "</button>"; print "</div>"; #toolbar $result = db_query("SELECT *,\n\t\t\t(SELECT COUNT(*) FROM ttrss_linked_feeds\n\t\t\t\tWHERE instance_id = ttrss_linked_instances.id) AS num_feeds\n\t\t\tFROM ttrss_linked_instances\n\t\t\tORDER BY {$sort}"); print "<p class=\"insensitive\" style='margin-left : 1em;'>" . __("You can connect other instances of Tiny Tiny RSS to this one to share Popular feeds. Link to this instance of Tiny Tiny RSS by using this URL:"); print " <a href=\"#\" onclick=\"alert('" . htmlspecialchars(get_self_url_prefix()) . "')\">(display url)</a>"; print "<p><table width='100%' id='prefInstanceList' class='prefInstanceList' cellspacing='0'>"; print "<tr class=\"title\">\n\t\t\t<td align='center' width=\"5%\"> </td>\n\t\t\t<td width=''><a href=\"#\" onclick=\"updateInstanceList('access_url')\">" . __('Instance URL') . "</a></td>\n\t\t\t<td width='20%'><a href=\"#\" onclick=\"updateInstanceList('access_key')\">" . __('Access key') . "</a></td>\n\t\t\t<td width='10%'><a href=\"#\" onclick=\"updateUsersList('last_connected')\">" . __('Last connected') . "</a></td>\n\t\t\t<td width='10%'><a href=\"#\" onclick=\"updateUsersList('last_status_out')\">" . __('Status') . "</a></td>\n\t\t\t<td width='10%'><a href=\"#\" onclick=\"updateUsersList('num_feeds')\">" . __('Stored feeds') . "</a></td>\n\t\t\t</tr>"; $lnum = 0; while ($line = db_fetch_assoc($result)) { $class = $lnum % 2 ? "even" : "odd"; $id = $line['id']; $this_row_id = "id=\"LIRR-{$id}\""; $line["last_connected"] = make_local_datetime($line["last_connected"], false); print "<tr class=\"{$class}\" {$this_row_id}>"; print "<td align='center'><input onclick='toggleSelectRow(this);'\n\t\t\t\ttype=\"checkbox\" id=\"LICHK-{$id}\"></td>"; $onclick = "onclick='editInstance({$id}, event)' title='" . __('Click to edit') . "'"; $access_key = mb_substr($line['access_key'], 0, 4) . '...' . mb_substr($line['access_key'], -4); print "<td {$onclick}>" . htmlspecialchars($line['access_url']) . "</td>"; print "<td {$onclick}>" . htmlspecialchars($access_key) . "</td>"; print "<td {$onclick}>" . htmlspecialchars($line['last_connected']) . "</td>"; print "<td {$onclick}>" . $this->status_codes[$line['last_status_out']] . "</td>"; print "<td {$onclick}>" . htmlspecialchars($line['num_feeds']) . "</td>"; print "</tr>"; ++$lnum; } print "</table>"; print "</div>"; #pane PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefInstances"); print "</div>"; #container }
function index() { global $access_level_names; print "<div id=\"pref-user-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">"; print "<div id=\"pref-user-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">"; print "<div id=\"pref-user-toolbar\" dojoType=\"dijit.Toolbar\">"; $user_search = $this->dbh->escape_string($_REQUEST["search"]); if (array_key_exists("search", $_REQUEST)) { $_SESSION["prefs_user_search"] = $user_search; } else { $user_search = $_SESSION["prefs_user_search"]; } print "<div style='float : right; padding-right : 4px;'>\n\t\t\t\t<input dojoType=\"dijit.form.TextBox\" id=\"user_search\" size=\"20\" type=\"search\"\n\t\t\t\t\tvalue=\"{$user_search}\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"updateUsersList()\">" . __('Search') . "</button>\n\t\t\t\t</div>"; $sort = $this->dbh->escape_string($_REQUEST["sort"]); if (!$sort || $sort == "undefined") { $sort = "login"; } print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Select') . "</span>"; print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; print "<div onclick=\"selectTableRows('prefUserList', 'all')\"\n\t\t\t\tdojoType=\"dijit.MenuItem\">" . __('All') . "</div>"; print "<div onclick=\"selectTableRows('prefUserList', 'none')\"\n\t\t\t\tdojoType=\"dijit.MenuItem\">" . __('None') . "</div>"; print "</div></div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"addUser()\">" . __('Create user') . "</button>"; print "\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"selectedUserDetails()\">" . __('Details') . "</button dojoType=\"dijit.form.Button\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"editSelectedUser()\">" . __('Edit') . "</button dojoType=\"dijit.form.Button\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedUsers()\">" . __('Remove') . "</button dojoType=\"dijit.form.Button\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"resetSelectedUserPass()\">" . __('Reset password') . "</button dojoType=\"dijit.form.Button\">"; PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "hook_prefs_tab_section", "prefUsersToolbar"); print "</div>"; #toolbar print "</div>"; #pane print "<div id=\"pref-user-content\" dojoType=\"dijit.layout.ContentPane\" region=\"center\">"; print "<div id=\"sticky-status-msg\"></div>"; if ($user_search) { $user_search = explode(" ", $user_search); $tokens = array(); foreach ($user_search as $token) { $token = trim($token); array_push($tokens, "(UPPER(login) LIKE UPPER('%{$token}%'))"); } $user_search_query = "(" . join($tokens, " AND ") . ") AND "; } else { $user_search_query = ""; } $result = $this->dbh->query("SELECT\n\t\t\t\t\tid,login,access_level,email,\n\t\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_login,1,16) as last_login,\n\t\t\t\t\t" . SUBSTRING_FOR_DATE . "(created,1,16) as created\n\t\t\t\tFROM\n\t\t\t\t\tttrss_users\n\t\t\t\tWHERE\n\t\t\t\t\t{$user_search_query}\n\t\t\t\t\tid > 0\n\t\t\t\tORDER BY {$sort}"); if ($this->dbh->num_rows($result) > 0) { print "<p><table width=\"100%\" cellspacing=\"0\"\n\t\t\t\tclass=\"prefUserList\" id=\"prefUserList\">"; print "<tr class=\"title\">\n\t\t\t\t\t\t<td align='center' width=\"5%\"> </td>\n\t\t\t\t\t\t<td width='30%'><a href=\"#\" onclick=\"updateUsersList('login')\">" . __('Login') . "</a></td>\n\t\t\t\t\t\t<td width='30%'><a href=\"#\" onclick=\"updateUsersList('access_level')\">" . __('Access Level') . "</a></td>\n\t\t\t\t\t\t<td width='20%'><a href=\"#\" onclick=\"updateUsersList('created')\">" . __('Registered') . "</a></td>\n\t\t\t\t\t\t<td width='20%'><a href=\"#\" onclick=\"updateUsersList('last_login')\">" . __('Last login') . "</a></td></tr>"; $lnum = 0; while ($line = $this->dbh->fetch_assoc($result)) { $uid = $line["id"]; print "<tr id=\"UMRR-{$uid}\">"; $line["login"] = htmlspecialchars($line["login"]); $line["created"] = make_local_datetime($line["created"], false); $line["last_login"] = make_local_datetime($line["last_login"], false); print "<td align='center'><input onclick='toggleSelectRow2(this);'\n\t\t\t\t\tdojoType=\"dijit.form.CheckBox\" type=\"checkbox\"\n\t\t\t\t\tid=\"UMCHK-{$uid}\"></td>"; $onclick = "onclick='editUser({$uid}, event)' title='" . __('Click to edit') . "'"; print "<td {$onclick}><img src='images/user.png' class='markedPic' alt=''> " . $line["login"] . "</td>"; if (!$line["email"]) { $line["email"] = " "; } print "<td {$onclick}>" . $access_level_names[$line["access_level"]] . "</td>"; print "<td {$onclick}>" . $line["created"] . "</td>"; print "<td {$onclick}>" . $line["last_login"] . "</td>"; print "</tr>"; ++$lnum; } print "</table>"; } else { print "<p>"; if (!$user_search) { print_warning(__('No users defined.')); } else { print_warning(__('No matching users found.')); } print "</p>"; } print "</div>"; #pane PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefUsers"); print "</div>"; #container }
function search() { $this->params = explode(":", $this->dbh->escape_string($_REQUEST["param"]), 2); $active_feed_id = sprintf("%d", $this->params[0]); $is_cat = $this->params[1] != "false"; print "<div class=\"dlgSec\">" . __('Look for') . "</div>"; print "<div class=\"dlgSecCont\">"; print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\tstyle=\"font-size : 16px; width : 20em;\"\n\t\t\trequired=\"1\" name=\"query\" type=\"search\" value=''>"; print "<hr/><span style='float : right'>" . T_sprintf('in %s', getFeedTitle($active_feed_id, $is_cat)) . "</span>"; print "</div>"; print "<div class=\"dlgButtons\">"; if (count(PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH)) == 0) { print "<div style=\"float : left\">\n\t\t\t\t<a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/wiki/SearchSyntax\">" . __("Search syntax") . "</a>\n\t\t\t\t</div>"; } print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">" . __('Search') . "</button>\n\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">" . __('Cancel') . "</button>\n\t\t</div>"; }
/** * @return array (code => Status code, message => error message if available) * * 0 - OK, Feed already exists * 1 - OK, Feed added * 2 - Invalid URL * 3 - URL content is HTML, no feeds available * 4 - URL content is HTML which contains multiple feeds. * Here you should call extractfeedurls in rpc-backend * to get all possible feeds. * 5 - Couldn't download the URL content. * 6 - Content is an invalid XML. */ function subscribe_to_feed($url, $cat_id = 0, $auth_login = '', $auth_pass = '') { global $fetch_last_error; require_once "include/rssfuncs.php"; $url = fix_url($url); if (!$url || !validate_feed_url($url)) { return array("code" => 2); } $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass); if (!$contents) { return array("code" => 5, "message" => $fetch_last_error); } foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SUBSCRIBE_FEED) as $plugin) { $contents = $plugin->hook_subscribe_feed($contents, $url, $auth_login, $auth_pass); } if (is_html($contents)) { $feedUrls = get_feeds_from_html($url, $contents); if (count($feedUrls) == 0) { return array("code" => 3); } else { if (count($feedUrls) > 1) { return array("code" => 4, "feeds" => $feedUrls); } } //use feed url as new URL $url = key($feedUrls); } if ($cat_id == "0" || !$cat_id) { $cat_qpart = "NULL"; } else { $cat_qpart = "'{$cat_id}'"; } $result = db_query("SELECT id FROM ttrss_feeds\n\t\t\tWHERE feed_url = '{$url}' AND owner_uid = " . $_SESSION["uid"]); if (strlen(FEED_CRYPT_KEY) > 0) { require_once "crypt.php"; $auth_pass = substr(encrypt_string($auth_pass), 0, 250); $auth_pass_encrypted = 'true'; } else { $auth_pass_encrypted = 'false'; } $auth_pass = db_escape_string($auth_pass); if (db_num_rows($result) == 0) { $result = db_query("INSERT INTO ttrss_feeds\n\t\t\t\t\t(owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted)\n\t\t\t\tVALUES ('" . $_SESSION["uid"] . "', '{$url}',\n\t\t\t\t'[Unknown]', {$cat_qpart}, '{$auth_login}', '{$auth_pass}', 0, {$auth_pass_encrypted})"); $result = db_query("SELECT id FROM ttrss_feeds WHERE feed_url = '{$url}'\n\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]); $feed_id = db_fetch_result($result, 0, "id"); if ($feed_id) { set_basic_feed_info($feed_id); } return array("code" => 1); } else { return array("code" => 0); } }
for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) { _debug("performing update up to version {$i}..."); $result = $updater->performUpdateTo($i); _debug($result ? "OK!" : "FAILED!"); if (!$result) { return; } } } else { _debug("update not required."); } } if (isset($options["list-plugins"])) { $tmppluginhost = new PluginHost(); $tmppluginhost->load_all($tmppluginhost::KIND_ALL); $enabled = array_map("trim", explode(",", PLUGINS)); echo "List of all available plugins:\n"; foreach ($tmppluginhost->get_plugins() as $name => $plugin) { $about = $plugin->about(); $status = $about[3] ? "system" : "user"; if (in_array($name, $enabled)) { $name .= "*"; } printf("%-50s %-10s v%.2f (by %s)\n%s\n\n", $name, $status, $about[0], $about[2], $about[1]); } echo "Plugins marked by * are currently enabled for all users.\n"; } PluginHost::getInstance()->run_commands($options); if (file_exists(LOCK_DIRECTORY . "/{$lock_filename}")) { unlink(LOCK_DIRECTORY . "/{$lock_filename}"); }
function index() { print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">"; print "<div id=\"pref-feeds-feeds\" dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Feeds') . "\">"; $result = $this->dbh->query("SELECT COUNT(id) AS num_errors\n\t\t\tFROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION["uid"]); $num_errors = $this->dbh->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>"; } $inactive_button = "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tid=\"pref_feeds_inactive_btn\"\n\t\t\t\tstyle=\"display : none\"\n\t\t\t\tonclick=\"showInactiveFeeds()\">" . __("Inactive feeds") . "</button>"; $feed_search = $this->dbh->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 onclick=\"batchSubscribe()\"\n\t\t\tdojoType=\"dijit.MenuItem\">" . __('Batch subscribe') . "</div>"; print "<div dojoType=\"dijit.MenuItem\" onclick=\"removeSelectedFeeds()\">" . __('Unsubscribe') . "</div> "; print "</div></div>"; if (get_pref('ENABLE_FEED_CATS')) { print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Categories') . "</span>"; print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; print "<div onclick=\"createCategory()\"\n\t\t\t\tdojoType=\"dijit.MenuItem\">" . __('Add category') . "</div>"; print "<div onclick=\"resetCatOrder()\"\n\t\t\t\tdojoType=\"dijit.MenuItem\">" . __('Reset sort order') . "</div>"; print "<div onclick=\"removeSelectedCategories()\"\n\t\t\t\tdojoType=\"dijit.MenuItem\">" . __('Remove selected') . "</div>"; print "</div></div>"; } print $error_button; print $inactive_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&method=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\n\t\t\tcheckInactiveFeeds();\n\t\t</script>\n\t\t</div>"; # print "<div dojoType=\"dijit.Tooltip\" connectId=\"feedTree\" position=\"below\"> # ".__('<b>Hint:</b> you can drag feeds and categories around.')." # </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, filters, labels and Tiny Tiny RSS settings.") . __("Only main settings profile can be migrated using OPML.") . "</p>"; print "<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\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=\"method\" value=\"importOpml\">\n\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return opmlImport();\" type=\"submit\">" . __('Import my OPML') . "</button>"; print "<hr>"; $opml_export_filename = "TinyTinyRSS_" . date("Y-m-d") . ".opml"; print "<p>" . __('Filename:') . " <input type=\"text\" id=\"filename\" value=\"{$opml_export_filename}\" /> " . __('Include settings') . "<input type=\"checkbox\" id=\"settings\" checked=\"1\"/>"; print "</p><button dojoType=\"dijit.form.Button\"\n\t\t\tonclick=\"gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked)\" >" . __('Export OPML') . "</button></p></form>"; print "<hr>"; print "<p>" . __('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . "</p>"; print_warning("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds."); print "<button dojoType=\"dijit.form.Button\" onclick=\"return displayDlg('" . __("Public OPML URL") . "','pubOPMLUrl')\">" . __('Display published OPML URL') . "</button> "; PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "hook_prefs_tab_section", "prefFeedsOPML"); print "</div>"; # pane if (strpos($_SERVER['HTTP_USER_AGENT'], "Firefox") !== false) { print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Firefox integration') . "\">"; print_notice(__('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.')); 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=\"" . __('Published & shared articles / Generated feeds') . "\">"; 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 "<p>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return displayDlg('" . __("View as RSS") . "','generatedFeed', '{$rss_url}')\">" . __('Display URL') . "</button> "; print "<button class=\"warning\" dojoType=\"dijit.form.Button\" onclick=\"return clearFeedAccessKeys()\">" . __('Clear all generated URLs') . "</button> "; print "</p>"; PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "hook_prefs_tab_section", "prefFeedsPublishedGenerated"); print "</div>"; #pane PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefFeeds"); print "</div>"; #container }
function index() { $pluginhost = PluginHost::getInstance(); $json_conf = $pluginhost->get($this, 'json_conf'); ?> <div data-dojo-type="dijit/layout/AccordionContainer" style="height:100%;"> <div data-dojo-type="dijit/layout/ContentPane" title="<?php print __('Settings'); ?> " selected="true"> <form dojoType="dijit.form.Form" id="feedmod_settings"> <script type="dojo/method" event="onSubmit" args="evt"><!-- evt.preventDefault(); if (this.validate()) { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { if (transport.responseText.indexOf('error')>=0) notify_error(transport.responseText); else notify_info(transport.responseText); } }); //this.reset(); } --></script> <input dojoType="dijit.form.TextBox" style="display:none" name="op" value="pluginhandler"> <input dojoType="dijit.form.TextBox" style="display:none" name="method" value="save"> <input dojoType="dijit.form.TextBox" style="display:none" name="plugin" value="af_feedmod"> <table width='100%'><tr><td> <textarea dojoType="dijit.form.SimpleTextarea" name="json_conf" style="font-size: 12px; width: 99%; height: 500px;"><?php print $json_conf; ?> </textarea> </td></tr></table> <p><button dojoType="dijit.form.Button" type="submit"><?php print __("Save"); ?> </button> </form> </div> <div data-dojo-type="dijit/layout/ContentPane" title="<?php print __("Preview"); ?> "> <form dojoType="dijit.form.Form"> <script type="dojo/method" event="onSubmit" args="evt"> evt.preventDefault(); if (this.validate()) { var values = this.getValues(); values.json_conf = dijit.byId("feedmod_settings").value.json_conf; new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(values), onComplete: function(transport) { if (transport.responseText.indexOf('error')>=0) notify_error(transport.responseText); else { var preview = document.getElementById("preview"); preview.innerHTML=transport.responseText; } } }); //this.reset(); } </script> <input dojoType="dijit.form.TextBox" style="display : none" name="op" value="pluginhandler"> <input dojoType="dijit.form.TextBox" style="display : none" name="method" value="preview"> <input dojoType="dijit.form.TextBox" style="display : none" name="plugin" value="af_feedmod"> URL: <input dojoType="dijit.form.TextBox" name="url" value="http://"> <button dojoType="dijit.form.Button" type="submit"><?php print __("Preview"); ?> </button> </form> <div id="preview" style="border:2px solid grey; min-height:2cm;"><?php print __("Preview"); ?> </div> </div> </div> <?php }