Mercurial > SimpleWebPresenter
view index.php @ 39:bd82b719a0de
Make CacheTimeCheck a singleton.
Robustify if_modified_since check.
Quiet warnings.
Set debug levels.
Fix basepath references.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Fri, 05 Oct 2012 00:21:27 +0200 |
| parents | 42533600214b |
| children | fbbb82ced6de |
line wrap: on
line source
<?php define(VERBOSITY_NONE, 0); define(VERBOSITY_ERROR, 1); define(VERBOSITY_WARNING, 10); define(VERBOSITY_DEBUG, 100); define(DEBUG_LEVEL, VERBOSITY_WARNING); define(DUMP, 0); define(MAX_RECURSE, 50); define(CACHING, 1); if (DEBUG_LEVEL >= VERBOSITY_DEBUG) { var_dump($_SERVER); } if (DEBUG_LEVEL >= VERBOSITY_WARNING) { error_reporting(E_ALL); ini_set("display_errors", 1); } $cacheable = true; 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'); $master = new DOMDocument(); $masterName = basePath() . "/master.xml"; $master->load($masterName); $options = new Options($master); $options->setCache($cache); $options->setBasePath(basePath()); $options->setUrlParams(array('name', 'lang')); if(array_key_exists('lang', $_GET)) { $options->setLang($_GET['lang']); } else { $options->setLang($options->getDefaultLang()); } if( array_key_exists('name', $_GET)) { $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); ?>
