r1048: Converting all $lang->string() stuff to use the gettext call
[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->set('realm', _('Administration'));
46 $admin->css_link('../framework/printer.css.php');
47
48 // ###################################################################
49
50 function admin_login()
51 {
52 global $admin, $bugsys;
53
54 define('ISSO_PRINTER_NO_NAVIGATION', 1);
55
56 $admin->page_start('Login', '', 15, '', 'document.cplogin.' . (($bugsys->userinfo['email']) ? 'password' : 'email') . '.focus();');
57
58 $admin->form_start('../login.php', 'cplogin', false, 'cplogin');
59 $admin->table_start(true, '425');
60 $admin->table_head($bugsys->lang->string('Login to Bugdar'));
61 $admin->row_input($bugsys->lang->string('Email'), 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle');
62 $admin->row_input($bugsys->lang->string('Password'), 'password', '', 2, 35, false, true, 'middle');
63 $admin->row_submit('', $bugsys->lang->string('Login'));
64 $admin->table_end();
65 $admin->form_end();
66
67 $admin->page_end();
68 }
69
70 // ###################################################################
71
72 $bugsys->userinfo['adminsession'] = false;
73
74 if ($_COOKIE[COOKIE_PREFIX . 'adminsession'])
75 {
76 if (can_perform('canadminpanel'))
77 {
78 if (md5(md5($bugsys->userinfo['authkey']) . md5(gmdate('F j, Y @ H'))) != $_COOKIE[COOKIE_PREFIX . 'adminsession'])
79 {
80 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
81 admin_login();
82 // do we need this message?
83 $admin->error(_('Invalid admin session has been terminated.'));
84 }
85 else
86 {
87 // renew the cookie
88 $funct->cookie(COOKIE_PREFIX . 'adminsession', md5(md5($bugsys->userinfo['authkey']) . md5(gmdate('F j, Y @ H'))), false);
89 $bugsys->userinfo['adminsession'] = true;
90 }
91 }
92 else
93 {
94 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
95 admin_login();
96 }
97 }
98
99 if (!$_COOKIE[COOKIE_PREFIX . 'adminsession'])
100 {
101 admin_login();
102 }
103
104 /*=====================================================================*\
105 || ###################################################################
106 || # $HeadURL$
107 || # $Id$
108 || ###################################################################
109 \*=====================================================================*/
110 ?>