r765: Say hello to the GPL
[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 $globalnav = array(
31 $lang->string('Administration Locations') => array(
32 $lang->string('Home') => 'index.php',
33 $lang->string('Logout') => '../login.php?do=cplogout'
34 ),
35
36 $lang->string('Options') => array(
37 $lang->string('Bugdar Settings') => 'setting.php',
38 $lang->string('Manage Languages') => 'language.php',
39 $lang->string('Edit User Help') => 'userhelp.php'
40 ),
41
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 require_once('./includes/adminfunctions.php');
63 $admin = new Admin_Print_Class();
64
65 // ###################################################################
66
67 function admin_login()
68 {
69 global $admin, $bugsys;
70
71 $admin->page_start('Login', '', 15, '', 'document.cplogin.' . (($bugsys->userinfo['email']) ? 'password' : 'email') . '.focus();');
72
73 $admin->form_start('../login.php', 'cplogin', false, 'cplogin');
74 $admin->table_start(true, '425');
75 $admin->table_head($bugsys->lang->string('Login to Bugdar'));
76 $admin->row_input($bugsys->lang->string('Email'), 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle');
77 $admin->row_input($bugsys->lang->string('Password'), 'password', '', 2, 35, false, true, 'middle');
78 $admin->row_submit('', $bugsys->lang->string('Login'));
79 $admin->table_end();
80 $admin->form_end();
81
82 $admin->page_end();
83 }
84
85 // ###################################################################
86
87 $bugsys->userinfo['adminsession'] = false;
88
89 if ($_COOKIE[COOKIE_PREFIX . 'adminsession'])
90 {
91 if (can_perform('canadminpanel'))
92 {
93 if (md5(md5($bugsys->userinfo['authkey']) . md5(gmdate('F j, Y @ H'))) != $_COOKIE[COOKIE_PREFIX . 'adminsession'])
94 {
95 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
96 admin_login();
97 // do we need this message?
98 $admin->error($lang->string('Invalid admin session has been terminated.'));
99 }
100 else
101 {
102 // renew the cookie
103 $funct->cookie(COOKIE_PREFIX . 'adminsession', md5(md5($bugsys->userinfo['authkey']) . md5(gmdate('F j, Y @ H'))), false);
104 $bugsys->userinfo['adminsession'] = true;
105 }
106 }
107 else
108 {
109 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
110 admin_login();
111 }
112 }
113
114 if (!$_COOKIE[COOKIE_PREFIX . 'adminsession'])
115 {
116 admin_login();
117 }
118
119 /*=====================================================================*\
120 || ###################################################################
121 || # $HeadURL$
122 || # $Id$
123 || ###################################################################
124 \*=====================================================================*/
125 ?>