3 require_once("boot.php");
7 $debug_text = ''; // Debugging functions should never be used on production systems.
9 // Setup the language and database.
11 $install = ((file_exists('.htconfig.php')) ? false : true);
13 @include(".htconfig.php");
16 load_translation_table($lang);
18 require_once("dba.php");
19 $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
20 unset($db_host, $db_user, $db_pass, $db_data);
23 require_once("session.php");
25 require_once("datetime.php");
27 date_default_timezone_set(($default_timezone) ? $default_timezone : 'UTC');
34 if((x($_SESSION,'authenticated')) || (x($_POST['auth-params'])))
38 $a->module = 'install';
42 if(strlen($a->module)) {
43 if(file_exists("mod/{$a->module}.php")) {
44 include("mod/{$a->module}.php");
45 $a->module_loaded = true;
48 header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
49 notice( t('Page not found.' ) . EOL);
53 if($a->module_loaded) {
54 $a->page['page_title'] = $a->module;
55 if(function_exists($a->module . '_init')) {
56 $func = $a->module . '_init';
60 if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! $a->error)
61 && (function_exists($a->module . '_post'))
62 && (! x($_POST,'auth-params'))) {
63 $func = $a->module . '_post';
67 if((! $a->error) && (function_exists($a->module . '_afterpost'))) {
68 $func = $a->module . '_afterpost';
72 if((! $a->error) && (function_exists($a->module . '_content'))) {
73 $func = $a->module . '_content';
74 $a->page['content'] .= $func($a);
79 if(stristr($_SESSION['sysmsg'], t('Permission denied'))) {
80 header($_SERVER["SERVER_PROTOCOL"] . ' 403 ' . t('Permission denied.'));
83 // report anything important happening
85 if(x($_SESSION,'sysmsg')) {
86 $a->page['content'] = "<div id=\"sysmsg\" class=\"error-message\">{$_SESSION['sysmsg']}</div>\r\n"
87 . $a->page['content'];
88 unset($_SESSION['sysmsg']);
92 // Feel free to comment out this line on production sites.
93 $a->page['content'] .= $debug_text;
95 $a->page['content'] .= '<div id="pause"></div>';
99 // Navigation (menu) template
100 if($a->module != 'install')
101 require_once("nav.php");
103 $a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array(
104 '$stylesheet' => $a->get_baseurl() . '/view/theme/'
105 . ((x($_SESSION,'theme')) ? $_SESSION['theme'] : 'default')
110 $profile = $a->profile;
111 $lang = get_config('system','language');
113 header("Content-type: text/html; charset=utf-8");
115 $template = "view/" . (($lang) ? $lang . "/" : "")
116 . ((x($a->page,'template')) ? $a->page['template'] : 'default' )
119 require_once($template);
121 session_write_close();