/
proj_user_menu_page.php
168 lines (153 loc) · 4.07 KB
/
proj_user_menu_page.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2003 Mantis Team - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
?>
<?php
require_once( 'core.php' );
$t_core_path = config_get( 'core_path' );
require_once( $t_core_path . 'icon_api.php' );
?>
<?php login_cookie_check() ?>
<?php
check_access( MANAGER );
$f_sort = gpc_get_string( 'sort', 'username' );
$f_dir = gpc_get_string( 'dir', 'DESC' );
# These pages are invalid for the 'All Project' selection
if ( '0000000' == $g_project_cookie_val ) {
print_header_redirect( 'login_select_proj_page.php' );
}
check_varset( $f_sort, 'username' );
check_varset( $f_dir, 'DESC' );
# Clean up the form variables
$c_sort = addslashes($f_sort);
if ($f_dir == 'ASC') {
$c_dir = 'ASC';
} else {
$c_dir = 'DESC';
}
?>
<?php print_page_top1() ?>
<?php print_page_top2() ?>
<?php
$t_project_view_state = project_get_field( $g_project_cookie_val, 'view_state' );
if ( PUBLIC == $t_project_view_state ) {
$t_msg = $s_public_project_msg;
} else {
$t_msg = $s_private_project_msg;
}
?>
<br />
<div align="center">
<table class="width75" cellspacing="1">
<tr>
<td class="center">
<?php echo $t_msg ?>
</td>
</tr>
</table>
</div>
<br />
<div align="center">
<form method="post" action="proj_user_add.php">
<table class="width75" cellspacing="1">
<tr>
<td class="form-title" colspan="5">
<?php echo $s_add_user_title ?>
</td>
</tr>
<tr class="row-1" valign="top">
<td class="category">
<?php echo $s_username ?>
</td>
<td>
<select name="user_id[]" multiple size="10">
<?php print_project_user_list_option_list() ?>
</select>
</td>
<td class="category">
<?php echo $s_access_level ?>
</td>
<td>
<select name="access_level">
<?php # No administrator choice ?>
<?php print_project_access_levels_option_list( config_get( 'default_new_account_access_level' ) ) ?>
</select>
</td>
<td>
<input type="submit" value="<?php echo $s_add_user_button ?>" />
</td>
</tr>
</table>
</form>
</div>
<br />
<div align="center">
<table class="width75" cellspacing="1">
<tr>
<td class="form-title" colspan="4">
<?php echo $s_manage_accounts_title ?>
</td>
</tr>
<tr class="row-category">
<td>
<?php print_manage_user_sort_link( 'proj_user_menu_page.php', $s_username, 'username', $c_dir, $c_sort ) ?>
<?php print_sort_icon( $c_dir, $c_sort, 'username' ) ?>
</td>
<td>
<?php print_manage_user_sort_link( 'proj_user_menu_page.php', $s_email, 'email', $c_dir, $c_sort ) ?>
<?php print_sort_icon( $c_dir, $c_sort, 'email' ) ?>
</td>
<td>
<?php print_manage_user_sort_link( 'proj_user_menu_page.php', $s_access_level, 'access_level', $c_dir, $c_sort ) ?>
<?php print_sort_icon( $c_dir, $c_sort, 'access_level' ) ?>
</td>
<td> </td>
</tr>
<?php
$t_adm = ADMINISTRATOR;
$t_pub = PUBLIC;
$query = "SELECT DISTINCT u.id, u.username, u.email
FROM $g_mantis_user_table u,
$g_mantis_project_user_list_table l,
$g_mantis_project_table p
WHERE u.access_level>=$t_adm OR
(p.view_state=$t_pub AND
p.id=$g_project_cookie_val) OR
(u.id=l.user_id AND
l.project_id=$g_project_cookie_val)
ORDER BY u.username";
$result = db_query($query);
$user_count = db_num_rows( $result );
for ($i=0;$i<$user_count;$i++) {
# prefix user data with u_
$row = db_fetch_array($result);
extract( $row, EXTR_PREFIX_ALL, 'u' );
$u_access_level = user_get_access_level( $u_id, helper_get_current_project() );
?>
<tr <?php echo helper_alternate_class( $i ) ?>>
<td>
<?php echo $u_username ?>
</td>
<td>
<?php print_email_link( $u_email, $u_email ) ?>
</td>
<td>
<?php echo get_enum_element( 'access_levels', $u_access_level ) ?>
</td>
<td class="center">
<?php
if ( project_includes_user( helper_get_current_project(), $u_id ) ) {
print_bracket_link( 'proj_user_delete.php?user_id='.$u_id, $s_remove_link );
}
?>
</td>
</tr>
<?php
} # end for
?>
</table>
</div>
<?php print_page_bot1( __FILE__ ) ?>