Mercurial > SimpleWebPresenter
view index.php @ 47:66382989353f
Extract baseDir only once.
Function for generating cacheset.
Added logger functionality.
Removed hardcoded location for flagScript.
BUGFIX: masterdocument was not added to the cacheset.
BUGFIX: When two options existed next to eachother, the last was not
read.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Mon, 08 Oct 2012 17:35:08 +0200 |
| parents | 79f708a48a7c |
| children | 2cfea6e84694 |
line wrap: on
line source
<?php include_once 'constants.inc'; $cacheable = true; include_once 'CacheTimeCheck.inc'; $baseDir = dirname(__FILE__); $cache = CacheTimeCheck::instance(__FILE__); $cache->includeOnce('Options.inc', $baseDir); $cache->includeOnce('accept-language.inc', $baseDir); $cache->includeOnce('common-functions.inc', $baseDir); $cache->includeOnce('filters.inc', $baseDir); $cache->includeOnce('inputParser.inc', $baseDir); $cache->includeOnce('logger.inc', $baseDir); if (DEBUG_LEVEL >= VERBOSITY_DEBUG) { var_dump($_SERVER); } $master = new DOMDocument(); $masterName = basePath() . "/master.xml"; $cache->cache_time($masterName); $master->load($masterName); $options = new Options($master); $options->setCache($cache); $options->setBasePath(basePath()); $options->setUrlParams(array('name', 'lang')); if(array_key_exists('lang', $_GET) && $_GET['lang']) { $options->setLang($_GET['lang']); } else { $options->setLang($options->getDefaultLang()); } if(array_key_exists('name', $_GET) && $_GET['name']) { $options->setName($_GET['name']); } $params = $master->getElementsByTagName("param"); foreach ($params as $param) { if ($param->getAttribute("type") == "input") { $doc = getInput($master, $param, $options); $parent = $param->parentNode; foreach ($doc->firstChild->childNodes as $child) { $clonedChild = $master->importNode($child, true); $parent->insertBefore($clonedChild, $param); } $parent->removeChild($param); } } if (CACHING && $cacheable) $options->getCache()->CheckHttpModified(); print $master->saveXml($master); //print_r($cache->cacheSet(1)); ?>
