1 | <?php |
---|
2 | /** |
---|
3 | * technikum29v6 - PHP Subsystem. |
---|
4 | * Haupteinstiegspunkt ("WebStart.php"), welches |
---|
5 | * ohne weiteren Funktionsaufruf alles macht. |
---|
6 | * |
---|
7 | **/ |
---|
8 | |
---|
9 | if(defined('T29')) return false; // no nesting |
---|
10 | define('T29', true); |
---|
11 | |
---|
12 | $lib = dirname(__FILE__); |
---|
13 | $webroot = realpath("$lib/../"); # file path to root of t29 web installation |
---|
14 | $file = substr($_SERVER['SCRIPT_FILENAME'], strlen($_SERVER['DOCUMENT_ROOT'])); # e.g.: "/de/page.php" |
---|
15 | |
---|
16 | $cache_dir = "$webroot/shared/cache"; |
---|
17 | $languages = array( |
---|
18 | // shorthand => array(full name in page, path from webroot) |
---|
19 | "de" => array("Deutsch", "/de-v6"), |
---|
20 | "en" => array("English", "/en-v6"), |
---|
21 | ); |
---|
22 | |
---|
23 | // try to determine the language from the file path |
---|
24 | $lang = substr($file, 1, 2); |
---|
25 | if(!in_array($lang, array_keys($languages))) $lang = "de"; # check if language exists |
---|
26 | $lang_path = $languages[$lang][1]; # shorthand, relative to webroot. use "$webroot$lang_path" for local. |
---|
27 | |
---|
28 | require "$lib/cache.php"; |
---|
29 | |
---|
30 | $page_cache = new t29Cache(false, true); // debug, verbose |
---|
31 | $page_cache->set_cache_file($webroot, $file); |
---|
32 | $page_cache->test_files = array( |
---|
33 | __FILE__, |
---|
34 | $_SERVER['SCRIPT_FILENAME'], |
---|
35 | "$lib/template.php", |
---|
36 | "$lib/menu.php", |
---|
37 | "$lib/messages.php", |
---|
38 | "$webroot$lang_path/navigation.xml", |
---|
39 | "$webroot$lang_path/news.php", |
---|
40 | ); |
---|
41 | |
---|
42 | $page_cache->try_cache_and_exit(); |
---|
43 | |
---|
44 | // cache missed, rebuild cache |
---|
45 | require "$lib/template.php"; |
---|
46 | $tmpl = new t29Template($GLOBALS); |
---|
47 | $tmpl->create_cache($page_cache); |
---|
48 | |
---|
49 | // end of technikum29.php |
---|