2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2004-2009 Blue Static
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.
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
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 \*=====================================================================*/
24 require_once('./includes/init.php');
25 require_once('./includes/functions.php');
27 // ###################################################################
28 // setup admin templates
30 require_once ISSO
. '/DecoratorHelpers.php';
32 require_once ISSO
. '/Template.php';
33 BSTemplate
::$dbCacheTable = TABLE_PREFIX
. 'template';
34 BSTemplate
::$templatePath = 'admin/templates/%s.html';
36 $globaltemplates = array(
44 BSTemplate
::cache(array_merge($globaltemplates, (array)$fetchtemplates));
45 BSApp
::debug('time for tpl cache: ' . BSFunctions
::fetch_microtime_diff($start));
47 BSTemplate
::$globalVars = array(
49 'doctype' => BSTemplate
::fetch('doctype')->evaluate()->getTemplate(),
50 'nav' => BSTemplate
::fetch('nav')->evaluate()->getTemplate(),
51 'headinclude' => BSTemplate
::fetch('headinclude')->evaluate()->getTemplate(),
52 'title' => T('Bugdar Administration')
56 // ###################################################################
58 function admin_footer()
60 return BSTemplate
::fetch('footer')->evaluate()->getTemplate();
63 function admin_login()
65 BSTemplate
::fetch('login')->evaluate()->flush();
69 // ###################################################################
71 if (can_perform('canadminpanel'))
73 $session = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX
. "adminsession WHERE sessionid = '" . $input->inputEscape(COOKIE_PREFIX
. 'adminsession') . "'");
74 if ($session AND $session['userid'] == bugdar
::$userinfo['userid'] AND $session['dateline'] >= (TIMENOW
- 3600))
77 BSFunctions
::cookie(COOKIE_PREFIX
. 'adminsession', $session['sessionid'], false
);
81 BSFunctions
::cookie(COOKIE_PREFIX
. 'adminsession', false
);
87 BSFunctions
::cookie(COOKIE_PREFIX
. 'adminsession', false
);
91 // ###################################################################
93 // ###################################################################
95 * Callback function for the Pagination->BitProcessor()
97 * @param string Base link
98 * @param bool Do not show this as a link
99 * @param integer Page number
100 * @param object Page navigator framework
102 * @return string Processed HTML
104 function AdminPageNavigatorBitCallback($baselink, $nolink, $number, $paginator)
108 return '<strong>' . $number . '</strong>' . "\n";
112 return '<a href="' . $baselink . 'p=' . $number . '&pp=' . $paginator->getPerPage() . '">' . $number . '</a>' . "\n";
116 // ###################################################################
118 * Callback function for the Pagination->NavigatorProcessor()
120 * @param string Base URL
121 * @param integer Next page number
122 * @param integer Previous page number
123 * @param array Show information
124 * @param string Individual page bits
125 * @param object Page navigator framework
127 * @return string Processed HTML
129 function AdminPageNavigatorCallback($baselink, $nextpage, $prevpage, $show, $pagebits, $paginator)
137 $return .= '<a href="' . $baselink . 'p=1&pp=' . $paginator->getPerPage() . '">' . T('First') . '</a> ...';
141 $return .= '<a href="' . $baselink . 'p=' . $prevpage . '&pp=' . $paginator->getPerPage() . '">' . T('Prev') . '</a> ...';
144 $return .= $pagebits;
148 $return .= '... <a href="' . $baselink . 'p=' . $nextpage . '&pp=' . $paginator->getPerPage() . '">' . T('Next') . '</a>';
152 $return .= '... <a href="' . $baselink . 'p=' . $paginator->getPageCount() . '&pp=' . $paginator->getPerPage() . '">' . T('Last') . '</a>';
154 return '<div style="margin-top: 15px; float: ' . $stylevar['right'] . '">' . $return . '</div>';