<?php
/*=====================================================================*\
|| ###################################################################
|| # Bugdar
|| # Copyright (c)2004-2009 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
|| # the Free Software Foundation; version 2 of the License.
|| #
|| # This program is distributed in the hope that it will be useful, but
|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|| # more details.
|| #
|| # You should have received a copy of the GNU General Public License along
|| # with this program; if not, write to the Free Software Foundation, Inc.,
|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|| ###################################################################
\*=====================================================================*/
chdir('./../');
require_once('./includes/init.php');
require_once('./includes/functions.php');
require_once('./includes/functions_admin.php');
// ###################################################################
// setup admin templates
require_once ISSO . '/DecoratorHelpers.php';
require_once ISSO . '/Template.php';
BSTemplate::$dbCacheTable = TABLE_PREFIX . 'template';
BSTemplate::$templatePath = 'admin/templates/%s.html';
$globaltemplates = array(
'doctype',
'nav',
'headinclude',
'footer',
);
$start = microtime();
BSTemplate::cache(array_merge($globaltemplates, (array)$fetchtemplates));
BSApp::debug('time for tpl cache: ' . BSFunctions::fetch_microtime_diff($start));
BSTemplate::$globalVars = array(
'templates' => array(
'doctype' => BSTemplate::fetch('doctype')->evaluate()->getTemplate(),
'nav' => BSTemplate::fetch('nav')->evaluate()->getTemplate(),
'headinclude' => BSTemplate::fetch('headinclude')->evaluate()->getTemplate(),
'title' => T('Bugdar Administration')
)
);
// ###################################################################
if (can_perform('canadminpanel'))
{
$session = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $input->inputEscape(COOKIE_PREFIX . 'adminsession') . "'");
if ($session AND $session['userid'] == bugdar::$userinfo['userid'] AND $session['dateline'] >= (TIMENOW - 3600))
{
// renew the cookie
BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', $session['sessionid'], false);
}
else
{
BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', false);
admin_login();
}
}
else
{
BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', false);
admin_login();
}
?>