]> src.bluestatic.org Git - bugdar.git/blob - admin/global.php
r836: Implementing user API in userctrl.php
[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 $bugsys->load('printer', 'admin', true);
63 $admin->set('realm', $lang->string('Administration'));
64 $admin->set('page_start_hook', 'nav_hook');
65 $admin->css_link('../framework/printer.css.php');
66
67 // ###################################################################
68
69 function admin_login()
70 {
71 global $admin, $bugsys;
72
73 $admin->page_start('Login', '', 15, '', 'document.cplogin.' . (($bugsys->userinfo['email']) ? 'password' : 'email') . '.focus();');
74
75 $admin->form_start('../login.php', 'cplogin', false, 'cplogin');
76 $admin->table_start(true, '425');
77 $admin->table_head($bugsys->lang->string('Login to Bugdar'));
78 $admin->row_input($bugsys->lang->string('Email'), 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle');
79 $admin->row_input($bugsys->lang->string('Password'), 'password', '', 2, 35, false, true, 'middle');
80 $admin->row_submit('', $bugsys->lang->string('Login'));
81 $admin->table_end();
82 $admin->form_end();
83
84 $admin->page_end();
85 }
86
87 // ###################################################################
88
89 $bugsys->userinfo['adminsession'] = false;
90
91 if ($_COOKIE[COOKIE_PREFIX . 'adminsession'])
92 {
93 if (can_perform('canadminpanel'))
94 {
95 if (md5(md5($bugsys->userinfo['authkey']) . md5(gmdate('F j, Y @ H'))) != $_COOKIE[COOKIE_PREFIX . 'adminsession'])
96 {
97 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
98 admin_login();
99 // do we need this message?
100 $admin->error($lang->string('Invalid admin session has been terminated.'));
101 }
102 else
103 {
104 // renew the cookie
105 $funct->cookie(COOKIE_PREFIX . 'adminsession', md5(md5($bugsys->userinfo['authkey']) . md5(gmdate('F j, Y @ H'))), false);
106 $bugsys->userinfo['adminsession'] = true;
107 }
108 }
109 else
110 {
111 $funct->cookie(COOKIE_PREFIX . 'adminsession', '');
112 admin_login();
113 }
114 }
115
116 if (!$_COOKIE[COOKIE_PREFIX . 'adminsession'])
117 {
118 admin_login();
119 }
120
121 // ###################################################################
122 // TEMPORARY NAVIGATION SYSTEM
123
124 function nav_hook()
125 {
126 global $globalnav, $bugsys;
127
128 $location = parse_url($_SERVER['SCRIPT_URL']);
129 $location['path'] = preg_quote(end(explode('/', $location['path'])));
130 $location['path'] = ((!$location['path']) ? 'index.php' : $location['path']);
131
132 echo "<div class=\"tcat\" style=\"padding: 5px; border-bottom: 4px outset\">\n";
133 echo "\n\t<form action=\"jump.php\" method=\"post\" title=\"navigation\" style=\"display: inline\">";
134 echo "\n\t<span style=\"float: right\"><a href=\"../\">" . $bugsys->lang->string('Tracker Home') . "</a></span>";
135 echo "\n\t\t" . $bugsys->lang->string('Navigation') . ": <select name=\"jumplocation\" onchange=\"this.form.submit()\" class=\"input\">";
136 foreach ($globalnav AS $grouptitle => $links)
137 {
138 echo "\n\t\t<optgroup label=\"$grouptitle\">";
139 foreach ($links AS $title => $url)
140 {
141 $selected = ((preg_match("#$location[path]$#i", $url)) ? ' selected="selected"' : '');
142 echo "\n\t\t\t<option value=\"$url\"$selected>$title</option>";
143 }
144 echo "\n\t\t</optgroup>";
145 }
146 echo "\n\t\t</select>";
147 echo "\n\t\t<input type=\"submit\" name=\"go\" value=\"&nbsp;" . $bugsys->lang->string('Go') . "&nbsp;\" class=\"button\" />";
148 echo "\n\t</form>";
149 echo "\n</div>";
150 }
151
152 /*=====================================================================*\
153 || ###################################################################
154 || # $HeadURL$
155 || # $Id$
156 || ###################################################################
157 \*=====================================================================*/
158 ?>