]> src.bluestatic.org Git - bugdar.git/blob - global.php
r499: Removed unused .t* classes
[bugdar.git] / global.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]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->templatedir = $bugsys->fetch_sourcepath('templates/');
20
21 // ###################################################################
22 // global template variables
23 $datetime = $datef->format('l, F j, Y g:i A');
24 $year = $datef->format('Y');
25 $version = $bugsys->options['trackerversion'];
26
27 $show['admin'] = (bool)can_perform('canadminpanel');
28 $show['newreport'] = (bool)can_perform('cansubmitbugs');
29 $show['search'] = (bool)can_perform('cansearch');
30
31 // ###################################################################
32 // do style vars
33 if (($raw = @file_get_contents('./templates/stylevars.txt')) !== false)
34 {
35 // remove comments
36 $raw = preg_replace('#/\*(.*?)\*/#s', '', $raw);
37 $raw = trim($raw);
38
39 // create individual vars
40 $varsraw = explode(';', $raw);
41 foreach ($varsraw AS $var)
42 {
43 if (($var = trim($var)) == '')
44 {
45 continue;
46 }
47
48 // split into varname - value pair
49 $temp = explode(':', $var);
50
51 // clean up varnames
52 $varname = trim($temp[0]);
53 $varname = preg_replace('#[^a-z0-9]#i', '_', $varname);
54
55 // clean up values
56 $value = trim($temp[1]);
57 $value = preg_replace('#[^a-z0-9%\-\.\#]#i', '', $value);
58
59 // put it in the array
60 $stylevar["$varname"] = $value;
61 }
62 }
63 else
64 {
65 trigger_error('StyleVars file (./templates/stylevars.txt) could not be loaded', E_USER_WARNING);
66 }
67
68 // ###################################################################
69 // cache templates
70 $globaltemplates = array(
71 'doctype',
72 'header',
73 'headinclude',
74 'footer',
75 'selectoption',
76 'selectoptgroup',
77 'std_error',
78 'std_redirect',
79 'std_message',
80 'bugfield_input_text',
81 'bugfield_input_checkbox',
82 'bugfield_select_single_option',
83 'bugfield_select_single',
84 'username_display'
85 );
86
87 $start = microtime();
88
89 $template->cache(array_merge($globaltemplates, (array)$fetchtemplates));
90
91 $bugsys->debug('time for tpl cache: ' . $funct->fetch_microtime_diff($start));
92
93 eval('$header = "' . $template->fetch('header') . '";');
94 eval('$doctype = "' . $template->fetch('doctype') . '";');
95 eval('$headinclude = "' . $template->fetch('headinclude') . '";');
96 eval('$footer = "' . $template->fetch('footer') . '";');
97
98 // ###################################################################
99
100 // ###################################################################
101 // initialize template variables
102 $show = array();
103
104 // ###################################################################
105 // create error reporter
106 require_once('./includes/class_message_reporter.php');
107 $message = new Message_Reporter();
108 $bugsys->message =& $message;
109
110 /*=====================================================================*\
111 || ###################################################################
112 || # $HeadURL$
113 || # $Id$
114 || ###################################################################
115 \*=====================================================================*/
116 ?>