]> git.wh0rd.org - tt-rss.git/commitdiff
sql-ize functions.php
authorAndrew Dolgov <fox@bah.spb.su>
Wed, 16 Nov 2005 17:22:13 +0000 (18:22 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Wed, 16 Nov 2005 17:22:13 +0000 (18:22 +0100)
functions.php

index 4e7f0c3a1d94f0c5b00c7881743fd78a0b2b07a2..d8e95594b7e746f1fdd10f2a4255f805497337fb 100644 (file)
@@ -1,5 +1,6 @@
 <?
        require_once 'config.php';
+       require_once 'db-prefs.php';
 
        define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
 
@@ -12,7 +13,7 @@
                        $feed_id = $line["id"];
                        $purge_interval = $line["purge_interval"];
 
-                       if ($purge_interval == 0) $purge_interval = PURGE_OLD_DAYS;
+                       if ($purge_interval == 0) $purge_interval = get_pref($link, 'PURGE_OLD_DAYS');
 
                        if ($purge_interval > 0) {
 
                                }
                        }
                }       
-
-       /*      
-               if (PURGE_OLD_DAYS > 0) {
-
-                       if (DB_TYPE == "pgsql") {
-                               $result = db_query($link, "DELETE FROM ttrss_entries WHERE
-                                       marked = false AND feed_id = '$feed_id' AND
-                                       date_entered < NOW() - INTERVAL '".PURGE_OLD_DAYS." days'");
-                       } else {
-                               $result = db_query($link, "DELETE FROM ttrss_entries WHERE
-                                       marked = false AND AND feed_id = '$feed_id' AND
-                                       date_entered < DATE_SUB(NOW(), INTERVAL ".PURGE_OLD_DAYS." DAY)");
-                       }
-               } */
        }
 
        function update_all_feeds($link, $fetch) {
 
-               if (WEB_DEMO_MODE) return;
+               if (get_pref($link, 'WEB_DEMO_MODE')) return;
 
-               if (DAEMON_REFRESH_ONLY) {
+               if (get_pref($link, 'DAEMON_REFRESH_ONLY')) {
                        if (!$_GET["daemon"]) {
                                return;
                        }
@@ -62,7 +49,9 @@
                while ($line = db_fetch_assoc($result)) {
                        $upd_intl = $line["update_interval"];
 
-                       if (!$upd_intl || $upd_intl == 0) $upd_intl = DEFAULT_UPDATE_INTERVAL;
+                       if (!$upd_intl || $upd_intl == 0) {
+                               $upd_intl = get_pref($link, 'DEFAULT_UPDATE_INTERVAL');
+                       }
 
                        if (!$line["last_updated"] || 
                                time() - strtotime($line["last_updated"]) > ($upd_intl * 60)) {
@@ -82,7 +71,7 @@
                $feed_url = preg_replace("/\/.*$/", "", $feed_url);
                
                $icon_url = "http://$feed_url/favicon.ico";
-               $icon_file = ICONS_DIR . "/$feed.ico";
+               $icon_file = get_pref($link, 'ICONS_DIR') . "/$feed.ico";
 
                if (!file_exists($icon_file)) {
                                
 
        function update_rss_feed($link, $feed_url, $feed) {
 
-               if (WEB_DEMO_MODE) return;
+               if (get_pref($link, 'WEB_DEMO_MODE')) return;
 
                $feed = db_escape_string($feed);
 
 
                if ($rss) {
 
-                       if (ENABLE_FEED_ICONS) {        
+                       if (get_pref($link, 'ENABLE_FEED_ICONS')) {     
                                check_feed_favicon($feed_url, $feed);
                        }
                
                                        if ($orig_content_hash != $content_hash) {
 //                                             print "$orig_content_hash :: $content_hash<br>";
 
-                                               if (UPDATE_POST_ON_CHECKSUM_CHANGE) {
+                                               if (get_pref($link, 'UPDATE_POST_ON_CHECKSUM_CHANGE')) {
                                                        $last_read_qpart = 'last_read = null,';
                                                }
                                                $entry_is_modified = true;                                              
                $feed = "<a href=\"javascript:viewfeed('$feed_id', 0);\">$feed_title</a>";
 
                print "<li id=\"FEEDR-$feed_id\" class=\"$class\">";
-               if (ENABLE_FEED_ICONS) {
+               if (get_pref($link, 'ENABLE_FEED_ICONS')) {
                        print "$feed_icon";
                }