2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2004-2008 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
. '/Template.php';
31 BSTemplate
::$preParseHook = 'isso_pre_parse_hook';
32 // BSTemplate::$dbCacheTable = TABLE_PREFIX . 'admintemplate';
33 BSTemplate
::$langcall = 'T';
34 BSTemplate
::$templatePath = 'templates/%s.tpl';
36 // ###################################################################
38 function admin_login()
40 global $admin, $bugsys;
42 define('ISSO_PRINTER_NO_NAVIGATION', 1);
44 $admin->page_start(T('Login'), null
, '', 'document.cplogin.' . (bugdar
::$userinfo['email'] ?
'password' : 'email') . '.focus();');
46 $admin->form_start('../login.php', 'cplogin', false
, 'cplogin');
47 $admin->table_start(true
, '425');
48 $admin->table_head(T('Login to Bugdar'));
49 $admin->row_input(T('Email'), 'email', bugdar
::$userinfo['email'], 2, 35, false
, false
, 'middle');
50 $admin->row_input(T('Password'), 'password', '', 2, 35, false
, true
, 'middle');
51 $admin->row_submit('', T('Login'));
58 // ###################################################################
60 if (can_perform('canadminpanel'))
62 $session = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX
. "adminsession WHERE sessionid = '" . $bugsys->input_escape(COOKIE_PREFIX
. 'adminsession') . "'");
63 if ($session AND $session['userid'] == bugdar
::$userinfo['userid'] AND $session['dateline'] >= (TIMENOW
- 3600))
66 BSFunctions
::cookie(COOKIE_PREFIX
. 'adminsession', $session['sessionid'], false
);
70 BSFunctions
::cookie(COOKIE_PREFIX
. 'adminsession', false
);
72 // do we need this message?
73 $admin->error(T('Invalid admin session has been terminated.'));
78 BSFunctions
::cookie(COOKIE_PREFIX
. 'adminsession', false
);
82 // ###################################################################
84 // ###################################################################
86 * Callback function for the Pagination->BitProcessor()
88 * @param string Base link
89 * @param bool Do not show this as a link
90 * @param integer Page number
91 * @param object Page navigator framework
93 * @return string Processed HTML
95 function AdminPageNavigatorBitCallback($baselink, $nolink, $number, $paginator)
99 return '<strong>' . $number . '</strong>' . "\n";
103 return '<a href="' . $baselink . 'p=' . $number . '&pp=' . $paginator->getPerPage() . '">' . $number . '</a>' . "\n";
107 // ###################################################################
109 * Callback function for the Pagination->NavigatorProcessor()
111 * @param string Base URL
112 * @param integer Next page number
113 * @param integer Previous page number
114 * @param array Show information
115 * @param string Individual page bits
116 * @param object Page navigator framework
118 * @return string Processed HTML
120 function AdminPageNavigatorCallback($baselink, $nextpage, $prevpage, $show, $pagebits, $paginator)
128 $return .= '<a href="' . $baselink . 'p=1&pp=' . $paginator->getPerPage() . '">' . T('First') . '</a> ...';
132 $return .= '<a href="' . $baselink . 'p=' . $prevpage . '&pp=' . $paginator->getPerPage() . '">' . T('Prev') . '</a> ...';
135 $return .= $pagebits;
139 $return .= '... <a href="' . $baselink . 'p=' . $nextpage . '&pp=' . $paginator->getPerPage() . '">' . T('Next') . '</a>';
143 $return .= '... <a href="' . $baselink . 'p=' . $paginator->getPageCount() . '&pp=' . $paginator->getPerPage() . '">' . T('Last') . '</a>';
145 return '<div style="margin-top: 15px; float: ' . $stylevar['right'] . '">' . $return . '</div>';