comparison index.php @ 62:b7efe2ecbc11

Wrapped everything in inputParser in a class.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Thu, 11 Oct 2012 18:21:59 +0200
parents 0e157721bbad
children 92c3e52c12d4
comparison
equal deleted inserted replaced
61:13d899b748b7 62:b7efe2ecbc11
21 21
22 if (DEBUG_LEVEL >= VERBOSITY_DEBUG) { 22 if (DEBUG_LEVEL >= VERBOSITY_DEBUG) {
23 var_dump($_SERVER); 23 var_dump($_SERVER);
24 } 24 }
25 25
26 $master = new DOMDocument();
27 $masterName = basePath() . "/master.xml"; 26 $masterName = basePath() . "/master.xml";
28 $cache->cache_time($masterName);
29 $master->load($masterName);
30 27
31 $options = new Options($master); 28 $input = new InputParser($masterName, $cache);
32 $options->setCache($cache);
33 $options->setBasePath(basePath());
34 29
35 $options->setUrlParams(array('name', 'lang')); 30 $input->genPage();
36
37 if(array_key_exists('lang', $_GET) && $_GET['lang']) {
38 $options->setLang($_GET['lang']);
39 }
40 else {
41 $options->setLang($options->getDefaultLang());
42 }
43
44 if(array_key_exists('name', $_GET) && $_GET['name']) {
45 $options->setName($_GET['name']);
46 }
47
48 $params = $master->getElementsByTagName("param");
49
50 foreach ($params as $param) {
51 if ($param->getAttribute("type") == "input") {
52 $doc = getInput($master, $param, $options);
53
54 $parent = $param->parentNode;
55 foreach ($doc->firstChild->childNodes as $child) {
56 $clonedChild = $master->importNode($child, true);
57 $parent->insertBefore($clonedChild, $param);
58 }
59 $parent->removeChild($param);
60 }
61 }
62 $master = getFiles($master, $options);
63
64 if (CACHING && $cacheable)
65 $options->getCache()->CheckHttpModified();
66
67 print $master->saveXml($master);
68 //print_r($cache->cacheSet(1));
69
70 ?> 31 ?>