support for web-demo mode (restricted rights)

This commit is contained in:
Andrew Dolgov 2005-08-23 12:34:07 +01:00
parent f48ba3c9e4
commit b0b4abcf37
3 changed files with 27 additions and 17 deletions

View File

@ -5,7 +5,6 @@
require_once "functions.php";
require_once "magpierss/rss_fetch.inc";
$link = pg_connect(DB_CONN);
pg_query("set client_encoding = 'utf-8'");
@ -340,6 +339,9 @@
}
if ($subop == "remove") {
if (!WEB_DEMO_MODE) {
$ids = split(",", $_GET["ids"]);
foreach ($ids as $id) {
@ -347,11 +349,14 @@
pg_query("DELETE FROM ttrss_entries WHERE feed_id = '$id'");
pg_query("DELETE FROM ttrss_feeds WHERE id = '$id'");
pg_query("COMMIT");
}
}
}
if ($subop == "add") {
if (!WEB_DEMO_MODE) {
$feed_link = pg_escape_string($_GET["link"]);
$result = pg_query(
@ -364,7 +369,7 @@
if ($feed_id) {
update_rss_feed($link, $feed_link, $feed_id);
}
}
}
$result = pg_query("SELECT * FROM ttrss_feeds ORDER by title");

View File

@ -3,6 +3,7 @@
define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache');
define(HEADLINES_PER_PAGE, 15);
define(MIN_UPDATE_TIME, 1800);
// define(CONTENT_CHECK_MD5, false);
define(WEB_DEMO_MODE, false);
?>

View File

@ -3,6 +3,8 @@
function update_all_feeds($link, $fetch) {
if (WEB_DEMO_MODE) return;
pg_query("BEGIN");
if (!$fetch) {
@ -27,6 +29,8 @@
function update_rss_feed($link, $feed_url, $feed) {
if (WEB_DEMO_MODE) return;
error_reporting(0);
$rss = fetch_rss($feed_url);
error_reporting (E_ERROR | E_WARNING | E_PARSE);