define('DB_PASS', "XXXXXX");
//define('DB_PORT', '5432'); // when neeeded, PG-only
- define('RSS_BACKEND_TYPE', "magpie");
- // magpie (stable) or simplepie (EXPERIMENTAL!)
-
define('MAGPIE_FETCH_TIME_OUT', 60);
// Magpie's default timeout is 5 seconds. Some RSS feeds,
// such as from large Trac installs, can take significantly
define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache');
// Local cache directory for RSS feeds
- define('SIMPLEPIE_CACHE_DIR', '/var/tmp/simplepie-ttrss-cache');
- // Local cache directory for RSS feeds (simplepie)
-
define('WEB_DEMO_MODE', false);
// Demo mode with reduced functionality.
// Warning: this option is obsolete. Don't rely on it being
require_once 'errors.php';
require_once 'version.php';
- if (RSS_BACKEND_TYPE == "magpie") {
- define('MAGPIE_USER_AGENT_EXT', ' (Tiny Tiny RSS/' . VERSION . ')');
- require_once "magpierss/rss_fetch.inc";
- require_once 'magpierss/rss_utils.inc';
- } else if (RSS_BACKEND_TYPE == "simplepie") {
- require_once 'simplepie/simplepie.inc';
- }
-
+ define('MAGPIE_USER_AGENT_EXT', ' (Tiny Tiny RSS/' . VERSION . ')');
define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
+ require_once "magpierss/rss_fetch.inc";
+ require_once 'magpierss/rss_utils.inc';
+
function purge_feed($link, $feed_id, $purge_interval, $debug = false) {
$rows = -1;
function update_rss_feed($link, $feed_url, $feed, $ignore_daemon = false) {
- if (WEB_DEMO_MODE) return;
-
if (DAEMON_REFRESH_ONLY && !$_GET["daemon"] && !$ignore_daemon) {
return;
}
}
- if (RSS_BACKEND_TYPE == "magpie") {
- error_reporting(0);
- $rss = fetch_rss($fetch_url);
- error_reporting (DEFAULT_ERROR_LEVEL);
- } else if (RSS_BACKEND_TYPE == "simplepie") {
-
- if (!file_exists(SIMPLEPIE_CACHE_DIR)) {
- mkdir(SIMPLEPIE_CACHE_DIR);
- }
-
- $rss = new SimplePie();
- $rss->feed_url($fetch_url);
- $rss->cache_location(SIMPLEPIE_CACHE_DIR);
- $rss->init();
- }
+ error_reporting(0);
+ $rss = fetch_rss($fetch_url);
+ error_reporting (DEFAULT_ERROR_LEVEL);
$feed = db_escape_string($feed);
- $rss_check = $rss;
-
- if (RSS_BACKEND_TYPE == "simplepie") {
- $rss_check = $rss->data;
- }
-
- if ($rss_check) {
+ if ($rss) {
// db_query($link, "BEGIN");
if (!$registered_title || $registered_title == "[Unknown]") {
- if (RSS_BACKEND_TYPE == "magpie") {
- $feed_title = db_escape_string($rss->channel["title"]);
- } else {
- $feed_title = $rss->get_feed_title();
- }
+ $feed_title = db_escape_string($rss->channel["title"]);
db_query($link, "UPDATE ttrss_feeds SET
title = '$feed_title' WHERE id = '$feed'");
}
- if (RSS_BACKEND_TYPE == "magpie") {
- $site_url = $rss->channel["link"];
- // weird, weird Magpie
- if (!$site_url) $site_url = db_escape_string($rss->channel["link_"]);
- } else {
- $site_url = $rss->get_feed_link();
- }
+ $site_url = $rss->channel["link"];
+ // weird, weird Magpie
+ if (!$site_url) $site_url = db_escape_string($rss->channel["link_"]);
if ($site_url && $orig_site_url != db_escape_string($site_url)) {
db_query($link, "UPDATE ttrss_feeds SET
// print "I: " . $rss->channel["image"]["url"];
- if (RSS_BACKEND_TYPE == "magpie") {
- $icon_url = $rss->image["url"];
- } else {
- $icon_url = $rss->get_image_url(); # FIXME
- }
+ $icon_url = $rss->image["url"];
if ($icon_url && !$orig_icon_url != db_escape_string($icon_url)) {
$icon_url = db_escape_string($icon_url);
array_push($filters[$line["name"]], $filter);
}
- if (RSS_BACKEND_TYPE == "magpie") {
- $iterator = $rss->items;
+ $iterator = $rss->items;
- if (!$iterator || !is_array($iterator)) $iterator = $rss->entries;
- if (!$iterator || !is_array($iterator)) $iterator = $rss;
-
- } else {
- $iterator = $rss->get_items();
- }
+ if (!$iterator || !is_array($iterator)) $iterator = $rss->entries;
+ if (!$iterator || !is_array($iterator)) $iterator = $rss;
if (!is_array($iterator)) {
/* db_query($link, "UPDATE ttrss_feeds
require_once "config.php";
if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
- print _("<b>Fatal Error</b>: Your configuration file has
- wrong version. Please copy new options from <b>config.php-dist</b> and
- update CONFIG_VERSION directive.\n");
- exit;
- }
-
- if (!defined('RSS_BACKEND_TYPE')) {
- print _("<b>Fatal error</b>: RSS backend type is not defined
- (config variable <b>RSS_BACKEND_TYPE</b>) - please check your
- configuration file.\n");
- exit;
- }
-
- if (RSS_BACKEND_TYPE == "magpie" && !file_exists("magpierss/rss_fetch.inc")) {
- print _("<b>Fatal Error</b>: You forgot to place
- <a href=\"http://magpierss.sourceforge.net\">MagpieRSS</a>
- distribution in <b>magpierss/</b>
- subdirectory of TT-RSS tree.\n");
- exit;
- }
-
- if (RSS_BACKEND_TYPE == "simplepie" && !file_exists("simplepie/simplepie.inc")) {
- print _("<b>Fatal Error</b>: You forgot to place
- <a href=\"http://simplepie.org\">SimplePie</a>
- distribution in <b>simplepie/</b>
- subdirectory of TT-RSS tree.\n");
- exit;
+ return _("config: your config file version is incorrect. See config.php-dist.\n");
}
- if (RSS_BACKEND_TYPE != "simplepie" && RSS_BACKEND_TYPE != "magpie") {
- print _("<b>Fatal Error</b>: Invalid RSS_BACKEND_TYPE\n");
+ if (defined('RSS_BACKEND_TYPE')) {
+ print _("<b>Fatal error</b>: RSS_BACKEND_TYPE is deprecated. Please remove this
+ option from config.php\n");
exit;
}
- if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
- return _("config: your config file version is incorrect. See config.php-dist.\n");
- }
-
if (file_exists("xml-export.php") || file_exists("xml-import.php")) {
print _("<b>Fatal Error</b>: XML Import/Export tools (<b>xml-export.php</b>
and <b>xml-import.php</b>) could be used maliciously. Please remove them
exit;
}
- if (RSS_BACKEND_TYPE != "magpie") {
- print _("<b>Fatal Error</b>: RSS backends other than magpie are not
- supported now.\n");
- exit;
- }
-
if (SINGLE_USER_MODE && DAEMON_UPDATE_LOGIN_LIMIT > 0) {
print _("<b>Fatal Error</b>: Please set DAEMON_UPDATE_LOGIN_LIMIT
to 0 in single user mode.\n");