]> git.wh0rd.org Git - tt-rss.git/commitdiff
support for web-demo mode (restricted rights)
authorAndrew Dolgov <fox@bah.spb.su>
Tue, 23 Aug 2005 11:34:07 +0000 (12:34 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Tue, 23 Aug 2005 11:34:07 +0000 (12:34 +0100)
backend.php
config.php-dist
functions.php

index e5244fb609be23d4cb26b75070802f7d4363fc31..8e0eeb0076fd4fb0abee0317fbd1eded4bfada40 100644 (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'");
                }
 
                if ($subop == "remove") {
-                       $ids = split(",", $_GET["ids"]);
 
-                       foreach ($ids as $id) {
-                               pg_query("BEGIN");
-                               pg_query("DELETE FROM ttrss_entries WHERE feed_id = '$id'");
-                               pg_query("DELETE FROM ttrss_feeds WHERE id = '$id'");
-                               pg_query("COMMIT");
+                       if (!WEB_DEMO_MODE) {
 
+                               $ids = split(",", $_GET["ids"]);
+
+                               foreach ($ids as $id) {
+                                       pg_query("BEGIN");
+                                       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") {
-                       $feed_link = pg_escape_string($_GET["link"]);
-                               
-                       $result = pg_query(
-                               "INSERT INTO ttrss_feeds (feed_url,title) VALUES ('$feed_link', '')");
+               
+                       if (!WEB_DEMO_MODE) {
 
-                       $result = pg_query("SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_link'");
+                               $feed_link = pg_escape_string($_GET["link"]);
+                                       
+                               $result = pg_query(
+                                       "INSERT INTO ttrss_feeds (feed_url,title) VALUES ('$feed_link', '')");
 
-                       $feed_id = pg_fetch_result($result, 0, "id");
+                               $result = pg_query("SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_link'");
 
-                       if ($feed_id) {
-                               update_rss_feed($link, $feed_link, $feed_id);
-                       }
+                               $feed_id = pg_fetch_result($result, 0, "id");
 
+                               if ($feed_id) {
+                                       update_rss_feed($link, $feed_link, $feed_id);
+                               }
+                       }
                }
        
                $result = pg_query("SELECT * FROM ttrss_feeds ORDER by title");
index c83cbaf324673ead4bc9adfa32dcb8c25f4c63a2..fae328172bd6606cb9b00ff7856ca6daef33717b 100644 (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);
+
 ?>
 
index 355bc1a97b740c8969757928d4c85b4af5d3e496..578020f239c811cb6c021f13d59b7ba82326c356 100644 (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);