Mercurial > SimpleWebPresenter
changeset 40:fbbb82ced6de
Fixes for CacheTimeCheck->includeOnce paths.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Fri, 05 Oct 2012 00:41:30 +0200 |
| parents | bd82b719a0de |
| children | 2a3ff56697db |
| files | CacheTimeCheck.inc common-functions.inc index.php |
| diffstat | 3 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/CacheTimeCheck.inc Fri Oct 05 00:21:27 2012 +0200 +++ b/CacheTimeCheck.inc Fri Oct 05 00:41:30 2012 +0200 @@ -27,7 +27,7 @@ var_dump($_SERVER); $gmdate_mod = gmdate('D, d M Y H:i:s', $this->newest) . ' GMT'; - + if(array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) { $HTTP_IF_MODIFIED_SINCE = $_SERVER['HTTP_IF_MODIFIED_SINCE']; $if_modified_since = preg_replace('/;.*$/', '', $HTTP_IF_MODIFIED_SINCE); @@ -41,11 +41,12 @@ header("Last-Modified: $gmdate_mod"); } - function cache_time($path) + function cache_time($path, $basedir = False) { if (!file_exists($path)) { - if (DEBUG) + if (DEBUG_LEVEL >= VERBOSITY_WARNING) print "${path} does not exist"; + var_dump($_SERVER); errorPage("Resource not available"); } @@ -56,8 +57,10 @@ } } - function includeOnce($path) + function includeOnce($path, $basedir = false) { + if ($basedir) + $path = $basedir . "/" . $path; $this->cache_time($path); include_once($path); }
--- a/common-functions.inc Fri Oct 05 00:21:27 2012 +0200 +++ b/common-functions.inc Fri Oct 05 00:41:30 2012 +0200 @@ -2,7 +2,7 @@ include_once 'CacheTimeCheck.inc'; $cache = CacheTimeCheck::instance(__FILE__); -$cache->includeOnce('http-response-status-codes.inc'); +$cache->includeOnce('http-response-status-codes.inc', dirname(__FILE__)); function basePath() {
--- a/index.php Fri Oct 05 00:21:27 2012 +0200 +++ b/index.php Fri Oct 05 00:41:30 2012 +0200 @@ -25,11 +25,11 @@ include_once 'CacheTimeCheck.inc'; $cache = CacheTimeCheck::instance(__FILE__); -$cache->includeOnce('Options.inc'); -$cache->includeOnce('accept-language.inc'); -$cache->includeOnce('common-functions.inc'); -$cache->includeOnce('filters.inc'); -$cache->includeOnce('inputParser.inc'); +$cache->includeOnce('Options.inc', dirname(__FILE__)); +$cache->includeOnce('accept-language.inc', dirname(__FILE__)); +$cache->includeOnce('common-functions.inc', dirname(__FILE__)); +$cache->includeOnce('filters.inc', dirname(__FILE__)); +$cache->includeOnce('inputParser.inc', dirname(__FILE__)); $master = new DOMDocument(); $masterName = basePath() . "/master.xml";
