]>
src.bluestatic.org Git - bugdar.git/blob - admin/global.php
2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright ©2002-2007 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 // ###################################################################
30 $bugsys->load('printer_navigation', 'navigator', true);
31 $navigator->add_top_link(T('Home'), '../index.php');
32 $navigator->add_top_link(T('Logout'), '../login.php?do=cplogout');
34 $navigator->add_component('tab', 'options', null, T('Options'), 'index.php');
35 $navigator->add_component('tab', 'products', null, T('Products'), 'product.php');
36 $navigator->add_component('tab', 'fields', null, T('Fields'), 'field.php');
37 $navigator->add_component('tab', 'users', null, T('Users & Permissions'), 'user.php');
39 require_once('./includes/class_admin_navigation.php');
41 // ###################################################################
44 $bugsys->load('printer', 'admin', true);
45 $admin->setRealm(T('Administration'));
46 $admin->setLanguageInformation($language);
47 $admin->css_link('../framework/printer.css.php');
49 // ###################################################################
51 function admin_login()
53 global $admin, $bugsys;
55 define('ISSO_PRINTER_NO_NAVIGATION', 1);
57 $admin->page_start(T('Login'), null, '', 'document.cplogin.' . ($bugsys->userinfo
['email'] ? 'password' : 'email') . '.focus();');
59 $admin->form_start('../login.php', 'cplogin', false, 'cplogin');
60 $admin->table_start(true, '425');
61 $admin->table_head(T('Login to Bugdar'));
62 $admin->row_input(T('Email'), 'email', $bugsys->userinfo
['email'], 2, 35, false, false, 'middle');
63 $admin->row_input(T('Password'), 'password', '', 2, 35, false, true, 'middle');
64 $admin->row_submit('', T('Login'));
71 // ###################################################################
73 if (can_perform('canadminpanel'))
75 $session = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "adminsession WHERE sessionid = '" . $bugsys->input_escape(COOKIE_PREFIX
. 'adminsession') . "'");
76 if ($session AND $session['userid'] == $bugsys->userinfo
['userid'] AND $session['dateline'] >= (TIMENOW
- 3600))
79 $funct->cookie(COOKIE_PREFIX
. 'adminsession', $session['sessionid'], false);
83 $funct->cookie(COOKIE_PREFIX
. 'adminsession', null);
85 // do we need this message?
86 $admin->error(T('Invalid admin session has been terminated.'));
91 $funct->cookie(COOKIE_PREFIX
. 'adminsession', null);
95 // ###################################################################
97 // ###################################################################
99 * Callback function for the Pagination->BitProcessor()
101 * @param string Base link
102 * @param bool Do not show this as a link
103 * @param integer Page number
104 * @param object Page navigator framework
106 * @return string Processed HTML
108 function AdminPageNavigatorBitCallback($baselink, $nolink, $number, $paginator)
112 return '<strong>' . $number . '</strong>' . "\n";
116 return '<a href="' . $baselink . 'p=' . $number . '&pp=' . $paginator->getPerPage() . '">' . $number . '</a>' . "\n";
120 // ###################################################################
122 * Callback function for the Pagination->NavigatorProcessor()
124 * @param string Base URL
125 * @param integer Next page number
126 * @param integer Previous page number
127 * @param array Show information
128 * @param string Individual page bits
129 * @param object Page navigator framework
131 * @return string Processed HTML
133 function AdminPageNavigatorCallback($baselink, $nextpage, $prevpage, $show, $pagebits, $paginator)
141 $return .= '<a href="' . $baselink . 'p=1&pp=' . $paginator->getPerPage() . '">' . T('First') . '</a> ...';
145 $return .= '<a href="' . $baselink . 'p=' . $prevpage . '&pp=' . $paginator->getPerPage() . '">' . T('Prev') . '</a> ...';
148 $return .= $pagebits;
152 $return .= '... <a href="' . $baselink . 'p=' . $nextpage . '&pp=' . $paginator->getPerPage() . '">' . T('Next') . '</a>';
156 $return .= '... <a href="' . $baselink . 'p=' . $paginator->getPageCount() . '&pp=' . $paginator->getPerPage() . '">' . T('Last') . '</a>';
158 return '<div style="margin-top: 15px; float: ' . $stylevar['right'] . '">' . $return . '</div>';
161 /*=====================================================================*\
162 || ###################################################################
165 || ###################################################################
166 \*=====================================================================*/