comparison 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
comparison
equal deleted inserted replaced
30:647b72603b7d 32:7b19be62ea94
11 if (DEBUG) { 11 if (DEBUG) {
12 error_reporting(E_ALL); 12 error_reporting(E_ALL);
13 ini_set("display_errors", 1); 13 ini_set("display_errors", 1);
14 } 14 }
15 15
16 $SCRIPT_FILENAME=$_SERVER['SCRIPT_FILENAME'];
17 $newest = filemtime($SCRIPT_FILENAME);
18 $cacheable = true; 16 $cacheable = true;
19 17
20 include_once 'php/cache_check.inc'; 18 include_once 'php/cache_check.inc';
21 include_with_mtime('php/Options.inc');
22 include_with_mtime('php/accept-language.inc');
23 include_with_mtime('php/common-functions.inc');
24 include_with_mtime('php/filters.inc');
25 include_with_mtime('php/inputParser.inc');
26 19
27 $URL_PARAMS=array('name','lang'); 20 $cache = new CacheTimeCheck(filemtime(__FILE__));
21 $cache->includeOnce('php/Options.inc');
22 $cache->includeOnce('php/accept-language.inc');
23 $cache->includeOnce('php/common-functions.inc');
24 $cache->includeOnce('php/filters.inc');
25 $cache->includeOnce('php/inputParser.inc');
26
27 $URL_PARAMS = array('name', 'lang');
28 28
29 $master = new DOMDocument(); 29 $master = new DOMDocument();
30 $master->load("master.xml"); 30 $master->load("master.xml");
31 31
32 $options = new Options($master); 32 $options = new Options($master);
33 $options->setCache($cache);
33 34
34 $lang = $_GET['lang']; 35 $lang = $_GET['lang'];
35 if($lang) { 36 if($lang) {
36 $options->setLang($lang); 37 $options->setLang($lang);
37 } 38 }
58 $parent->removeChild($param); 59 $parent->removeChild($param);
59 } 60 }
60 } 61 }
61 62
62 if (CACHING && $cacheable) 63 if (CACHING && $cacheable)
63 cache_check($newest); 64 $options->getCache()->CheckHttpModified($newest);
64 65
65 print $master->saveXml($master); 66 print $master->saveXml($master);
66 67
67 ?> 68 ?>