".__('No feed selected.');
-
- $reply['headlines']['content'] .= "
";
-
- $result = $this->dbh->query("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds
- WHERE owner_uid = " . $_SESSION['uid']);
-
- $last_updated = $this->dbh->fetch_result($result, 0, "last_updated");
- $last_updated = make_local_datetime($last_updated, false);
-
- $reply['headlines']['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated);
-
- $result = $this->dbh->query("SELECT COUNT(id) AS num_errors
- FROM 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['headlines']['content'] .= " ";
- $reply['headlines']['content'] .= "".
- __('Some feeds have update errors (click for details)')." ";
- }
- $reply['headlines']['content'] .= "
";
-
- $reply['headlines-info'] = array("count" => 0,
- "vgroup_last_feed" => '',
- "unread" => 0,
- "disable_cache" => true);
-
- return $reply;
- }
-
- private function generate_error_feed($error) {
- $reply = array();
-
- $reply['headlines']['id'] = -6;
- $reply['headlines']['is_cat'] = false;
-
- $reply['headlines']['toolbar'] = '';
- $reply['headlines']['content'] = "
". $error . "
";
-
- $reply['headlines-info'] = array("count" => 0,
- "vgroup_last_feed" => '',
- "unread" => 0,
- "disable_cache" => true);
-
- return $reply;
- }
-
- function quickAddFeed() {
- print "
";
- print "
";
-
- print "
";
- print_notice("Provided URL is a HTML page referencing multiple feeds, please select required feed from the dropdown menu below.");
- print "
";
-
- print "
".__("Feed or site URL")."
";
- print "
";
-
- print "
-
";
-
- print "
";
-
- print "
";
-
- if (get_pref('ENABLE_FEED_CATS')) {
- print __('Place in category:') . " ";
- print_feed_cat_select("cat", false, 'dojoType="dijit.form.Select"');
- }
-
- print "
";
-
- print '
-
-
' . __('Available feeds') . '
-
'.
- '
-
- '.
- '
';
-
- print "
";
-
-
- print "
-
- ".
- __('This feed requires authentication.')."
";
-
- print "";
-
- print "
- ".__('Subscribe')." ";
-
- if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) {
- print "".__('More feeds')." ";
- }
-
- print "".__('Cancel')."
-
";
-
- //return;
- }
-
- function feedBrowser() {
- if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return;
-
- $browser_search = $this->dbh->escape_string($_REQUEST["search"]);
-
- print "
";
- print "
";
-
- print "
-
-
-
-
".__('Search')."
-
";
-
- print "
- " . __('Popular feeds') . "
- " . __('Feed archive') . "
- ";
-
- print __("limit:");
-
- print "
";
-
- foreach (array(25, 50, 100, 200) as $l) {
- //$issel = ($l == $limit) ? "selected=\"1\"" : "";
- print "$l ";
- }
-
- print " ";
-
- print "
";
-
- require_once "feedbrowser.php";
-
- print "
";
- print make_feed_browser("", 25);
- print " ";
-
- print "
- ".__('Subscribe')."
- ".__('Remove')."
- ".__('Cancel')."
";
-
- }
-
- 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 "
".__('Look for')."
";
-
- print "
";
-
- print " ";
-
- print "
".__('Limit search to:')." ";
-
- print "
- ".__('All feeds')." ";
-
- $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 "$feed_title ";
- } else {
- print "".__('This feed')." ";
- }
-
- if ($is_cat) {
- $cat_preselected = "selected=\"1\"";
- }
-
- if (get_pref('ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) {
- print "$feed_cat_title ";
- } else {
- //print "".__('This category')." ";
- }
-
- print " ";
-
- print "";
-
- print "
";
- }
-
-
-}
-?>
diff --git a/source/classes/handler.php b/source/classes/handler.php
deleted file mode 100644
index b209320..0000000
--- a/source/classes/handler.php
+++ /dev/null
@@ -1,24 +0,0 @@
-dbh = Db::get();
- $this->args = $args;
- }
-
- function csrf_ignore($method) {
- return true;
- }
-
- function before($method) {
- return true;
- }
-
- function after() {
- return true;
- }
-
-}
-?>
diff --git a/source/classes/handler/protected.php b/source/classes/handler/protected.php
deleted file mode 100644
index 4ce8653..0000000
--- a/source/classes/handler/protected.php
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/source/classes/handler/public.php b/source/classes/handler/public.php
deleted file mode 100644
index 34d5774..0000000
--- a/source/classes/handler/public.php
+++ /dev/null
@@ -1,1006 +0,0 @@
-dbh->num_rows($result) != 0) {
-
- $ts = strtotime($this->dbh->fetch_result($result, 0, $date_check_field));
-
- if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
- strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $ts) {
- header('HTTP/1.0 304 Not Modified');
- return;
- }
-
- $last_modified = gmdate("D, d M Y H:i:s", $ts) . " GMT";
- header("Last-Modified: $last_modified", true);
- }
-
- $qfh_ret = queryFeedHeadlines($feed,
- $limit, $view_mode, $is_cat, $search, $search_mode,
- $date_sort_field, $offset, $owner_uid,
- false, 0, true, true, false, false, $start_ts);
-
-
- $result = $qfh_ret[0];
- $feed_title = htmlspecialchars($qfh_ret[1]);
- $feed_site_url = $qfh_ret[2];
- /* $last_error = $qfh_ret[3]; */
-
- $feed_self_url = get_self_url_prefix() .
- "/public.php?op=rss&id=$feed&key=" .
- get_feed_access_key($feed, false, $owner_uid);
-
- if (!$feed_site_url) $feed_site_url = get_self_url_prefix();
-
- if ($format == 'atom') {
- $tpl = new MiniTemplator;
-
- $tpl->readTemplateFromFile("templates/generated_feed.txt");
-
- $tpl->setVariable('FEED_TITLE', $feed_title, true);
- $tpl->setVariable('VERSION', VERSION, true);
- $tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true);
-
- if (PUBSUBHUBBUB_HUB && $feed == -2) {
- $tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true);
- $tpl->addBlock('feed_hub');
- }
-
- $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
- while ($line = $this->dbh->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);
- }
-
- $tpl->setVariable('ARTICLE_ID',
- htmlspecialchars($orig_guid ? $line['link'] :
- get_self_url_prefix() .
- "/public.php?url=" . urlencode($line['link'])), true);
- $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
- $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
- $tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true);
-
- $content = sanitize($line["content"], false, $owner_uid,
- $feed_site_url);
-
- if ($line['note']) {
- $content = "
Article note: " . $line['note'] . "
" .
- $content;
- $tpl->setVariable('ARTICLE_NOTE', htmlspecialchars($line['note']), true);
- }
-
- $tpl->setVariable('ARTICLE_CONTENT', $content, true);
-
- $tpl->setVariable('ARTICLE_UPDATED_ATOM',
- date('c', strtotime($line["updated"])), true);
- $tpl->setVariable('ARTICLE_UPDATED_RFC822',
- date(DATE_RFC822, strtotime($line["updated"])), true);
-
- $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true);
-
- $tpl->setVariable('ARTICLE_SOURCE_LINK', htmlspecialchars($line['site_url']), true);
- $tpl->setVariable('ARTICLE_SOURCE_TITLE', htmlspecialchars($line['feed_title'] ? $line['feed_title'] : $feed_title), true);
-
- $tags = get_article_tags($line["id"], $owner_uid);
-
- foreach ($tags as $tag) {
- $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true);
- $tpl->addBlock('category');
- }
-
- $enclosures = get_article_enclosures($line["id"]);
-
- foreach ($enclosures as $e) {
- $type = htmlspecialchars($e['content_type']);
- $url = htmlspecialchars($e['content_url']);
- $length = $e['duration'];
-
- $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true);
- $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true);
- $tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true);
-
- $tpl->addBlock('enclosure');
- }
-
- $tpl->addBlock('entry');
- }
-
- $tmp = "";
-
- $tpl->addBlock('feed');
- $tpl->generateOutputToString($tmp);
-
- if (@!$_REQUEST["noxml"]) {
- header("Content-Type: text/xml; charset=utf-8");
- } else {
- header("Content-Type: text/plain; charset=utf-8");
- }
-
- print $tmp;
- } else if ($format == 'json') {
-
- $feed = array();
-
- $feed['title'] = $feed_title;
- $feed['version'] = VERSION;
- $feed['feed_url'] = $feed_self_url;
-
- if (PUBSUBHUBBUB_HUB && $feed == -2) {
- $feed['hub_url'] = PUBSUBHUBBUB_HUB;
- }
-
- $feed['self_url'] = get_self_url_prefix();
-
- $feed['articles'] = array();
-
- while ($line = $this->dbh->fetch_assoc($result)) {
- $line["content_preview"] = truncate_string(strip_tags($line["content_preview"]), 100, '...');
- foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
- $line = $p->hook_query_headlines($line, 100);
- }
- $article = array();
-
- $article['id'] = $line['link'];
- $article['link'] = $line['link'];
- $article['title'] = $line['title'];
- $article['excerpt'] = $line["content_preview"];
- $article['content'] = sanitize($line["content"], false, $owner_uid);
- $article['updated'] = date('c', strtotime($line["updated"]));
-
- if ($line['note']) $article['note'] = $line['note'];
- if ($article['author']) $article['author'] = $line['author'];
-
- $tags = get_article_tags($line["id"], $owner_uid);
-
- if (count($tags) > 0) {
- $article['tags'] = array();
-
- foreach ($tags as $tag) {
- array_push($article['tags'], $tag);
- }
- }
-
- $enclosures = get_article_enclosures($line["id"]);
-
- if (count($enclosures) > 0) {
- $article['enclosures'] = array();
-
- foreach ($enclosures as $e) {
- $type = $e['content_type'];
- $url = $e['content_url'];
- $length = $e['duration'];
-
- array_push($article['enclosures'], array("url" => $url, "type" => $type, "length" => $length));
- }
- }
-
- array_push($feed['articles'], $article);
- }
-
- header("Content-Type: text/json; charset=utf-8");
- print json_encode($feed);
-
- } else {
- header("Content-Type: text/plain; charset=utf-8");
- print json_encode(array("error" => array("message" => "Unknown format")));
- }
- }
-
- function getUnread() {
- $login = $this->dbh->escape_string($_REQUEST["login"]);
- $fresh = $_REQUEST["fresh"] == "1";
-
- $result = $this->dbh->query("SELECT id FROM ttrss_users WHERE login = '$login'");
-
- if ($this->dbh->num_rows($result) == 1) {
- $uid = $this->dbh->fetch_result($result, 0, "id");
-
- print getGlobalUnread($uid);
-
- if ($fresh) {
- print ";";
- print getFeedArticles(-3, false, true, $uid);
- }
-
- } else {
- print "-1;User not found";
- }
-
- }
-
- function getProfiles() {
- $login = $this->dbh->escape_string($_REQUEST["login"]);
-
- $result = $this->dbh->query("SELECT ttrss_settings_profiles.* FROM ttrss_settings_profiles,ttrss_users
- WHERE ttrss_users.id = ttrss_settings_profiles.owner_uid AND login = '$login' ORDER BY title");
-
- print "
";
-
- print "" . __("Default profile") . " ";
-
- while ($line = $this->dbh->fetch_assoc($result)) {
- $id = $line["id"];
- $title = $line["title"];
-
- print "$title ";
- }
-
- print " ";
- }
-
- function pubsub() {
- $mode = $this->dbh->escape_string($_REQUEST['hub_mode']);
- if (!$mode) $mode = $this->dbh->escape_string($_REQUEST['hub.mode']);
-
- $feed_id = (int) $this->dbh->escape_string($_REQUEST['id']);
- $feed_url = $this->dbh->escape_string($_REQUEST['hub_topic']);
-
- if (!$feed_url) $feed_url = $this->dbh->escape_string($_REQUEST['hub.topic']);
-
- if (!PUBSUBHUBBUB_ENABLED) {
- header('HTTP/1.0 404 Not Found');
- echo "404 Not found (Disabled by server)";
- return;
- }
-
- // TODO: implement hub_verifytoken checking
- // TODO: store requested rel=self or whatever for verification
- // (may be different from stored feed url) e.g. http://url/ or http://url
-
- $result = $this->dbh->query("SELECT feed_url FROM ttrss_feeds
- WHERE id = '$feed_id'");
-
- if ($this->dbh->num_rows($result) != 0) {
-
- $check_feed_url = $this->dbh->fetch_result($result, 0, "feed_url");
-
- // ignore url checking for the time being
- if ($check_feed_url && (true || $check_feed_url == $feed_url || !$feed_url)) {
- if ($mode == "subscribe") {
-
- $this->dbh->query("UPDATE ttrss_feeds SET pubsub_state = 2
- WHERE id = '$feed_id'");
-
- print $_REQUEST['hub_challenge'];
- return;
-
- } else if ($mode == "unsubscribe") {
-
- $this->dbh->query("UPDATE ttrss_feeds SET pubsub_state = 0
- WHERE id = '$feed_id'");
-
- print $_REQUEST['hub_challenge'];
- return;
-
- } else if (!$mode) {
-
- // Received update ping, schedule feed update.
- //update_rss_feed($feed_id, true, true);
-
- $this->dbh->query("UPDATE ttrss_feeds SET
- last_update_started = '1970-01-01',
- last_updated = '1970-01-01' WHERE id = '$feed_id'");
-
- }
- } else {
- header('HTTP/1.0 404 Not Found');
- echo "404 Not found (URL check failed)";
- }
- } else {
- header('HTTP/1.0 404 Not Found');
- echo "404 Not found (Feed not found)";
- }
-
- }
-
- function logout() {
- logout_user();
- header("Location: index.php");
- }
-
- function share() {
- $uuid = $this->dbh->escape_string($_REQUEST["key"]);
-
- $result = $this->dbh->query("SELECT ref_id, owner_uid FROM ttrss_user_entries WHERE
- uuid = '$uuid'");
-
- if ($this->dbh->num_rows($result) != 0) {
- header("Content-Type: text/html");
-
- $id = $this->dbh->fetch_result($result, 0, "ref_id");
- $owner_uid = $this->dbh->fetch_result($result, 0, "owner_uid");
-
- $article = format_article($id, false, true, $owner_uid);
-
- print_r($article['content']);
-
- } else {
- print "Article not found.";
- }
-
- }
-
- function rss() {
- $feed = $this->dbh->escape_string($_REQUEST["id"]);
- $key = $this->dbh->escape_string($_REQUEST["key"]);
- $is_cat = sql_bool_to_bool($_REQUEST["is_cat"]);
- $limit = (int)$this->dbh->escape_string($_REQUEST["limit"]);
- $offset = (int)$this->dbh->escape_string($_REQUEST["offset"]);
-
- $search = $this->dbh->escape_string($_REQUEST["q"]);
- $search_mode = $this->dbh->escape_string($_REQUEST["smode"]);
- $view_mode = $this->dbh->escape_string($_REQUEST["view-mode"]);
- $order = $this->dbh->escape_string($_REQUEST["order"]);
- $start_ts = $this->dbh->escape_string($_REQUEST["ts"]);
-
- $format = $this->dbh->escape_string($_REQUEST['format']);
- $orig_guid = sql_bool_to_bool($_REQUEST["orig_guid"]);
-
- if (!$format) $format = 'atom';
-
- if (SINGLE_USER_MODE) {
- authenticate_user("admin", null);
- }
-
- $owner_id = false;
-
- if ($key) {
- $result = $this->dbh->query("SELECT owner_uid FROM
- ttrss_access_keys WHERE access_key = '$key' AND feed_id = '$feed'");
-
- if ($this->dbh->num_rows($result) == 1)
- $owner_id = $this->dbh->fetch_result($result, 0, "owner_uid");
- }
-
- if ($owner_id) {
- $this->generate_syndicated_feed($owner_id, $feed, $is_cat, $limit,
- $offset, $search, $search_mode, $view_mode, $format, $order, $orig_guid, $start_ts);
- } else {
- header('HTTP/1.1 403 Forbidden');
- }
- }
-
- function updateTask() {
- PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", false);
- }
-
- function housekeepingTask() {
- PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING, "hook_house_keeping", false);
- }
-
- function globalUpdateFeeds() {
- RPC::updaterandomfeed_real($this->dbh);
-
- PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", false);
- }
-
- function sharepopup() {
- if (SINGLE_USER_MODE) {
- login_sequence();
- }
-
- header('Content-Type: text/html; charset=utf-8');
- print "
Tiny Tiny RSS
-
-
";
-
- echo stylesheet_tag("css/utility.css");
- echo stylesheet_tag("css/dijit.css");
- echo javascript_tag("lib/prototype.js");
- echo javascript_tag("lib/scriptaculous/scriptaculous.js?load=effects,controls");
- print "
- ";
-
- $action = $_REQUEST["action"];
-
- if ($_SESSION["uid"]) {
-
- if ($action == 'share') {
-
- $title = $this->dbh->escape_string(strip_tags($_REQUEST["title"]));
- $url = $this->dbh->escape_string(strip_tags($_REQUEST["url"]));
- $content = $this->dbh->escape_string(strip_tags($_REQUEST["content"]));
- $labels = $this->dbh->escape_string(strip_tags($_REQUEST["labels"]));
-
- Article::create_published_article($title, $url, $content, $labels,
- $_SESSION["uid"]);
-
- print "";
-
- } else {
- $title = htmlspecialchars($_REQUEST["title"]);
- $url = htmlspecialchars($_REQUEST["url"]);
-
- ?>
-
-
-
-
-
-
- dbh->escape_string($_POST["login"]);
- $password = $_POST["password"];
- $remember_me = $_POST["remember_me"];
-
- if ($remember_me) {
- session_set_cookie_params(SESSION_COOKIE_LIFETIME);
- } else {
- session_set_cookie_params(0);
- }
-
- @session_start();
-
- if (authenticate_user($login, $password)) {
- $_POST["password"] = "";
-
- if (get_schema_version() >= 120) {
- $_SESSION["language"] = get_pref("USER_LANGUAGE", $_SESSION["uid"]);
- }
-
- $_SESSION["ref_schema_version"] = get_schema_version(true);
- $_SESSION["bw_limit"] = !!$_POST["bw_limit"];
-
- if ($_POST["profile"]) {
-
- $profile = $this->dbh->escape_string($_POST["profile"]);
-
- $result = $this->dbh->query("SELECT id FROM ttrss_settings_profiles
- WHERE id = '$profile' AND owner_uid = " . $_SESSION["uid"]);
-
- if ($this->dbh->num_rows($result) != 0) {
- $_SESSION["profile"] = $profile;
- }
- }
- } else {
- $_SESSION["login_error_msg"] = __("Incorrect username or password");
- user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING);
- }
-
- if ($_REQUEST['return']) {
- header("Location: " . $_REQUEST['return']);
- } else {
- header("Location: " . SELF_URL_PATH);
- }
- }
- }
-
- /* function subtest() {
- header("Content-type: text/plain; charset=utf-8");
-
- $url = $_REQUEST["url"];
-
- print "$url\n\n";
-
-
- print_r(get_feeds_from_html($url, fetch_file_contents($url)));
-
- } */
-
- function subscribe() {
- if (SINGLE_USER_MODE) {
- login_sequence();
- }
-
- if ($_SESSION["uid"]) {
-
- $feed_url = $this->dbh->escape_string(trim($_REQUEST["feed_url"]));
-
- header('Content-Type: text/html; charset=utf-8');
- print "
-
-
Tiny Tiny RSS
-
-
-
-
-
-
-
-
-
".__("Subscribe to feed...")." ";
-
- $rc = subscribe_to_feed($feed_url);
-
- switch ($rc['code']) {
- case 0:
- print_warning(T_sprintf("Already subscribed to
%s .", $feed_url));
- break;
- case 1:
- print_notice(T_sprintf("Subscribed to
%s .", $feed_url));
- break;
- case 2:
- print_error(T_sprintf("Could not subscribe to
%s .", $feed_url));
- break;
- case 3:
- print_error(T_sprintf("No feeds found in
%s .", $feed_url));
- break;
- case 4:
- print_notice(__("Multiple feed URLs found."));
- $feed_urls = $rc["feeds"];
- break;
- case 5:
- print_error(T_sprintf("Could not subscribe to
%s .
Can't download the Feed URL.", $feed_url));
- break;
- }
-
- if ($feed_urls) {
-
- print "
";
- }
-
- $tp_uri = get_self_url_prefix() . "/prefs.php";
- $tt_uri = get_self_url_prefix();
-
- if ($rc['code'] <= 2){
- $result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE
- feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]);
-
- $feed_id = $this->dbh->fetch_result($result, 0, "id");
- } else {
- $feed_id = 0;
- }
- print "
";
-
- if ($feed_id) {
- print "
";
- }
-
- print "
";
-
- print "
";
-
- } else {
- render_login_form();
- }
- }
-
- function index() {
- header("Content-Type: text/plain");
- print json_encode(array("error" => array("code" => 7)));
- }
-
- function forgotpass() {
- startup_gettext();
-
- @$hash = $_REQUEST["hash"];
-
- header('Content-Type: text/html; charset=utf-8');
- print "
Tiny Tiny RSS
-
-
";
-
- echo stylesheet_tag("css/utility.css");
- echo javascript_tag("lib/prototype.js");
-
- print "
- ";
-
- print '
';
- print "
".__("Password recovery")." ";
- print "
";
-
- @$method = $_POST['method'];
-
- if ($hash) {
- $login = $_REQUEST["login"];
-
- if ($login) {
- $result = $this->dbh->query("SELECT id, resetpass_token FROM ttrss_users
- WHERE login = '$login'");
-
- if ($this->dbh->num_rows($result) != 0) {
- $id = $this->dbh->fetch_result($result, 0, "id");
- $resetpass_token_full = $this->dbh->fetch_result($result, 0, "resetpass_token");
- list($timestamp, $resetpass_token) = explode(":", $resetpass_token_full);
-
- if ($timestamp && $resetpass_token &&
- $timestamp >= time() - 15*60*60 &&
- $resetpass_token == $hash) {
-
- $result = $this->dbh->query("UPDATE ttrss_users SET resetpass_token = NULL
- WHERE id = $id");
-
- Pref_Users::resetUserPassword($id, true);
-
- print "
"."Completed."."
";
-
- } else {
- print_error("Some of the information provided is missing or incorrect.");
- }
- } else {
- print_error("Some of the information provided is missing or incorrect.");
- }
- } else {
- print_error("Some of the information provided is missing or incorrect.");
- }
-
- print "
";
-
- } else if (!$method) {
- print_notice(__("You will need to provide valid account name and email. A password reset link will be sent to your email address."));
-
- print "
";
- } else if ($method == 'do') {
-
- $login = $this->dbh->escape_string($_POST["login"]);
- $email = $this->dbh->escape_string($_POST["email"]);
- $test = $this->dbh->escape_string($_POST["test"]);
-
- if (($test != 4 && $test != 'four') || !$email || !$login) {
- print_error(__('Some of the required form parameters are missing or incorrect.'));
-
- print "
";
-
- } else {
-
- print_notice("Password reset instructions are being sent to your email address.");
-
- $result = $this->dbh->query("SELECT id FROM ttrss_users
- WHERE login = '$login' AND email = '$email'");
-
- if ($this->dbh->num_rows($result) != 0) {
- $id = $this->dbh->fetch_result($result, 0, "id");
-
- if ($id) {
- $resetpass_token = sha1(get_random_bytes(128));
- $resetpass_link = get_self_url_prefix() . "/public.php?op=forgotpass&hash=" . $resetpass_token .
- "&login=" . urlencode($login);
-
- require_once 'classes/ttrssmailer.php';
- require_once "lib/MiniTemplator.class.php";
-
- $tpl = new MiniTemplator;
-
- $tpl->readTemplateFromFile("templates/resetpass_link_template.txt");
-
- $tpl->setVariable('LOGIN', $login);
- $tpl->setVariable('RESETPASS_LINK', $resetpass_link);
-
- $tpl->addBlock('message');
-
- $message = "";
-
- $tpl->generateOutputToString($message);
-
- $mail = new ttrssMailer();
-
- $rc = $mail->quickMail($email, $login,
- __("[tt-rss] Password reset request"),
- $message, false);
-
- if (!$rc) print_error($mail->ErrorInfo);
-
- $resetpass_token_full = $this->dbh->escape_string(time() . ":" . $resetpass_token);
-
- $result = $this->dbh->query("UPDATE ttrss_users
- SET resetpass_token = '$resetpass_token_full'
- WHERE login = '$login' AND email = '$email'");
-
- //Pref_Users::resetUserPassword($id, false);
-
- print "
";
-
- print "
"."Completed."."
";
- } else {
- print_error("User ID not found.");
- }
-
- print "
";
-
- } else {
- print_error(__("Sorry, login and email combination not found."));
-
- print "
";
-
- }
- }
-
- }
-
- print "
";
- print "";
- print "";
-
- }
-
- function dbupdate() {
- startup_gettext();
-
- if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) {
- $_SESSION["login_error_msg"] = __("Your access level is insufficient to run this script.");
- render_login_form();
- exit;
- }
-
- ?>
-
-
Database Updater
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- isUpdateRequired()) {
-
- print "
Performing updates ";
-
- print "
Updating to schema version " . SCHEMA_VERSION . " ";
-
- print "
";
-
- for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) {
- print "Performing update up to version $i...";
-
- $result = $updater->performUpdateTo($i);
-
- if (!$result) {
- print "FAILED! ";
-
- print_warning("One of the updates failed. Either retry the process or perform updates manually.");
- print "
";
-
- break;
- } else {
- print "
OK! ";
- }
- }
-
- print "";
-
- print_notice("Your Tiny Tiny RSS database is now updated to the latest version.");
-
- print "
";
-
- } else {
- print "
Your database is up to date. ";
-
- print "
";
- }
- } else {
- if ($updater->isUpdateRequired()) {
-
- print "
Database update required ";
-
- print "
";
- printf("Your Tiny Tiny RSS database needs update to the latest version: %d to %d.",
- $updater->getSchemaVersion(), SCHEMA_VERSION);
- print " ";
-
- print_warning("Please backup your database before proceeding.");
-
- print "
";
-
- } else {
-
- print_notice("Tiny Tiny RSS database is up to date.");
-
- print "
";
-
- }
- }
- ?>
-
-
-
-
-
diff --git a/source/classes/iauthmodule.php b/source/classes/iauthmodule.php
deleted file mode 100644
index d47dbac..0000000
--- a/source/classes/iauthmodule.php
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/source/classes/idb.php b/source/classes/idb.php
deleted file mode 100644
index 16f760b..0000000
--- a/source/classes/idb.php
+++ /dev/null
@@ -1,13 +0,0 @@
-
diff --git a/source/classes/ihandler.php b/source/classes/ihandler.php
deleted file mode 100644
index e3c8a53..0000000
--- a/source/classes/ihandler.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/source/classes/logger.php b/source/classes/logger.php
deleted file mode 100644
index 4a9c1df..0000000
--- a/source/classes/logger.php
+++ /dev/null
@@ -1,65 +0,0 @@
- 'E_ERROR',
- 2 => 'E_WARNING',
- 4 => 'E_PARSE',
- 8 => 'E_NOTICE',
- 16 => 'E_CORE_ERROR',
- 32 => 'E_CORE_WARNING',
- 64 => 'E_COMPILE_ERROR',
- 128 => 'E_COMPILE_WARNING',
- 256 => 'E_USER_ERROR',
- 512 => 'E_USER_WARNING',
- 1024 => 'E_USER_NOTICE',
- 2048 => 'E_STRICT',
- 4096 => 'E_RECOVERABLE_ERROR',
- 8192 => 'E_DEPRECATED',
- 16384 => 'E_USER_DEPRECATED',
- 32767 => 'E_ALL');
-
- function log_error($errno, $errstr, $file, $line, $context) {
- if ($errno == E_NOTICE) return false;
-
- if ($this->adapter)
- return $this->adapter->log_error($errno, $errstr, $file, $line, $context);
- else
- return false;
- }
-
- function log($string) {
- if ($this->adapter)
- return $this->adapter->log($string);
- else
- return false;
- }
-
- private function __clone() {
- //
- }
-
- function __construct() {
- switch (LOG_DESTINATION) {
- case "sql":
- $this->adapter = new Logger_SQL();
- break;
- case "syslog":
- $this->adapter = new Logger_Syslog();
- break;
- default:
- $this->adapter = false;
- }
- }
-
- public static function get() {
- if (self::$instance == null)
- self::$instance = new self();
-
- return self::$instance;
- }
-
-}
-?>
diff --git a/source/classes/logger/sql.php b/source/classes/logger/sql.php
deleted file mode 100644
index c0f8b45..0000000
--- a/source/classes/logger/sql.php
+++ /dev/null
@@ -1,28 +0,0 @@
- 117) {
-
- $errno = Db::get()->escape_string($errno);
- $errstr = Db::get()->escape_string($errstr);
- $file = Db::get()->escape_string($file);
- $line = Db::get()->escape_string($line);
- $context = ''; // backtrace is a lot of data which is not really critical to store
- //$context = $this->dbh->escape_string(serialize($context));
-
- $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : "NULL";
-
- $result = Db::get()->query(
- "INSERT INTO ttrss_error_log
- (errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
- ($errno, '$errstr', '$file', '$line', '$context', $owner_uid, NOW())");
-
- return Db::get()->affected_rows($result) != 0;
- }
-
- return false;
- }
-
-}
-?>
diff --git a/source/classes/logger/syslog.php b/source/classes/logger/syslog.php
deleted file mode 100644
index b8b5260..0000000
--- a/source/classes/logger/syslog.php
+++ /dev/null
@@ -1,31 +0,0 @@
-
diff --git a/source/classes/opml.php b/source/classes/opml.php
deleted file mode 100644
index 04516dd..0000000
--- a/source/classes/opml.php
+++ /dev/null
@@ -1,525 +0,0 @@
-opml_export($output_name, $owner_uid, false, ($show_settings == 1));
- }
-
- function import() {
- $owner_uid = $_SESSION["uid"];
-
- header('Content-Type: text/html; charset=utf-8');
-
- print "
-
-
-
".__("OPML Utility")."
-
-
-
-
-
".__('OPML Utility')." ";
-
- add_feed_category("Imported feeds");
-
- $this->opml_notice(__("Importing OPML..."));
- $this->opml_import($owner_uid);
-
- print " ";
-
- print "
";
-
-
- }
-
- // Export
-
- private function opml_export_category($owner_uid, $cat_id, $hide_private_feeds=false) {
-
- if ($cat_id) {
- $cat_qpart = "parent_cat = '$cat_id'";
- $feed_cat_qpart = "cat_id = '$cat_id'";
- } else {
- $cat_qpart = "parent_cat IS NULL";
- $feed_cat_qpart = "cat_id IS NULL";
- }
-
- if ($hide_private_feeds)
- $hide_qpart = "(private IS false AND auth_login = '' AND auth_pass = '')";
- else
- $hide_qpart = "true";
-
- $out = "";
-
- if ($cat_id) {
- $result = $this->dbh->query("SELECT title FROM ttrss_feed_categories WHERE id = '$cat_id'
- AND owner_uid = '$owner_uid'");
- $cat_title = htmlspecialchars($this->dbh->fetch_result($result, 0, "title"));
- }
-
- if ($cat_title) $out .= "
\n";
-
- $result = $this->dbh->query("SELECT id,title
- FROM ttrss_feed_categories WHERE
- $cat_qpart AND owner_uid = '$owner_uid' ORDER BY order_id, title");
-
- while ($line = $this->dbh->fetch_assoc($result)) {
- $title = htmlspecialchars($line["title"]);
- $out .= $this->opml_export_category($owner_uid, $line["id"], $hide_private_feeds);
- }
-
- $feeds_result = $this->dbh->query("select title, feed_url, site_url
- from ttrss_feeds where $feed_cat_qpart AND owner_uid = '$owner_uid' AND $hide_qpart
- order by order_id, title");
-
- while ($fline = $this->dbh->fetch_assoc($feeds_result)) {
- $title = htmlspecialchars($fline["title"]);
- $url = htmlspecialchars($fline["feed_url"]);
- $site_url = htmlspecialchars($fline["site_url"]);
-
- if ($site_url) {
- $html_url_qpart = "htmlUrl=\"$site_url\"";
- } else {
- $html_url_qpart = "";
- }
-
- $out .= " \n";
- }
-
- if ($cat_title) $out .= " \n";
-
- return $out;
- }
-
- function opml_export($name, $owner_uid, $hide_private_feeds=false, $include_settings=true) {
- if (!$owner_uid) return;
-
- if (!isset($_REQUEST["debug"])) {
- header("Content-type: application/xml+opml");
- header("Content-Disposition: attachment; filename=" . $name );
- } else {
- header("Content-type: text/xml");
- }
-
- $out = "";
-
- $out .= "
";
- $out .= "
- " . date("r", time()) . "
- Tiny Tiny RSS Feed Export
- ";
- $out .= "";
-
- $out .= $this->opml_export_category($owner_uid, false, $hide_private_feeds);
-
- # export tt-rss settings
-
- if ($include_settings) {
- $out .= "";
-
- $result = $this->dbh->query("SELECT pref_name, value FROM ttrss_user_prefs WHERE
- profile IS NULL AND owner_uid = " . $_SESSION["uid"] . " ORDER BY pref_name");
-
- while ($line = $this->dbh->fetch_assoc($result)) {
- $name = $line["pref_name"];
- $value = htmlspecialchars($line["value"]);
-
- $out .= "";
- }
-
- $out .= " ";
-
- $out .= "";
-
- $result = $this->dbh->query("SELECT * FROM ttrss_labels2 WHERE
- owner_uid = " . $_SESSION['uid']);
-
- while ($line = $this->dbh->fetch_assoc($result)) {
- $name = htmlspecialchars($line['caption']);
- $fg_color = htmlspecialchars($line['fg_color']);
- $bg_color = htmlspecialchars($line['bg_color']);
-
- $out .= "";
-
- }
-
- $out .= " ";
-
- $out .= "";
-
- $result = $this->dbh->query("SELECT * FROM ttrss_filters2
- WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY id");
-
- while ($line = $this->dbh->fetch_assoc($result)) {
- foreach (array('enabled', 'match_any_rule', 'inverse') as $b) {
- $line[$b] = sql_bool_to_bool($line[$b]);
- }
-
- $line["rules"] = array();
- $line["actions"] = array();
-
- $tmp_result = $this->dbh->query("SELECT * FROM ttrss_filters2_rules
- WHERE filter_id = ".$line["id"]);
-
- while ($tmp_line = $this->dbh->fetch_assoc($tmp_result)) {
- unset($tmp_line["id"]);
- unset($tmp_line["filter_id"]);
-
- $cat_filter = sql_bool_to_bool($tmp_line["cat_filter"]);
-
- if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) {
- $tmp_line["feed"] = getFeedTitle(
- $cat_filter ? $tmp_line["cat_id"] : $tmp_line["feed_id"],
- $cat_filter);
- } else {
- $tmp_line["feed"] = "";
- }
-
- $tmp_line["cat_filter"] = sql_bool_to_bool($tmp_line["cat_filter"]);
- $tmp_line["inverse"] = sql_bool_to_bool($tmp_line["inverse"]);
-
- unset($tmp_line["feed_id"]);
- unset($tmp_line["cat_id"]);
-
- array_push($line["rules"], $tmp_line);
- }
-
- $tmp_result = $this->dbh->query("SELECT * FROM ttrss_filters2_actions
- WHERE filter_id = ".$line["id"]);
-
- while ($tmp_line = $this->dbh->fetch_assoc($tmp_result)) {
- unset($tmp_line["id"]);
- unset($tmp_line["filter_id"]);
-
- array_push($line["actions"], $tmp_line);
- }
-
- unset($line["id"]);
- unset($line["owner_uid"]);
- $filter = json_encode($line);
-
- $out .= " ";
-
- }
-
-
- $out .= " ";
- }
-
- $out .= " ";
-
- // Format output.
- $doc = new DOMDocument();
- $doc->formatOutput = true;
- $doc->preserveWhiteSpace = false;
- $doc->loadXML($out);
-
- $xpath = new DOMXpath($doc);
- $outlines = $xpath->query("//outline[@title]");
-
- // cleanup empty categories
- foreach ($outlines as $node) {
- if ($node->getElementsByTagName('outline')->length == 0)
- $node->parentNode->removeChild($node);
- }
-
- $res = $doc->saveXML();
-
-/* // saveXML uses a two-space indent. Change to tabs.
- $res = preg_replace_callback('/^(?: )+/mu',
- create_function(
- '$matches',
- 'return str_repeat("\t", intval(strlen($matches[0])/2));'),
- $res); */
-
- print $res;
- }
-
- // Import
-
- private function opml_import_feed($doc, $node, $cat_id, $owner_uid) {
- $attrs = $node->attributes;
-
- $feed_title = $this->dbh->escape_string(mb_substr($attrs->getNamedItem('text')->nodeValue, 0, 250));
- if (!$feed_title) $feed_title = $this->dbh->escape_string(mb_substr($attrs->getNamedItem('title')->nodeValue, 0, 250));
-
- $feed_url = $this->dbh->escape_string($attrs->getNamedItem('xmlUrl')->nodeValue);
- if (!$feed_url) $feed_url = $this->dbh->escape_string($attrs->getNamedItem('xmlURL')->nodeValue);
-
- $site_url = $this->dbh->escape_string(mb_substr($attrs->getNamedItem('htmlUrl')->nodeValue, 0, 250));
-
- if ($feed_url && $feed_title) {
- $result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE
- feed_url = '$feed_url' AND owner_uid = '$owner_uid'");
-
- if ($this->dbh->num_rows($result) == 0) {
- #$this->opml_notice("[FEED] [$feed_title/$feed_url] dst_CAT=$cat_id");
- $this->opml_notice(T_sprintf("Adding feed: %s", $feed_title));
-
- if (!$cat_id) $cat_id = 'NULL';
-
- $query = "INSERT INTO ttrss_feeds
- (title, feed_url, owner_uid, cat_id, site_url, order_id) VALUES
- ('$feed_title', '$feed_url', '$owner_uid',
- $cat_id, '$site_url', 0)";
- $this->dbh->query($query);
-
- } else {
- $this->opml_notice(T_sprintf("Duplicate feed: %s", $feed_title));
- }
- }
- }
-
- private function opml_import_label($doc, $node, $owner_uid) {
- $attrs = $node->attributes;
- $label_name = $this->dbh->escape_string($attrs->getNamedItem('label-name')->nodeValue);
-
- if ($label_name) {
- $fg_color = $this->dbh->escape_string($attrs->getNamedItem('label-fg-color')->nodeValue);
- $bg_color = $this->dbh->escape_string($attrs->getNamedItem('label-bg-color')->nodeValue);
-
- if (!label_find_id($label_name, $_SESSION['uid'])) {
- $this->opml_notice(T_sprintf("Adding label %s", htmlspecialchars($label_name)));
- label_create($label_name, $fg_color, $bg_color, $owner_uid);
- } else {
- $this->opml_notice(T_sprintf("Duplicate label: %s", htmlspecialchars($label_name)));
- }
- }
- }
-
- private function opml_import_preference($doc, $node, $owner_uid) {
- $attrs = $node->attributes;
- $pref_name = $this->dbh->escape_string($attrs->getNamedItem('pref-name')->nodeValue);
-
- if ($pref_name) {
- $pref_value = $this->dbh->escape_string($attrs->getNamedItem('value')->nodeValue);
-
- $this->opml_notice(T_sprintf("Setting preference key %s to %s",
- $pref_name, $pref_value));
-
- set_pref($pref_name, $pref_value);
- }
- }
-
- private function opml_import_filter($doc, $node, $owner_uid) {
- $attrs = $node->attributes;
-
- $filter_type = $this->dbh->escape_string($attrs->getNamedItem('filter-type')->nodeValue);
-
- if ($filter_type == '2') {
- $filter = json_decode($node->nodeValue, true);
-
- if ($filter) {
- $match_any_rule = bool_to_sql_bool($filter["match_any_rule"]);
- $enabled = bool_to_sql_bool($filter["enabled"]);
- $inverse = bool_to_sql_bool($filter["inverse"]);
- $title = db_escape_string($filter["title"]);
-
- $this->dbh->query("BEGIN");
-
- $this->dbh->query("INSERT INTO ttrss_filters2 (match_any_rule,enabled,inverse,title,owner_uid)
- VALUES ($match_any_rule, $enabled, $inverse, '$title',
- ".$_SESSION["uid"].")");
-
- $result = $this->dbh->query("SELECT MAX(id) AS id FROM ttrss_filters2 WHERE
- owner_uid = ".$_SESSION["uid"]);
- $filter_id = $this->dbh->fetch_result($result, 0, "id");
-
- if ($filter_id) {
- $this->opml_notice(T_sprintf("Adding filter..."));
-
- foreach ($filter["rules"] as $rule) {
- $feed_id = "NULL";
- $cat_id = "NULL";
-
- if (!$rule["cat_filter"]) {
- $tmp_result = $this->dbh->query("SELECT id FROM ttrss_feeds
- WHERE title = '".$this->dbh->escape_string($rule["feed"])."' AND owner_uid = ".$_SESSION["uid"]);
- if ($this->dbh->num_rows($tmp_result) > 0) {
- $feed_id = $this->dbh->fetch_result($tmp_result, 0, "id");
- }
- } else {
- $tmp_result = $this->dbh->query("SELECT id FROM ttrss_feed_categories
- WHERE title = '".$this->dbh->escape_string($rule["feed"])."' AND owner_uid = ".$_SESSION["uid"]);
-
- if ($this->dbh->num_rows($tmp_result) > 0) {
- $cat_id = $this->dbh->fetch_result($tmp_result, 0, "id");
- }
- }
-
- $cat_filter = bool_to_sql_bool($rule["cat_filter"]);
- $reg_exp = $this->dbh->escape_string($rule["reg_exp"]);
- $filter_type = (int)$rule["filter_type"];
- $inverse = bool_to_sql_bool($rule["inverse"]);
-
- $this->dbh->query("INSERT INTO ttrss_filters2_rules (feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter,inverse)
- VALUES ($feed_id, $cat_id, $filter_id, $filter_type, '$reg_exp', $cat_filter,$inverse)");
- }
-
- foreach ($filter["actions"] as $action) {
-
- $action_id = (int)$action["action_id"];
- $action_param = $this->dbh->escape_string($action["action_param"]);
-
- $this->dbh->query("INSERT INTO ttrss_filters2_actions (filter_id,action_id,action_param)
- VALUES ($filter_id, $action_id, '$action_param')");
- }
- }
-
- $this->dbh->query("COMMIT");
- }
- }
- }
-
- private function opml_import_category($doc, $root_node, $owner_uid, $parent_id) {
- $body = $doc->getElementsByTagName('body');
-
- $default_cat_id = (int) get_feed_category('Imported feeds', false);
-
- if ($root_node) {
- $cat_title = $this->dbh->escape_string(mb_substr($root_node->attributes->getNamedItem('text')->nodeValue, 0, 250));
-
- if (!$cat_title)
- $cat_title = $this->dbh->escape_string(mb_substr($root_node->attributes->getNamedItem('title')->nodeValue, 0, 250));
-
- if (!in_array($cat_title, array("tt-rss-filters", "tt-rss-labels", "tt-rss-prefs"))) {
- $cat_id = get_feed_category($cat_title, $parent_id);
- $this->dbh->query("BEGIN");
- if ($cat_id === false) {
- add_feed_category($cat_title, $parent_id);
- $cat_id = get_feed_category($cat_title, $parent_id);
- }
- $this->dbh->query("COMMIT");
- } else {
- $cat_id = 0;
- }
-
- $outlines = $root_node->childNodes;
-
- } else {
- $xpath = new DOMXpath($doc);
- $outlines = $xpath->query("//opml/body/outline");
-
- $cat_id = 0;
- }
-
- #$this->opml_notice("[CAT] $cat_title id: $cat_id P_id: $parent_id");
- $this->opml_notice(T_sprintf("Processing category: %s", $cat_title ? $cat_title : __("Uncategorized")));
-
- foreach ($outlines as $node) {
- if ($node->hasAttributes() && strtolower($node->tagName) == "outline") {
- $attrs = $node->attributes;
- $node_cat_title = $this->dbh->escape_string($attrs->getNamedItem('text')->nodeValue);
-
- if (!$node_cat_title)
- $node_cat_title = $this->dbh->escape_string($attrs->getNamedItem('title')->nodeValue);
-
- $node_feed_url = $this->dbh->escape_string($attrs->getNamedItem('xmlUrl')->nodeValue);
-
- if ($node_cat_title && !$node_feed_url) {
- $this->opml_import_category($doc, $node, $owner_uid, $cat_id);
- } else {
-
- if (!$cat_id) {
- $dst_cat_id = $default_cat_id;
- } else {
- $dst_cat_id = $cat_id;
- }
-
- switch ($cat_title) {
- case "tt-rss-prefs":
- $this->opml_import_preference($doc, $node, $owner_uid);
- break;
- case "tt-rss-labels":
- $this->opml_import_label($doc, $node, $owner_uid);
- break;
- case "tt-rss-filters":
- $this->opml_import_filter($doc, $node, $owner_uid);
- break;
- default:
- $this->opml_import_feed($doc, $node, $dst_cat_id, $owner_uid);
- }
- }
- }
- }
- }
-
- function opml_import($owner_uid) {
- if (!$owner_uid) return;
-
- $debug = isset($_REQUEST["debug"]);
- $doc = false;
-
-# if ($debug) $doc = DOMDocument::load("/tmp/test.opml");
-
- if ($_FILES['opml_file']['error'] != 0) {
- print_error(T_sprintf("Upload failed with error code %d",
- $_FILES['opml_file']['error']));
- return;
- }
-
- $tmp_file = false;
-
- if (is_uploaded_file($_FILES['opml_file']['tmp_name'])) {
- $tmp_file = tempnam(CACHE_DIR . '/upload', 'opml');
-
- $result = move_uploaded_file($_FILES['opml_file']['tmp_name'],
- $tmp_file);
-
- if (!$result) {
- print_error(__("Unable to move uploaded file."));
- return;
- }
- } else {
- print_error(__('Error: please upload OPML file.'));
- return;
- }
-
- if (is_file($tmp_file)) {
- $doc = new DOMDocument();
- libxml_disable_entity_loader(false);
- $doc->load($tmp_file);
- libxml_disable_entity_loader(true);
- unlink($tmp_file);
- } else if (!$doc) {
- print_error(__('Error: unable to find moved OPML file.'));
- return;
- }
-
- if ($doc) {
- $this->opml_import_category($doc, false, $owner_uid, false);
- } else {
- print_error(__('Error while parsing document.'));
- }
- }
-
- private function opml_notice($msg) {
- print "$msg
";
- }
-
- static function opml_publish_url(){
-
- $url_path = get_self_url_prefix();
- $url_path .= "/opml.php?op=publish&key=" .
- get_feed_access_key('OPML:Publish', false, $_SESSION["uid"]);
-
- return $url_path;
- }
-
-
-}
-?>
diff --git a/source/classes/plugin.php b/source/classes/plugin.php
deleted file mode 100644
index 8fbacf3..0000000
--- a/source/classes/plugin.php
+++ /dev/null
@@ -1,30 +0,0 @@
-dbh = $host->get_dbh();
- $this->host = $host;
- }
-
- function about() {
- // version, name, description, author, is_system
- return array(1.0, "plugin", "No description", "No author", false);
- }
-
- function get_js() {
- return "";
- }
-
- function get_prefs_js() {
- return "";
- }
-
- function api_version() {
- return Plugin::API_VERSION_COMPAT;
- }
-}
-?>
diff --git a/source/classes/pluginhandler.php b/source/classes/pluginhandler.php
deleted file mode 100644
index 6903051..0000000
--- a/source/classes/pluginhandler.php
+++ /dev/null
@@ -1,22 +0,0 @@
-get_plugin($_REQUEST["plugin"]);
-
- if ($plugin) {
- if (method_exists($plugin, $method)) {
- $plugin->$method();
- } else {
- print json_encode(array("error" => "METHOD_NOT_FOUND"));
- }
- } else {
- print json_encode(array("error" => "PLUGIN_NOT_FOUND"));
- }
- }
-}
-
-?>
diff --git a/source/classes/pluginhost.php b/source/classes/pluginhost.php
deleted file mode 100644
index 1ad7afd..0000000
--- a/source/classes/pluginhost.php
+++ /dev/null
@@ -1,403 +0,0 @@
-dbh = Db::get();
-
- $this->storage = array();
- }
-
- private function __clone() {
- //
- }
-
- public static function getInstance() {
- if (self::$instance == null)
- self::$instance = new self();
-
- return self::$instance;
- }
-
- private function register_plugin($name, $plugin) {
- //array_push($this->plugins, $plugin);
- $this->plugins[$name] = $plugin;
- }
-
- // needed for compatibility with API 1
- function get_link() {
- return false;
- }
-
- function get_dbh() {
- return $this->dbh;
- }
-
- function get_plugin_names() {
- $names = array();
-
- foreach ($this->plugins as $p) {
- array_push($names, get_class($p));
- }
-
- return $names;
- }
-
- function get_plugins() {
- return $this->plugins;
- }
-
- function get_plugin($name) {
- return $this->plugins[$name];
- }
-
- function run_hooks($type, $method, $args) {
- foreach ($this->get_hooks($type) as $hook) {
- $hook->$method($args);
- }
- }
-
- function add_hook($type, $sender) {
- if (!is_array($this->hooks[$type])) {
- $this->hooks[$type] = array();
- }
-
- array_push($this->hooks[$type], $sender);
- }
-
- function del_hook($type, $sender) {
- if (is_array($this->hooks[$type])) {
- $key = array_Search($sender, $this->hooks[$type]);
- if ($key !== FALSE) {
- unset($this->hooks[$type][$key]);
- }
- }
- }
-
- function get_hooks($type) {
- if (isset($this->hooks[$type])) {
- return $this->hooks[$type];
- } else {
- return array();
- }
- }
- function load_all($kind, $owner_uid = false) {
- $plugins = array_map("basename", glob("plugins/*"));
- $this->load(join(",", $plugins), $kind, $owner_uid);
- }
-
- function load($classlist, $kind, $owner_uid = false) {
- $plugins = explode(",", $classlist);
-
- $this->owner_uid = (int) $owner_uid;
-
- foreach ($plugins as $class) {
- $class = trim($class);
- $class_file = strtolower(basename($class));
-
- if (!is_dir(dirname(__FILE__)."/../plugins/$class_file")) continue;
-
- $file = dirname(__FILE__)."/../plugins/$class_file/init.php";
-
- if (!isset($this->plugins[$class])) {
- if (file_exists($file)) require_once $file;
-
- if (class_exists($class) && is_subclass_of($class, "Plugin")) {
- $plugin = new $class($this);
-
- $plugin_api = $plugin->api_version();
-
- if ($plugin_api < PluginHost::API_VERSION) {
- user_error("Plugin $class is not compatible with current API version (need: " . PluginHost::API_VERSION . ", got: $plugin_api)", E_USER_WARNING);
- continue;
- }
-
- $this->last_registered = $class;
-
- switch ($kind) {
- case $this::KIND_SYSTEM:
- if ($this->is_system($plugin)) {
- $plugin->init($this);
- $this->register_plugin($class, $plugin);
- }
- break;
- case $this::KIND_USER:
- if (!$this->is_system($plugin)) {
- $plugin->init($this);
- $this->register_plugin($class, $plugin);
- }
- break;
- case $this::KIND_ALL:
- $plugin->init($this);
- $this->register_plugin($class, $plugin);
- break;
- }
- }
- }
- }
- }
-
- function is_system($plugin) {
- $about = $plugin->about();
-
- return @$about[3];
- }
-
- // only system plugins are allowed to modify routing
- function add_handler($handler, $method, $sender) {
- $handler = str_replace("-", "_", strtolower($handler));
- $method = strtolower($method);
-
- if ($this->is_system($sender)) {
- if (!is_array($this->handlers[$handler])) {
- $this->handlers[$handler] = array();
- }
-
- $this->handlers[$handler][$method] = $sender;
- }
- }
-
- function del_handler($handler, $method, $sender) {
- $handler = str_replace("-", "_", strtolower($handler));
- $method = strtolower($method);
-
- if ($this->is_system($sender)) {
- unset($this->handlers[$handler][$method]);
- }
- }
-
- function lookup_handler($handler, $method) {
- $handler = str_replace("-", "_", strtolower($handler));
- $method = strtolower($method);
-
- if (is_array($this->handlers[$handler])) {
- if (isset($this->handlers[$handler]["*"])) {
- return $this->handlers[$handler]["*"];
- } else {
- return $this->handlers[$handler][$method];
- }
- }
-
- return false;
- }
-
- function add_command($command, $description, $sender, $suffix = "", $arghelp = "") {
- $command = str_replace("-", "_", strtolower($command));
-
- $this->commands[$command] = array("description" => $description,
- "suffix" => $suffix,
- "arghelp" => $arghelp,
- "class" => $sender);
- }
-
- function del_command($command) {
- $command = "-" . strtolower($command);
-
- unset($this->commands[$command]);
- }
-
- function lookup_command($command) {
- $command = "-" . strtolower($command);
-
- if (is_array($this->commands[$command])) {
- return $this->commands[$command]["class"];
- } else {
- return false;
- }
-
- return false;
- }
-
- function get_commands() {
- return $this->commands;
- }
-
- function run_commands($args) {
- foreach ($this->get_commands() as $command => $data) {
- if (isset($args[$command])) {
- $command = str_replace("-", "", $command);
- $data["class"]->$command($args);
- }
- }
- }
-
- function load_data($force = false) {
- if ($this->owner_uid) {
- $result = $this->dbh->query("SELECT name, content FROM ttrss_plugin_storage
- WHERE owner_uid = '".$this->owner_uid."'");
-
- while ($line = $this->dbh->fetch_assoc($result)) {
- $this->storage[$line["name"]] = unserialize($line["content"]);
- }
- }
- }
-
- private function save_data($plugin) {
- if ($this->owner_uid) {
- $plugin = $this->dbh->escape_string($plugin);
-
- $this->dbh->query("BEGIN");
-
- $result = $this->dbh->query("SELECT id FROM ttrss_plugin_storage WHERE
- owner_uid= '".$this->owner_uid."' AND name = '$plugin'");
-
- if (!isset($this->storage[$plugin]))
- $this->storage[$plugin] = array();
-
- $content = $this->dbh->escape_string(serialize($this->storage[$plugin]),
- false);
-
- if ($this->dbh->num_rows($result) != 0) {
- $this->dbh->query("UPDATE ttrss_plugin_storage SET content = '$content'
- WHERE owner_uid= '".$this->owner_uid."' AND name = '$plugin'");
-
- } else {
- $this->dbh->query("INSERT INTO ttrss_plugin_storage
- (name,owner_uid,content) VALUES
- ('$plugin','".$this->owner_uid."','$content')");
- }
-
- $this->dbh->query("COMMIT");
- }
- }
-
- function set($sender, $name, $value, $sync = true) {
- $idx = get_class($sender);
-
- if (!isset($this->storage[$idx]))
- $this->storage[$idx] = array();
-
- $this->storage[$idx][$name] = $value;
-
- if ($sync) $this->save_data(get_class($sender));
- }
-
- function get($sender, $name, $default_value = false) {
- $idx = get_class($sender);
-
- if (isset($this->storage[$idx][$name])) {
- return $this->storage[$idx][$name];
- } else {
- return $default_value;
- }
- }
-
- function get_all($sender) {
- $idx = get_class($sender);
-
- return $this->storage[$idx];
- }
-
- function clear_data($sender) {
- if ($this->owner_uid) {
- $idx = get_class($sender);
-
- unset($this->storage[$idx]);
-
- $this->dbh->query("DELETE FROM ttrss_plugin_storage WHERE name = '$idx'
- AND owner_uid = " . $this->owner_uid);
- }
- }
-
- function set_debug($debug) {
- $this->debug = $debug;
- }
-
- function get_debug() {
- return $this->debug;
- }
-
- // Plugin feed functions are *EXPERIMENTAL*!
-
- // cat_id: only -1 is supported (Special)
- function add_feed($cat_id, $title, $icon, $sender) {
- if (!$this->feeds[$cat_id]) $this->feeds[$cat_id] = array();
-
- $id = count($this->feeds[$cat_id]);
-
- array_push($this->feeds[$cat_id],
- array('id' => $id, 'title' => $title, 'sender' => $sender, 'icon' => $icon));
-
- return $id;
- }
-
- function get_feeds($cat_id) {
- return $this->feeds[$cat_id];
- }
-
- // convert feed_id (e.g. -129) to pfeed_id first
- function get_feed_handler($pfeed_id) {
- foreach ($this->feeds as $cat) {
- foreach ($cat as $feed) {
- if ($feed['id'] == $pfeed_id) {
- return $feed['sender'];
- }
- }
- }
- }
-
- static function pfeed_to_feed_id($label) {
- return PLUGIN_FEED_BASE_INDEX - 1 - abs($label);
- }
-
- static function feed_to_pfeed_id($feed) {
- return PLUGIN_FEED_BASE_INDEX - 1 + abs($feed);
- }
-
- function add_api_method($name, $sender) {
- if ($this->is_system($sender)) {
- $this->api_methods[strtolower($name)] = $sender;
- }
- }
-
- function get_api_method($name) {
- return $this->api_methods[$name];
- }
-}
-?>
diff --git a/source/classes/pref/feeds.php b/source/classes/pref/feeds.php
deleted file mode 100644
index d70c1a2..0000000
--- a/source/classes/pref/feeds.php
+++ /dev/null
@@ -1,1930 +0,0 @@
-";
- }
-
- function renamecat() {
- $title = $this->dbh->escape_string($_REQUEST['title']);
- $id = $this->dbh->escape_string($_REQUEST['id']);
-
- if ($title) {
- $this->dbh->query("UPDATE ttrss_feed_categories SET
- title = '$title' WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]);
- }
- return;
- }
-
- private function get_category_items($cat_id) {
-
- if ($_REQUEST['mode'] != 2)
- $search = $_SESSION["prefs_feed_search"];
- else
- $search = "";
-
- if ($search) $search_qpart = " AND LOWER(title) LIKE LOWER('%$search%')";
-
- // first one is set by API
- $show_empty_cats = $_REQUEST['force_show_empty'] ||
- ($_REQUEST['mode'] != 2 && !$search);
-
- $items = array();
-
- $result = $this->dbh->query("SELECT id, title FROM ttrss_feed_categories
- WHERE owner_uid = " . $_SESSION["uid"] . " AND parent_cat = '$cat_id' ORDER BY order_id, title");
-
- while ($line = $this->dbh->fetch_assoc($result)) {
-
- $cat = array();
- $cat['id'] = 'CAT:' . $line['id'];
- $cat['bare_id'] = (int)$line['id'];
- $cat['name'] = $line['title'];
- $cat['items'] = array();
- $cat['checkbox'] = false;
- $cat['type'] = 'category';
- $cat['unread'] = 0;
- $cat['child_unread'] = 0;
- $cat['auxcounter'] = 0;
- $cat['parent_id'] = $cat_id;
-
- $cat['items'] = $this->get_category_items($line['id']);
-
- $num_children = $this->calculate_children_count($cat);
- $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', $num_children), $num_children);
-
- if ($num_children > 0 || $show_empty_cats)
- array_push($items, $cat);
-
- }
-
- $feed_result = $this->dbh->query("SELECT id, title, last_error,
- ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
- FROM ttrss_feeds
- WHERE cat_id = '$cat_id' AND owner_uid = ".$_SESSION["uid"].
- "$search_qpart ORDER BY order_id, title");
-
- while ($feed_line = $this->dbh->fetch_assoc($feed_result)) {
- $feed = array();
- $feed['id'] = 'FEED:' . $feed_line['id'];
- $feed['bare_id'] = (int)$feed_line['id'];
- $feed['auxcounter'] = 0;
- $feed['name'] = $feed_line['title'];
- $feed['checkbox'] = false;
- $feed['unread'] = 0;
- $feed['error'] = $feed_line['last_error'];
- $feed['icon'] = getFeedIcon($feed_line['id']);
- $feed['param'] = make_local_datetime(
- $feed_line['last_updated'], true);
-
- array_push($items, $feed);
- }
-
- return $items;
- }
-
- function getfeedtree() {
- print json_encode($this->makefeedtree());
- }
-
- function makefeedtree() {
-
- if ($_REQUEST['mode'] != 2)
- $search = $_SESSION["prefs_feed_search"];
- else
- $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';
-
- $enable_cats = get_pref('ENABLE_FEED_CATS');
-
- if ($_REQUEST['mode'] == 2) {
-
- if ($enable_cats) {
- $cat = $this->feedlist_init_cat(-1);
- } else {
- $cat['items'] = array();
- }
-
- foreach (array(-4, -3, -1, -2, 0, -6) as $i) {
- array_push($cat['items'], $this->feedlist_init_feed($i));
- }
-
- /* Plugin feeds for -1 */
-
- $feeds = PluginHost::getInstance()->get_feeds(-1);
-
- if ($feeds) {
- foreach ($feeds as $feed) {
- $feed_id = PluginHost::pfeed_to_feed_id($feed['id']);
-
- $item = array();
- $item['id'] = 'FEED:' . $feed_id;
- $item['bare_id'] = (int)$feed_id;
- $item['auxcounter'] = 0;
- $item['name'] = $feed['title'];
- $item['checkbox'] = false;
- $item['error'] = '';
- $item['icon'] = $feed['icon'];
-
- $item['param'] = '';
- $item['unread'] = 0; //$feed['sender']->get_unread($feed['id']);
- $item['type'] = 'feed';
-
- array_push($cat['items'], $item);
- }
- }
-
- if ($enable_cats) {
- array_push($root['items'], $cat);
- } else {
- $root['items'] = array_merge($root['items'], $cat['items']);
- }
-
- $result = $this->dbh->query("SELECT * FROM
- ttrss_labels2 WHERE owner_uid = ".$_SESSION['uid']." ORDER by caption");
-
- if ($this->dbh->num_rows($result) > 0) {
-
- if (get_pref('ENABLE_FEED_CATS')) {
- $cat = $this->feedlist_init_cat(-2);
- } else {
- $cat['items'] = array();
- }
-
- while ($line = $this->dbh->fetch_assoc($result)) {
-
- $label_id = label_to_feed_id($line['id']);
-
- $feed = $this->feedlist_init_feed($label_id, false, 0);
-
- $feed['fg_color'] = $line['fg_color'];
- $feed['bg_color'] = $line['bg_color'];
-
- array_push($cat['items'], $feed);
- }
-
- if ($enable_cats) {
- array_push($root['items'], $cat);
- } else {
- $root['items'] = array_merge($root['items'], $cat['items']);
- }
- }
- }
-
- if ($enable_cats) {
- $show_empty_cats = $_REQUEST['force_show_empty'] ||
- ($_REQUEST['mode'] != 2 && !$search);
-
- $result = $this->dbh->query("SELECT id, title FROM ttrss_feed_categories
- WHERE owner_uid = " . $_SESSION["uid"] . " AND parent_cat IS NULL ORDER BY order_id, title");
-
- while ($line = $this->dbh->fetch_assoc($result)) {
- $cat = array();
- $cat['id'] = 'CAT:' . $line['id'];
- $cat['bare_id'] = (int)$line['id'];
- $cat['auxcounter'] = 0;
- $cat['name'] = $line['title'];
- $cat['items'] = array();
- $cat['checkbox'] = false;
- $cat['type'] = 'category';
- $cat['unread'] = 0;
- $cat['child_unread'] = 0;
-
- $cat['items'] = $this->get_category_items($line['id']);
-
- $num_children = $this->calculate_children_count($cat);
- $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', $num_children), $num_children);
-
- if ($num_children > 0 || $show_empty_cats)
- 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['auxcounter'] = 0;
- $cat['name'] = __("Uncategorized");
- $cat['items'] = array();
- $cat['type'] = 'category';
- $cat['checkbox'] = false;
- $cat['unread'] = 0;
- $cat['child_unread'] = 0;
-
- $feed_result = $this->dbh->query("SELECT id, title,last_error,
- ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
- FROM ttrss_feeds
- WHERE cat_id IS NULL AND owner_uid = ".$_SESSION["uid"].
- "$search_qpart ORDER BY order_id, title");
-
- while ($feed_line = $this->dbh->fetch_assoc($feed_result)) {
- $feed = array();
- $feed['id'] = 'FEED:' . $feed_line['id'];
- $feed['bare_id'] = (int)$feed_line['id'];
- $feed['auxcounter'] = 0;
- $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(
- $feed_line['last_updated'], true);
- $feed['unread'] = 0;
- $feed['type'] = 'feed';
-
- array_push($cat['items'], $feed);
- }
-
- $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
-
- if (count($cat['items']) > 0 || $show_empty_cats)
- array_push($root['items'], $cat);
-
- $num_children = $this->calculate_children_count($root);
- $root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', $num_children), $num_children);
-
- } else {
- $feed_result = $this->dbh->query("SELECT id, title, last_error,
- ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
- FROM ttrss_feeds
- WHERE owner_uid = ".$_SESSION["uid"].
- "$search_qpart ORDER BY order_id, title");
-
- while ($feed_line = $this->dbh->fetch_assoc($feed_result)) {
- $feed = array();
- $feed['id'] = 'FEED:' . $feed_line['id'];
- $feed['bare_id'] = (int)$feed_line['id'];
- $feed['auxcounter'] = 0;
- $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(
- $feed_line['last_updated'], true);
- $feed['unread'] = 0;
- $feed['type'] = 'feed';
-
- array_push($root['items'], $feed);
- }
-
- $root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
- }
-
- $fl = array();
- $fl['identifier'] = 'id';
- $fl['label'] = 'name';
-
- if ($_REQUEST['mode'] != 2) {
- $fl['items'] = array($root);
- } else {
- $fl['items'] =& $root['items'];
- }
-
- return $fl;
- }
-
- function catsortreset() {
- $this->dbh->query("UPDATE ttrss_feed_categories
- SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]);
- return;
- }
-
- function feedsortreset() {
- $this->dbh->query("UPDATE ttrss_feeds
- SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]);
- return;
- }
-
- private function process_category_order(&$data_map, $item_id, $parent_id = false, $nest_level = 0) {
- $debug = isset($_REQUEST["debug"]);
-
- $prefix = "";
- for ($i = 0; $i < $nest_level; $i++)
- $prefix .= " ";
-
- if ($debug) _debug("$prefix C: $item_id P: $parent_id");
-
- $bare_item_id = substr($item_id, strpos($item_id, ':')+1);
-
- if ($item_id != 'root') {
- if ($parent_id && $parent_id != 'root') {
- $parent_bare_id = substr($parent_id, strpos($parent_id, ':')+1);
- $parent_qpart = $this->dbh->escape_string($parent_bare_id);
- } else {
- $parent_qpart = 'NULL';
- }
-
- $this->dbh->query("UPDATE ttrss_feed_categories
- SET parent_cat = $parent_qpart WHERE id = '$bare_item_id' AND
- owner_uid = " . $_SESSION["uid"]);
- }
-
- $order_id = 0;
-
- $cat = $data_map[$item_id];
-
- if ($cat && is_array($cat)) {
- foreach ($cat as $item) {
- $id = $item['_reference'];
- $bare_id = substr($id, strpos($id, ':')+1);
-
- if ($debug) _debug("$prefix [$order_id] $id/$bare_id");
-
- if ($item['_reference']) {
-
- if (strpos($id, "FEED") === 0) {
-
- $cat_id = ($item_id != "root") ?
- $this->dbh->escape_string($bare_item_id) : "NULL";
-
- $cat_qpart = ($cat_id != 0) ? "cat_id = '$cat_id'" :
- "cat_id = NULL";
-
- $this->dbh->query("UPDATE ttrss_feeds
- SET order_id = $order_id, $cat_qpart
- WHERE id = '$bare_id' AND
- owner_uid = " . $_SESSION["uid"]);
-
- } else if (strpos($id, "CAT:") === 0) {
- $this->process_category_order($data_map, $item['_reference'], $item_id,
- $nest_level+1);
-
- if ($item_id != 'root') {
- $parent_qpart = $this->dbh->escape_string($bare_id);
- } else {
- $parent_qpart = 'NULL';
- }
-
- $this->dbh->query("UPDATE ttrss_feed_categories
- SET order_id = '$order_id' WHERE id = '$bare_id' AND
- owner_uid = " . $_SESSION["uid"]);
- }
- }
-
- ++$order_id;
- }
- }
- }
-
- function savefeedorder() {
- $data = json_decode($_POST['payload'], true);
-
- #file_put_contents("/tmp/saveorder.json", $_POST['payload']);
- #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true);
-
- if (!is_array($data['items']))
- $data['items'] = json_decode($data['items'], true);
-
-# print_r($data['items']);
-
- if (is_array($data) && is_array($data['items'])) {
-# $cat_order_id = 0;
-
- $data_map = array();
- $root_item = false;
-
- 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'];
- }
- }
- if ($item['id'] == 'root') {
- $root_item = $item['id'];
- }
- }
-
- $this->process_category_order($data_map, $root_item);
-
- /* foreach ($data['items'][0]['items'] as $item) {
- $id = $item['_reference'];
- $bare_id = substr($id, strpos($id, ':')+1);
-
- ++$cat_order_id;
-
- if ($bare_id > 0) {
- $this->dbh->query("UPDATE ttrss_feed_categories
- SET order_id = '$cat_order_id' WHERE id = '$bare_id' AND
- owner_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";
-
- $this->dbh->query("UPDATE ttrss_feeds
- SET order_id = '$feed_order_id',
- $cat_query
- WHERE id = '$feed_id' AND
- owner_uid = " . $_SESSION["uid"]);
-
- ++$feed_order_id;
- }
- }
- } */
- }
-
- return;
- }
-
- function removeicon() {
- $feed_id = $this->dbh->escape_string($_REQUEST["feed_id"]);
-
- $result = $this->dbh->query("SELECT id FROM ttrss_feeds
- WHERE id = '$feed_id' AND owner_uid = ". $_SESSION["uid"]);
-
- if ($this->dbh->num_rows($result) != 0) {
- @unlink(ICONS_DIR . "/$feed_id.ico");
-
- $this->dbh->query("UPDATE ttrss_feeds SET favicon_avg_color = NULL
- where id = '$feed_id'");
- }
-
- return;
- }
-
- function uploadicon() {
- header("Content-type: text/html");
-
- $tmp_file = false;
-
- if (is_uploaded_file($_FILES['icon_file']['tmp_name'])) {
- $tmp_file = tempnam(CACHE_DIR . '/upload', 'icon');
-
- $result = move_uploaded_file($_FILES['icon_file']['tmp_name'],
- $tmp_file);
-
- if (!$result) {
- return;
- }
- } else {
- return;
- }
-
- $icon_file = $tmp_file;
- $feed_id = $this->dbh->escape_string($_REQUEST["feed_id"]);
-
- if (is_file($icon_file) && $feed_id) {
- if (filesize($icon_file) < 65535) {
-
- $result = $this->dbh->query("SELECT id FROM ttrss_feeds
- WHERE id = '$feed_id' AND owner_uid = ". $_SESSION["uid"]);
-
- if ($this->dbh->num_rows($result) != 0) {
- @unlink(ICONS_DIR . "/$feed_id.ico");
- if (rename($icon_file, ICONS_DIR . "/$feed_id.ico")) {
- $this->dbh->query("UPDATE ttrss_feeds SET
- favicon_avg_color = ''
- WHERE id = '$feed_id'");
-
- $rc = 0;
- }
- } else {
- $rc = 2;
- }
- } else {
- $rc = 1;
- }
- } else {
- $rc = 2;
- }
-
- @unlink($icon_file);
-
- print "";
- return;
- }
-
- function editfeed() {
- global $purge_intervals;
- global $update_intervals;
-
- $feed_id = $this->dbh->escape_string($_REQUEST["id"]);
-
- $result = $this->dbh->query(
- "SELECT * FROM ttrss_feeds WHERE id = '$feed_id' AND
- owner_uid = " . $_SESSION["uid"]);
-
- $auth_pass_encrypted = sql_bool_to_bool($this->dbh->fetch_result($result, 0,
- "auth_pass_encrypted"));
-
- $title = htmlspecialchars($this->dbh->fetch_result($result,
- 0, "title"));
-
- print "
";
- print "
";
- print "
";
-
- print "
".__("Feed")."
";
- print "
";
-
- /* Title */
-
- print "
";
-
- /* Feed URL */
-
- $feed_url = $this->dbh->fetch_result($result, 0, "feed_url");
- $feed_url = htmlspecialchars($this->dbh->fetch_result($result,
- 0, "feed_url"));
-
- print "
";
-
- print __('URL:') . " ";
- print "
";
-
- $last_error = $this->dbh->fetch_result($result, 0, "last_error");
-
- if ($last_error) {
- print "
";
-
- }
-
- /* Category */
-
- if (get_pref('ENABLE_FEED_CATS')) {
-
- $cat_id = $this->dbh->fetch_result($result, 0, "cat_id");
-
- print "
";
-
- print __('Place in category:') . " ";
-
- print_feed_cat_select("cat_id", $cat_id,
- 'dojoType="dijit.form.Select"');
- }
-
- print "
";
-
- print "
".__("Update")."
";
- print "
";
-
- /* Update Interval */
-
- $update_interval = $this->dbh->fetch_result($result, 0, "update_interval");
-
- print_select_hash("update_interval", $update_interval, $update_intervals,
- 'dojoType="dijit.form.Select"');
-
- /* Purge intl */
-
- $purge_interval = $this->dbh->fetch_result($result, 0, "purge_interval");
-
- print "
";
- print __('Article purging:') . " ";
-
- print_select_hash("purge_interval", $purge_interval, $purge_intervals,
- 'dojoType="dijit.form.Select" ' .
- ((FORCE_ARTICLE_PURGE == 0) ? "" : 'disabled="1"'));
-
- print "";
- print "
".__("Authentication")."
";
- print "
";
- print "
".__("Options")."
";
- print "
";
-
- $private = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "private"));
-
- if ($private) {
- $checked = "checked=\"1\"";
- } else {
- $checked = "";
- }
-
- print " ".__('Hide from Popular feeds')." ";
-
- $include_in_digest = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "include_in_digest"));
-
- if ($include_in_digest) {
- $checked = "checked=\"1\"";
- } else {
- $checked = "";
- }
-
- print "
".__('Include in e-mail digest')." ";
-
-
- $always_display_enclosures = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "always_display_enclosures"));
-
- if ($always_display_enclosures) {
- $checked = "checked";
- } else {
- $checked = "";
- }
-
- print " ".__('Always display image attachments')." ";
-
- $hide_images = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "hide_images"));
-
- if ($hide_images) {
- $checked = "checked=\"1\"";
- } else {
- $checked = "";
- }
-
- print " ".
- __('Do not embed images')." ";
-
- $cache_images = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "cache_images"));
-
- if ($cache_images) {
- $checked = "checked=\"1\"";
- } else {
- $checked = "";
- }
-
- print " ".
- __('Cache images locally')." ";
-
- $mark_unread_on_update = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "mark_unread_on_update"));
-
- if ($mark_unread_on_update) {
- $checked = "checked";
- } else {
- $checked = "";
- }
-
- print " ".__('Mark updated articles as unread')." ";
-
- print "";
-
- /* Icon */
-
- print "
".__("Icon")."
";
- print "
";
-
- print "";
-
- print "";
-
- print "
";
-
- PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_EDIT_FEED,
- "hook_prefs_edit_feed", $feed_id);
-
- $title = htmlspecialchars($title, ENT_QUOTES);
-
- print "
";
-
- return;
- }
-
- function editfeeds() {
- global $purge_intervals;
- global $update_intervals;
-
- $feed_ids = $this->dbh->escape_string($_REQUEST["ids"]);
-
- print_notice("Enable the options you wish to apply using checkboxes on the right:");
-
- print "
";
-
- print " ";
- print " ";
- print " ";
-
- print "
".__("Feed")."
";
- print "
";
-
- /* Category */
-
- if (get_pref('ENABLE_FEED_CATS')) {
-
- print __('Place in category:') . " ";
-
- print_feed_cat_select("cat_id", false,
- 'disabled="1" dojoType="dijit.form.Select"');
-
- $this->batch_edit_cbox("cat_id");
-
- }
-
- print "
";
-
- print "
".__("Update")."
";
- print "
";
-
- /* Update Interval */
-
- print_select_hash("update_interval", "", $update_intervals,
- 'disabled="1" dojoType="dijit.form.Select"');
-
- $this->batch_edit_cbox("update_interval");
-
- /* Purge intl */
-
- if (FORCE_ARTICLE_PURGE == 0) {
-
- print " ";
-
- print __('Article purging:') . " ";
-
- print_select_hash("purge_interval", "", $purge_intervals,
- 'disabled="1" dojoType="dijit.form.Select"');
-
- $this->batch_edit_cbox("purge_interval");
- }
-
- print "
";
- print "
".__("Authentication")."
";
- print "
";
-
- print " ";
-
- $this->batch_edit_cbox("auth_login");
-
- print "
";
-
- $this->batch_edit_cbox("auth_pass");
-
- print "";
- print "
".__("Options")."
";
- print "
";
-
- print " ".__('Hide from Popular feeds')." ";
-
- print " "; $this->batch_edit_cbox("private", "private_l");
-
- print " ".__('Include in e-mail digest')." ";
-
- print " "; $this->batch_edit_cbox("include_in_digest", "include_in_digest_l");
-
- print " ".__('Always display image attachments')." ";
-
- print " "; $this->batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l");
-
- print " ".
- __('Do not embed images')." ";
-
- print " "; $this->batch_edit_cbox("hide_images", "hide_images_l");
-
- print " ".
- __('Cache images locally')." ";
-
- print " "; $this->batch_edit_cbox("cache_images", "cache_images_l");
-
- print " ".__('Mark updated articles as unread')." ";
-
- print " "; $this->batch_edit_cbox("mark_unread_on_update", "mark_unread_on_update_l");
-
- print "
";
-
- print "
- ".
- __('Save')."
- ".
- __('Cancel')."
-
";
-
- return;
- }
-
- function batchEditSave() {
- return $this->editsaveops(true);
- }
-
- function editSave() {
- return $this->editsaveops(false);
- }
-
- function editsaveops($batch) {
-
- $feed_title = $this->dbh->escape_string(trim($_POST["title"]));
- $feed_link = $this->dbh->escape_string(trim($_POST["feed_url"]));
- $upd_intl = (int) $this->dbh->escape_string($_POST["update_interval"]);
- $purge_intl = (int) $this->dbh->escape_string($_POST["purge_interval"]);
- $feed_id = (int) $this->dbh->escape_string($_POST["id"]); /* editSave */
- $feed_ids = $this->dbh->escape_string($_POST["ids"]); /* batchEditSave */
- $cat_id = (int) $this->dbh->escape_string($_POST["cat_id"]);
- $auth_login = $this->dbh->escape_string(trim($_POST["auth_login"]));
- $auth_pass = trim($_POST["auth_pass"]);
- $private = checkbox_to_sql_bool($this->dbh->escape_string($_POST["private"]));
- $include_in_digest = checkbox_to_sql_bool(
- $this->dbh->escape_string($_POST["include_in_digest"]));
- $cache_images = checkbox_to_sql_bool(
- $this->dbh->escape_string($_POST["cache_images"]));
- $hide_images = checkbox_to_sql_bool(
- $this->dbh->escape_string($_POST["hide_images"]));
- $always_display_enclosures = checkbox_to_sql_bool(
- $this->dbh->escape_string($_POST["always_display_enclosures"]));
-
- $mark_unread_on_update = checkbox_to_sql_bool(
- $this->dbh->escape_string($_POST["mark_unread_on_update"]));
-
- 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 = $this->dbh->escape_string($auth_pass);
-
- if (get_pref('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 (!$batch) {
-
- $this->dbh->query("UPDATE ttrss_feeds SET
- $category_qpart
- title = '$feed_title', feed_url = '$feed_link',
- update_interval = '$upd_intl',
- purge_interval = '$purge_intl',
- auth_login = '$auth_login',
- auth_pass = '$auth_pass',
- auth_pass_encrypted = $auth_pass_encrypted,
- private = $private,
- cache_images = $cache_images,
- hide_images = $hide_images,
- include_in_digest = $include_in_digest,
- always_display_enclosures = $always_display_enclosures,
- mark_unread_on_update = $mark_unread_on_update
- WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
-
- PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_SAVE_FEED,
- "hook_prefs_save_feed", $feed_id);
-
- } else {
- $feed_data = array();
-
- foreach (array_keys($_POST) as $k) {
- if ($k != "op" && $k != "method" && $k != "ids") {
- $feed_data[$k] = $_POST[$k];
- }
- }
-
- $this->dbh->query("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 = '$auth_login'";
- break;
-
- case "auth_pass":
- $qpart = "auth_pass = '$auth_pass' AND
- auth_pass_encrypted = $auth_pass_encrypted";
- 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 "cache_images":
- $qpart = "cache_images = $cache_images";
- break;
-
- case "hide_images":
- $qpart = "hide_images = $hide_images";
- break;
-
- case "cat_id":
- $qpart = $category_qpart_nocomma;
- break;
-
- }
-
- if ($qpart) {
- $this->dbh->query(
- "UPDATE ttrss_feeds SET $qpart WHERE id IN ($feed_ids)
- AND owner_uid = " . $_SESSION["uid"]);
- print "
";
- }
- }
-
- $this->dbh->query("COMMIT");
- }
- return;
- }
-
- function resetPubSub() {
-
- $ids = $this->dbh->escape_string($_REQUEST["ids"]);
-
- $this->dbh->query("UPDATE ttrss_feeds SET pubsub_state = 0 WHERE id IN ($ids)
- AND owner_uid = " . $_SESSION["uid"]);
-
- return;
- }
-
- function remove() {
-
- $ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
-
- foreach ($ids as $id) {
- Pref_Feeds::remove_feed($id, $_SESSION["uid"]);
- }
-
- return;
- }
-
- function clear() {
- $id = $this->dbh->escape_string($_REQUEST["id"]);
- $this->clear_feed_articles($id);
- }
-
- function rescore() {
- require_once "rssfuncs.php";
-
- $ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
-
- foreach ($ids as $id) {
-
- $filters = load_filters($id, $_SESSION["uid"], 6);
-
- $result = $this->dbh->query("SELECT
- title, content, link, ref_id, author,".
- SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated
- FROM
- ttrss_user_entries, ttrss_entries
- WHERE ref_id = id AND feed_id = '$id' AND
- owner_uid = " .$_SESSION['uid']."
- ");
-
- $scores = array();
-
- while ($line = $this->dbh->fetch_assoc($result)) {
-
- $tags = get_article_tags($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) {
- $this->dbh->query("UPDATE ttrss_user_entries SET score = '$s',
- marked = true WHERE
- ref_id IN (" . join(',', $scores[$s]) . ")");
- } else if ($s < -500) {
- $this->dbh->query("UPDATE ttrss_user_entries SET score = '$s',
- unread = false WHERE
- ref_id IN (" . join(',', $scores[$s]) . ")");
- } else {
- $this->dbh->query("UPDATE ttrss_user_entries SET score = '$s' WHERE
- ref_id IN (" . join(',', $scores[$s]) . ")");
- }
- }
- }
-
- print __("All done.");
-
- }
-
- function rescoreAll() {
-
- $result = $this->dbh->query(
- "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']);
-
- while ($feed_line = $this->dbh->fetch_assoc($result)) {
-
- $id = $feed_line["id"];
-
- $filters = load_filters($id, $_SESSION["uid"], 6);
-
- $tmp_result = $this->dbh->query("SELECT
- title, content, link, ref_id, author,".
- SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated
- FROM
- ttrss_user_entries, ttrss_entries
- WHERE ref_id = id AND feed_id = '$id' AND
- owner_uid = " .$_SESSION['uid']."
- ");
-
- $scores = array();
-
- while ($line = $this->dbh->fetch_assoc($tmp_result)) {
-
- $tags = get_article_tags($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) {
- $this->dbh->query("UPDATE ttrss_user_entries SET score = '$s',
- marked = true WHERE
- ref_id IN (" . join(',', $scores[$s]) . ")");
- } else {
- $this->dbh->query("UPDATE ttrss_user_entries SET score = '$s' WHERE
- ref_id IN (" . join(',', $scores[$s]) . ")");
- }
- }
- }
-
- print __("All done.");
-
- }
-
- function categorize() {
- $ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
-
- $cat_id = $this->dbh->escape_string($_REQUEST["cat_id"]);
-
- if ($cat_id == 0) {
- $cat_id_qpart = 'NULL';
- } else {
- $cat_id_qpart = "'$cat_id'";
- }
-
- $this->dbh->query("BEGIN");
-
- foreach ($ids as $id) {
-
- $this->dbh->query("UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
- WHERE id = '$id'
- AND owner_uid = " . $_SESSION["uid"]);
-
- }
-
- $this->dbh->query("COMMIT");
- }
-
- function removeCat() {
- $ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
- foreach ($ids as $id) {
- $this->remove_feed_category($id, $_SESSION["uid"]);
- }
- }
-
- function addCat() {
- $feed_cat = $this->dbh->escape_string(trim($_REQUEST["cat"]));
-
- add_feed_category($feed_cat);
- }
-
- function index() {
-
- print "
";
- print "
";
-
- $result = $this->dbh->query("SELECT COUNT(id) AS num_errors
- FROM 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 = "
" .
- __("Feeds with errors") . " ";
- }
-
- if (DB_TYPE == "pgsql") {
- $interval_qpart = "NOW() - INTERVAL '3 months'";
- } else {
- $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)";
- }
-
- // could be performance-intensive and prevent feeds pref-panel from showing
- if (!defined('_DISABLE_INACTIVE_FEEDS') || !_DISABLE_INACTIVE_FEEDS) {
- $result = $this->dbh->query("SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE
- (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
- ttrss_entries.id = ref_id AND
- ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart AND
- ttrss_feeds.owner_uid = ".$_SESSION["uid"]);
-
- $num_inactive = $this->dbh->fetch_result($result, 0, "num_inactive");
- } else {
- $num_inactive = 0;
- }
-
- if ($num_inactive > 0) {
- $inactive_button = "
" .
- __("Inactive feeds") . " ";
- }
-
- $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 '
';
-
- print "
"; #toolbar
-
- print "
-
- ".
- __('Search')."
-
";
-
- print "
".
- "
" . __('Select')." ";
- print "
";
- print "
".__('All')."
";
- print "
".__('None')."
";
- print "
";
-
- print "
".
- "
" . __('Feeds')." ";
- print "
";
- print "
".__('Subscribe to feed')."
";
- print "
".__('Edit selected feeds')."
";
- print "
".__('Reset sort order')."
";
- print "
".__('Batch subscribe')."
";
- print "
"
- .__('Unsubscribe')."
";
- print "
";
-
- if (get_pref('ENABLE_FEED_CATS')) {
- print "
".
- "
" . __('Categories')." ";
- print "
";
- print "
".__('Add category')."
";
- print "
".__('Reset sort order')."
";
- print "
".__('Remove selected')."
";
- print "
";
-
- }
-
- print $error_button;
- print $inactive_button;
-
- if (defined('_ENABLE_FEED_DEBUGGING')) {
-
- print "
- ".__('More actions...')." ";
-
- if (FORCE_ARTICLE_PURGE == 0) {
- print
- "".__('Manual purge')." ";
- }
-
- print "
- ".__('Clear feed data')."
- ".__('Rescore articles')." ";
-
- print " ";
-
- }
-
- print "
"; # toolbar
-
- //print '
';
- print '
';
-
- print "
-
".
- __("Loading, please wait...")."
";
-
- print "
-
-
-
-
-
-
-
";
-
-# print "
-# ".__('Hint: you can drag feeds and categories around.')."
-#
";
-
- print '
';
- print '
';
-
- print "
"; # feeds pane
-
- print "
";
-
- print_notice(__("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."));
-
- print "
";
-
- print "
";
-
- print "
";
-
- print "
".__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . " ";
-
- print __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") . "
";
-
- print "
".
- __('Display published OPML URL')." ";
-
- PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
- "hook_prefs_tab_section", "prefFeedsOPML");
-
- print "
"; # pane
-
- if (strpos($_SERVER['HTTP_USER_AGENT'], "Firefox") !== false) {
-
- print "
";
-
- print_notice(__('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.'));
-
- print "
";
-
- print "" .
- __('Click here to register this site as a feed reader.') .
- " ";
-
- print "
";
-
- print "
"; # pane
- }
-
- print "
";
-
- print_notice(__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.'));
-
- $rss_url = '-2::' . htmlspecialchars(get_self_url_prefix() .
- "/public.php?op=rss&id=-2&view-mode=all_articles");;
-
- print "
";
-
- print "".
- __('Display URL')." ";
-
- print "".
- __('Clear all generated URLs')." ";
-
- print "
";
-
- PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
- "hook_prefs_tab_section", "prefFeedsPublishedGenerated");
-
- print "
"; #pane
-
- PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB,
- "hook_prefs_tab", "prefFeeds");
-
- print "
"; #container
- }
-
- private function feedlist_init_cat($cat_id) {
- $obj = array();
- $cat_id = (int) $cat_id;
-
- if ($cat_id > 0) {
- $cat_unread = ccache_find($cat_id, $_SESSION["uid"], true);
- } else if ($cat_id == 0 || $cat_id == -2) {
- $cat_unread = getCategoryUnread($cat_id);
- }
-
- $obj['id'] = 'CAT:' . $cat_id;
- $obj['items'] = array();
- $obj['name'] = getCategoryTitle($cat_id);
- $obj['type'] = 'category';
- $obj['unread'] = (int) $cat_unread;
- $obj['bare_id'] = $cat_id;
-
- return $obj;
- }
-
- private function feedlist_init_feed($feed_id, $title = false, $unread = false, $error = '', $updated = '') {
- $obj = array();
- $feed_id = (int) $feed_id;
-
- if (!$title)
- $title = getFeedTitle($feed_id, false);
-
- if ($unread === false)
- $unread = getFeedUnread($feed_id, false);
-
- $obj['id'] = 'FEED:' . $feed_id;
- $obj['name'] = $title;
- $obj['unread'] = (int) $unread;
- $obj['type'] = 'feed';
- $obj['error'] = $error;
- $obj['updated'] = $updated;
- $obj['icon'] = getFeedIcon($feed_id);
- $obj['bare_id'] = $feed_id;
- $obj['auxcounter'] = 0;
-
- return $obj;
- }
-
- function inactiveFeeds() {
-
- if (DB_TYPE == "pgsql") {
- $interval_qpart = "NOW() - INTERVAL '3 months'";
- } else {
- $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)";
- }
-
- $result = $this->dbh->query("SELECT ttrss_feeds.title, ttrss_feeds.site_url,
- ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article
- FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE
- (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
- ttrss_entries.id = ref_id AND
- ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart
- AND ttrss_feeds.owner_uid = ".$_SESSION["uid"]." AND
- ttrss_user_entries.feed_id = ttrss_feeds.id AND
- ttrss_entries.id = ref_id
- GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url
- ORDER BY last_article");
-
- print "";
-
- $fg_color = $line['fg_color'];
- $bg_color = $line['bg_color'];
-
- print "α ";
-
- print " ";
-
- print "
";
- print "" . __("Colors") . "
";
- print "