r883: - Updating the Admin CP navigation system
[bugdar.git] / admin / global.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
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($lang->string('Home'), 'index.php');
32 $navigator->add_top_link($lang->string('Logout'), '../login.php?do=cplogout');
33
34 $navigator->add_component('tab', 'options', null, $lang->string('Options'), 'setting.php');
35 $navigator->add_component('tab', 'products', null, $lang->string('Products'), 'product.php');
36 $navigator->add_component('tab', 'fields', null, $lang->string('Fields'), 'field.php');
37 $navigator->add_component('tab', 'users', null, $lang->string('Users and Permissions'), 'user.php');
38
39 require_once('./includes/class_admin_navigation.php');
40
41 $globalnav = array(
42 $lang->string('Bug Fields') => array(
43 $lang->string('Products / Versions / Components') => 'product.php',
44 $lang->string('Priorities') => 'priority.php',
45 $lang->string('Resolutions') => 'resolution.php',
46 $lang->string('Severities') => 'severity.php',
47 $lang->string('Statuses') => 'status.php',
48 $lang->string('Custom Bug Fields') => 'field.php',
49 $lang->string('Automatic Actions') => 'autoaction.php'
50 ),
51
52 $lang->string('User Management') => array(
53 $lang->string('Users') => 'user.php',
54 $lang->string('Usergroups') => 'usergroup.php',
55 $lang->string('Usergroup Permissions') => 'permission.php'
56 )
57 );
58
59 // ###################################################################
60 // continue loading
61
62 $bugsys->load('printer', 'admin', true);
63 $admin->set('realm', $lang->string('Administration'));
64 $admin->css_link('../framework/printer.css.php');
65
66 // ###################################################################
67
68 function admin_login()
69 {
70 global $admin, $bugsys;
71
72 $admin->page_start('Login', '', 15, '', 'document.cplogin.' . (($bugsys->userinfo['email']) ? 'password' : 'email') . '.focus();');
73
74 $admin->form_start('../login.php', 'cplogin', false, 'cplogin');
75 $admin->table_start(true, '425');
76 $admin->table_head($bugsys->lang->string('Login to Bugdar'));
77 $admin->row_input($bugsys->lang->string('Email'), 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle');
78 $admin->row_input($bugsys->lang->string('Password'), 'password', '', 2, 35, false, true, 'middle');
79 $admin->row_submit('', $bugsys->lang->string('Login'));
80 $admin->table_end();
81 $admin->form_end();
82
83 $admin->page_end();
84 }
85
86 // ###################################################################
87
88 $bugsys->userinfo['adminsession'] = false;
89
90 if ($_COOKIE[COOKIE_PREFIX . 'adminsession'])
91 {
92 if (can_perform('canadminpanel'))
93 {
94 if (md5(md5($bugsys->userinfo['authkey']) . md5(gmdate('F j, Y @ H'))) != $_COOKIE[COOKIE_PREFIX . 'adminsession'])
95 {
96 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
97 admin_login();
98 // do we need this message?
99 $admin->error($lang->string('Invalid admin session has been terminated.'));
100 }
101 else
102 {
103 // renew the cookie
104 $funct->cookie(COOKIE_PREFIX . 'adminsession', md5(md5($bugsys->userinfo['authkey']) . md5(gmdate('F j, Y @ H'))), false);
105 $bugsys->userinfo['adminsession'] = true;
106 }
107 }
108 else
109 {
110 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
111 admin_login();
112 }
113 }
114
115 if (!$_COOKIE[COOKIE_PREFIX . 'adminsession'])
116 {
117 admin_login();
118 }
119
120 /*=====================================================================*\
121 || ###################################################################
122 || # $HeadURL$
123 || # $Id$
124 || ###################################################################
125 \*=====================================================================*/
126 ?>