]> src.bluestatic.org Git - bugdar.git/blob - admin/global.php
r1384: It was actually bug 66...
[bugdar.git] / admin / global.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
6 || #
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 [#]gpl[#] of the License.
10 || #
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
14 || # more details.
15 || #
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 \*=====================================================================*/
21
22 chdir('./../');
23
24 require_once('./includes/init.php');
25 require_once('./includes/functions.php');
26
27 // ###################################################################
28 // admin navigation
29
30 $bugsys->load('printer_navigation', 'navigator', true);
31 $navigator->add_top_link(_('Home'), '../index.php');
32 $navigator->add_top_link(_('Logout'), '../login.php?do=cplogout');
33
34 $navigator->add_component('tab', 'options', null, _('Options'), 'index.php');
35 $navigator->add_component('tab', 'products', null, _('Products'), 'product.php');
36 $navigator->add_component('tab', 'fields', null, _('Fields'), 'field.php');
37 $navigator->add_component('tab', 'users', null, _('Users &amp; Permissions'), 'user.php');
38
39 require_once('./includes/class_admin_navigation.php');
40
41 // ###################################################################
42 // continue loading
43
44 $bugsys->load('printer', 'admin', true);
45 $admin->setRealm(_('Administration'));
46 $admin->setLanguageInformation($language);
47 $admin->css_link('../framework/printer.css.php');
48
49 // ###################################################################
50
51 function admin_login()
52 {
53 global $admin, $bugsys;
54
55 define('ISSO_PRINTER_NO_NAVIGATION', 1);
56
57 $admin->page_start(_('Login'), null, '', 'document.cplogin.' . ($bugsys->userinfo['email'] ? 'password' : 'email') . '.focus();');
58
59 $admin->form_start('../login.php', 'cplogin', false, 'cplogin');
60 $admin->table_start(true, '425');
61 $admin->table_head(_('Login to Bugdar'));
62 $admin->row_input(_('Email'), 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle');
63 $admin->row_input(_('Password'), 'password', '', 2, 35, false, true, 'middle');
64 $admin->row_submit('', _('Login'));
65 $admin->table_end();
66 $admin->form_end();
67
68 $admin->page_end();
69 }
70
71 // ###################################################################
72
73 $bugsys->userinfo['adminsession'] = false;
74
75 if ($_COOKIE[COOKIE_PREFIX . 'adminsession'])
76 {
77 if (can_perform('canadminpanel'))
78 {
79 if (md5(md5($bugsys->userinfo['authkey']) . md5(gmdate('F j, Y @ H'))) != $_COOKIE[COOKIE_PREFIX . 'adminsession'])
80 {
81 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
82 admin_login();
83 // do we need this message?
84 $admin->error(_('Invalid admin session has been terminated.'));
85 }
86 else
87 {
88 // renew the cookie
89 $funct->cookie(COOKIE_PREFIX . 'adminsession', md5(md5($bugsys->userinfo['authkey']) . md5(gmdate('F j, Y @ H'))), false);
90 $bugsys->userinfo['adminsession'] = true;
91 }
92 }
93 else
94 {
95 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
96 admin_login();
97 }
98 }
99
100 if (!$_COOKIE[COOKIE_PREFIX . 'adminsession'])
101 {
102 admin_login();
103 }
104
105 // ###################################################################
106
107 // ###################################################################
108 /**
109 * Callback function for the Pagination->BitProcessor()
110 *
111 * @param string Base link
112 * @param bool Do not show this as a link
113 * @param integer Page number
114 * @param object Page navigator framework
115 *
116 * @return string Processed HTML
117 */
118 function AdminPageNavigatorBitCallback($baselink, $nolink, $number, $paginator)
119 {
120 if ($nolink)
121 {
122 return '<strong>' . $number . '</strong>' . "\n";
123 }
124 else
125 {
126 return '<a href="' . $baselink . 'p=' . $number . '&amp;pp=' . $paginator->getPerPage() . '">' . $number . '</a>' . "\n";
127 }
128 }
129
130 // ###################################################################
131 /**
132 * Callback function for the Pagination->NavigatorProcessor()
133 *
134 * @param string Base URL
135 * @param integer Next page number
136 * @param integer Previous page number
137 * @param array Show information
138 * @param string Individual page bits
139 * @param object Page navigator framework
140 *
141 * @return string Processed HTML
142 */
143 function AdminPageNavigatorCallback($baselink, $nextpage, $prevpage, $show, $pagebits, $paginator)
144 {
145 global $stylevar;
146
147 $return = '';
148
149 if ($show['first'])
150 {
151 $return .= '<a href="' . $baselink . 'p=1&amp;pp=' . $paginator->getPerPage() . '">' . _('First') . '</a> ...';
152 }
153 if ($show['prev'])
154 {
155 $return .= '<a href="' . $baselink . 'p=' . $prevpage . '&amp;pp=' . $paginator->getPerPage() . '">' . _('Prev') . '</a> ...';
156 }
157
158 $return .= $pagebits;
159
160 if ($show['next'])
161 {
162 $return .= '... <a href="' . $baselink . 'p=' . $nextpage . '&amp;pp=' . $paginator->getPerPage() . '">' . _('Next') . '</a>';
163 }
164 if ($show['last'])
165 {
166 $return .= '... <a href="' . $baselink . 'p=' . $paginator->getPageCount() . '&amp;pp=' . $paginator->getPerPage() . '">' . _('Last') . '</a>';
167 }
168 return '<div style="margin-top: 15px; float: ' . $stylevar['right'] . '">' . $return . '</div>';
169 }
170
171 /*=====================================================================*\
172 || ###################################################################
173 || # $HeadURL$
174 || # $Id$
175 || ###################################################################
176 \*=====================================================================*/
177 ?>