From b619ff1507b3164131f1985149593b17ff25b2b2 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 16 Nov 2005 18:22:13 +0100 Subject: [PATCH] sql-ize functions.php --- functions.php | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/functions.php b/functions.php index 4e7f0c3a..d8e95594 100644 --- a/functions.php +++ b/functions.php @@ -1,5 +1,6 @@ 0) { @@ -27,27 +28,13 @@ } } } - - /* - 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)) { @@ -115,7 +104,7 @@ 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); @@ -130,7 +119,7 @@ if ($rss) { - if (ENABLE_FEED_ICONS) { + if (get_pref($link, 'ENABLE_FEED_ICONS')) { check_feed_favicon($feed_url, $feed); } @@ -300,7 +289,7 @@ if ($orig_content_hash != $content_hash) { // print "$orig_content_hash :: $content_hash
"; - 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; @@ -441,7 +430,7 @@ $feed = "$feed_title"; print "
  • "; - if (ENABLE_FEED_ICONS) { + if (get_pref($link, 'ENABLE_FEED_ICONS')) { print "$feed_icon"; } -- 2.39.5