r259: Switching from phrase() to lang::p()
[bugdar.git] / admin / global.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
12
13 chdir('./../');
14
15 require_once('./includes/init.php');
16 require_once('./includes/functions.php');
17
18 // ###################################################################
19 // admin navigation
20
21 $globalnav = array(
22 'Admin Locations' => array(
23 'Home' => 'index.php',
24 'Logout' => '../login.php?do=cplogout'
25 ),
26
27 'Options' => array(
28 'BugStrike Options' => 'options.php'
29 ),
30
31 'Bug Fields' => array(
32 'Products / Versions / Components' => 'product.php',
33 'Priorities' => 'priority.php',
34 'Resolutions' => 'resolution.php',
35 'Severities' => 'severity.php',
36 'Statuses' => 'status.php',
37 'Custom Bug Fields' => 'fields.php'
38 ),
39
40 'User Management' => array(
41 'Usergroups' => 'usergroup.php'
42 )
43 );
44
45 // ###################################################################
46 // continue loading
47
48 require_once('./includes/adminfunctions.php');
49 $admin = new Admin_Print_Class();
50
51 // ###################################################################
52
53 function admin_login()
54 {
55 global $admin, $bugsys;
56
57 $admin->page_start('Login', '', 15, '', '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(lang::p('bugstrike_login'));
62 $admin->row_input(lang::p('email'), 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle');
63 $admin->row_input(lang::p('password'), 'password', '', 2, 35, false, true, 'middle');
64 $admin->row_submit('', lang::p('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($bugsys->userinfo['email']) . md5($bugsys->userinfo['userid'])) != $_COOKIE[COOKIE_PREFIX . 'adminsession'])
80 {
81 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
82 $admin->error(lang::p('invalid_admin_session_terminated'));
83 }
84 else
85 {
86 // renew the cookie
87 $funct->cookie(COOKIE_PREFIX . 'adminsession', md5(md5($bugsys->userinfo['authkey']) . md5($bugsys->userinfo['email']) . md5($bugsys->userinfo['userid'])), false);
88 $bugsys->userinfo['adminsession'] = true;
89 }
90 }
91 else
92 {
93 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
94 admin_login();
95 }
96 }
97
98 if (!$_COOKIE[COOKIE_PREFIX . 'adminsession'])
99 {
100 admin_login();
101 }
102
103 /*=====================================================================*\
104 || ###################################################################
105 || # $HeadURL$
106 || # $Id$
107 || ###################################################################
108 \*=====================================================================*/
109 ?>