Removing the old types of global variables ($year, $version, $datetime)
[bugdar.git] / global.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright ©2002-2007 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 require_once('./includes/init.php');
23
24 define('HTML_CHECKED', ' checked="checked"');
25
26 // ###################################################################
27 // initialize template system
28 require_once ISSO . '/Template.php';
29 BSTemplate::$preParseHook = 'isso_pre_parse_hook';
30 BSTemplate::$dbCacheTable = TABLE_PREFIX . 'template';
31 BSTemplate::$langcall = 'T';
32 BSTemplate::$templatePath = 'templates/%s.tpl';
33
34 // ###################################################################
35 // global template variables
36
37 $show = array(
38 'admin' => can_perform('canadminpanel'),
39 'newreport' => can_perform('cansubmitbugs'),
40 'search' => can_perform('cansearch')
41 );
42
43 if (!(defined('NO_TEMPLATES') AND constant('NO_TEMPLATES') == true))
44 {
45 // ###################################################################
46 // cache templates
47 $globaltemplates = array(
48 'doctype',
49 'header',
50 'headinclude',
51 'footer',
52 'selectoption',
53 'selectoptgroup',
54 'std_error',
55 'std_redirect',
56 'std_message',
57 'bugfield_input_text',
58 'bugfield_input_checkbox',
59 'bugfield_select_single_option',
60 'bugfield_select_single',
61 'username_display',
62 'help_link'
63 );
64
65 $start = microtime();
66
67 BSTemplate::cache(array_merge($globaltemplates, (array)$fetchtemplates));
68
69 BSApp::debug('time for tpl cache: ' . BSFunctions::fetch_microtime_diff($start));
70
71 BSTemplate::$globalVars = array(
72 'stylevar' => &$stylevar,
73 'show' => &$show,
74 'focus' => $focus
75 );
76
77 $globalTemplates = array(
78 'header' => BSTemplate::fetch('header')->evaluate()->getTemplate(),
79 'doctype' => BSTemplate::fetch('doctype')->evaluate()->getTemplate(),
80 'headinclude' => BSTemplate::fetch('headinclude')->evaluate()->getTemplate(),
81 'footer' => BSTemplate::fetch('footer')->evaluate()->getTemplate(),
82 );
83
84 BSTemplate::$globalVars = array_merge($globalTemplates, BSTemplate::$globalVars);
85 }
86
87 // ###################################################################
88 // create error reporter
89 require_once('./includes/class_message_reporter.php');
90 $message = new MessageReporter();
91 $bugsys->message = $message;
92
93 /*=====================================================================*\
94 || ###################################################################
95 || # $HeadURL$
96 || # $Id$
97 || ###################################################################
98 \*=====================================================================*/
99 ?>