Squash-merging the ISSO3 branch back onto master
[bugdar.git] / global.php
index 0405f844ec4f5bad690c208543b0b0ad0f1e3318..0781b7c4bcf10fed1d491d0ae2b19b472e7f11ae 100755 (executable)
@@ -2,7 +2,7 @@
 /*=====================================================================*\
 || ###################################################################
 || # Bugdar
-|| # Copyright ©2002-2007 Blue Static
+|| # Copyright (c)2004-2008 Blue Static
 || #
 || # This program is free software; you can redistribute it and/or modify
 || # it under the terms of the GNU General Public License as published by
@@ -25,22 +25,28 @@ define('HTML_CHECKED', ' checked="checked"');
 
 // ###################################################################
 // initialize template system
-$bugsys->load('template_fs', 'template', true);
-$template->setExtension('tpl');
-$template->setPreParseHook('isso_pre_parse_hook');
-$template->setTemplateDir('templates/');
-$template->setDatabaseCache(TABLE_PREFIX . 'template');
-$template->langcall = 'T';
+require_once ISSO . '/Template.php';
+BSTemplate::$preParseHook      = 'isso_pre_parse_hook';
+BSTemplate::$dbCacheTable      = TABLE_PREFIX . 'template';
+BSTemplate::$langcall          = 'T';
+BSTemplate::$templatePath      = 'templates/%s.tpl';
+
+// ###################################################################
+// initialize the email system
+require_once ISSO . '/Mail.php';
+require_once 'includes/emails.php';
+
+define('MAIL_FROM_ADDRESS',    bugdar::$options['webmasteremail']);
+define('MAIL_FROM_NAME',       bugdar::$options['trackertitle']);
 
 // ###################################################################
 // global template variables
-$datetime = $datef->format('l, F j, Y g:i A');
-$year = $datef->format('Y');
-$version = $bugsys->options['trackerversion'];
 
-$show['admin'] = (bool)can_perform('canadminpanel');
-$show['newreport'] = (bool)can_perform('cansubmitbugs');
-$show['search'] = (bool)can_perform('cansearch');
+$show = array(
+       'admin'         => can_perform('canadminpanel'),
+       'newreport'     => can_perform('cansubmitbugs'),
+       'search'        => can_perform('cansearch')
+);
 
 if (!(defined('NO_TEMPLATES') AND constant('NO_TEMPLATES') == true))
 {
@@ -66,32 +72,29 @@ if (!(defined('NO_TEMPLATES') AND constant('NO_TEMPLATES') == true))
        
        $start = microtime();
        
-       $template->cache(array_merge($globaltemplates, (array)$fetchtemplates));
+       BSTemplate::cache(array_merge($globaltemplates, (array)$fetchtemplates));
        
-       $bugsys->debug('time for tpl cache: ' . $funct->fetch_microtime_diff($start));
+       BSApp::debug('time for tpl cache: ' . BSFunctions::fetch_microtime_diff($start));
        
-       eval('$header = "' . $template->fetch('header') . '";');
-       eval('$doctype = "' . $template->fetch('doctype') . '";');
-       eval('$headinclude = "' . $template->fetch('headinclude') . '";');
-       eval('$footer = "' . $template->fetch('footer') . '";');
+       BSTemplate::$globalVars = array(
+               'stylevar'      => &$stylevar,
+               'show'          => &$show,
+               'focus'         => $focus
+       );
+               
+       $globalTemplates = array(
+               'header'                => BSTemplate::fetch('header')->evaluate()->getTemplate(),
+               'doctype'               => BSTemplate::fetch('doctype')->evaluate()->getTemplate(),
+               'headinclude'   => BSTemplate::fetch('headinclude')->evaluate()->getTemplate(),
+               'footer'                => BSTemplate::fetch('footer')->evaluate()->getTemplate(),
+       );
+       
+       BSTemplate::$globalVars = array_merge($globalTemplates, BSTemplate::$globalVars);
 }
 
-// ###################################################################
-
-// ###################################################################
-// initialize template variables
-$show = array();
-
 // ###################################################################
 // create error reporter
 require_once('./includes/class_message_reporter.php');
 $message = new MessageReporter();
-$bugsys->message =& $message;
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file