]> src.bluestatic.org Git - bugdar.git/blob - global.php
r724: Error box model for register.php
[bugdar.git] / global.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Bugdar [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
12
13 require_once('./includes/init.php');
14
15 // ###################################################################
16 // initialize template system
17 $bugsys->load('template_fs');
18 $template->extension = 'tpl';
19 $template->pre_parse_hook = 'isso_pre_parse_hook';
20 $template->templatedir = $bugsys->fetch_sourcepath('templates/');
21
22 // ###################################################################
23 // global template variables
24 $datetime = $datef->format('l, F j, Y g:i A');
25 $year = $datef->format('Y');
26 $version = $bugsys->options['trackerversion'];
27
28 $show['admin'] = (bool)can_perform('canadminpanel');
29 $show['newreport'] = (bool)can_perform('cansubmitbugs');
30 $show['search'] = (bool)can_perform('cansearch');
31
32 // ###################################################################
33 // do style vars
34 if (($raw = @file_get_contents('./templates/stylevars.txt')) !== false)
35 {
36 // remove comments
37 $raw = preg_replace('#/\*(.*?)\*/#s', '', $raw);
38 $raw = trim($raw);
39
40 // create individual vars
41 $varsraw = explode(';', $raw);
42 foreach ($varsraw AS $var)
43 {
44 if (($var = trim($var)) == '')
45 {
46 continue;
47 }
48
49 // split into varname - value pair
50 $temp = explode(':', $var);
51
52 // clean up varnames
53 $varname = trim($temp[0]);
54 $varname = preg_replace('#[^a-z0-9]#i', '_', $varname);
55
56 // clean up values
57 $value = trim($temp[1]);
58 $value = preg_replace('#[^a-z0-9%\-\.\#]#i', '', $value);
59
60 // put it in the array
61 $stylevar["$varname"] = $value;
62 }
63 }
64 else
65 {
66 trigger_error('StyleVars file (./templates/stylevars.txt) could not be loaded', E_USER_WARNING);
67 }
68
69 // ###################################################################
70 // cache templates
71 $globaltemplates = array(
72 'doctype',
73 'header',
74 'headinclude',
75 'footer',
76 'selectoption',
77 'selectoptgroup',
78 'std_error',
79 'std_redirect',
80 'std_message',
81 'bugfield_input_text',
82 'bugfield_input_checkbox',
83 'bugfield_select_single_option',
84 'bugfield_select_single',
85 'username_display',
86 'help_link'
87 );
88
89 $start = microtime();
90
91 $template->cache(array_merge($globaltemplates, (array)$fetchtemplates));
92
93 $bugsys->debug('time for tpl cache: ' . $funct->fetch_microtime_diff($start));
94
95 eval('$header = "' . $template->fetch('header') . '";');
96 eval('$doctype = "' . $template->fetch('doctype') . '";');
97 eval('$headinclude = "' . $template->fetch('headinclude') . '";');
98 eval('$footer = "' . $template->fetch('footer') . '";');
99
100 // ###################################################################
101
102 // ###################################################################
103 // initialize template variables
104 $show = array();
105
106 // ###################################################################
107 // create error reporter
108 require_once('./includes/class_message_reporter.php');
109 $message = new Message_Reporter();
110 $bugsys->message =& $message;
111
112 /*=====================================================================*\
113 || ###################################################################
114 || # $HeadURL$
115 || # $Id$
116 || ###################################################################
117 \*=====================================================================*/
118 ?>