Switch the 'modify' code of admin/field.php to use templates
[bugdar.git] / global.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright (c)2004-2009 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 // initialize the email system
36 require_once ISSO . '/Mail.php';
37 require_once 'includes/emails.php';
38
39 define('MAIL_FROM_ADDRESS', bugdar::$options['webmasteremail']);
40 define('MAIL_FROM_NAME', bugdar::$options['trackertitle']);
41
42 // ###################################################################
43 // global template variables
44
45 $show = array(
46 'admin' => can_perform('canadminpanel'),
47 'newreport' => can_perform('cansubmitbugs'),
48 'search' => can_perform('cansearch')
49 );
50
51 if (!(defined('NO_TEMPLATES') AND constant('NO_TEMPLATES') == true))
52 {
53 // ###################################################################
54 // cache templates
55 $globaltemplates = array(
56 'doctype',
57 'header',
58 'headinclude',
59 'footer',
60 'selectoption',
61 'selectoptgroup',
62 'std_error',
63 'std_redirect',
64 'std_message',
65 'bugfield_input_text',
66 'bugfield_input_checkbox',
67 'bugfield_select_single_option',
68 'bugfield_select_single',
69 'username_display',
70 'help_link'
71 );
72
73 $start = microtime();
74
75 BSTemplate::cache(array_merge($globaltemplates, (array)$fetchtemplates));
76
77 BSApp::debug('time for tpl cache: ' . BSFunctions::fetch_microtime_diff($start));
78
79 BSTemplate::$globalVars = array(
80 'stylevar' => &$stylevar,
81 'show' => &$show,
82 'focus' => $focus
83 );
84
85 $globalTemplates = array(
86 'header' => BSTemplate::fetch('header')->evaluate()->getTemplate(),
87 'doctype' => BSTemplate::fetch('doctype')->evaluate()->getTemplate(),
88 'headinclude' => BSTemplate::fetch('headinclude')->evaluate()->getTemplate(),
89 'footer' => BSTemplate::fetch('footer')
90 );
91
92 BSTemplate::$globalVars = array_merge($globalTemplates, BSTemplate::$globalVars);
93 }
94
95 // ###################################################################
96 // create error reporter
97 require_once('./includes/class_message_reporter.php');
98 $message = new MessageReporter();
99
100 ?>