diff index.php @ 32:7b19be62ea94

Remove yet another global, replace by CacheTimeCheck class.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Thu, 04 Oct 2012 19:46:11 +0200
parents ca75a735651e
children 511b6514823f
line wrap: on
line diff
--- a/index.php	Sun Sep 30 03:39:32 2012 +0200
+++ b/index.php	Thu Oct 04 19:46:11 2012 +0200
@@ -13,23 +13,24 @@
   ini_set("display_errors", 1);
 }
 
-$SCRIPT_FILENAME=$_SERVER['SCRIPT_FILENAME'];
-$newest = filemtime($SCRIPT_FILENAME);
 $cacheable = true;
 
 include_once 'php/cache_check.inc';
-include_with_mtime('php/Options.inc');
-include_with_mtime('php/accept-language.inc');
-include_with_mtime('php/common-functions.inc');
-include_with_mtime('php/filters.inc');
-include_with_mtime('php/inputParser.inc');
 
-$URL_PARAMS=array('name','lang');
+$cache = new CacheTimeCheck(filemtime(__FILE__));
+$cache->includeOnce('php/Options.inc');
+$cache->includeOnce('php/accept-language.inc');
+$cache->includeOnce('php/common-functions.inc');
+$cache->includeOnce('php/filters.inc');
+$cache->includeOnce('php/inputParser.inc');
+
+$URL_PARAMS = array('name', 'lang');
 
 $master = new DOMDocument();
 $master->load("master.xml");
 
 $options = new Options($master);
+$options->setCache($cache);
 
 $lang = $_GET['lang'];
 if($lang) {
@@ -60,7 +61,7 @@
 }
 
 if (CACHING && $cacheable)
-  cache_check($newest);
+  $options->getCache()->CheckHttpModified($newest);
 
 print $master->saveXml($master);