/
manage_page.php
232 lines (214 loc) · 6.65 KB
/
manage_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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?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( ADMINISTRATOR );
$f_sort = gpc_get_string( 'sort', 'username' );
$f_dir = gpc_get_string( 'dir', 'DESC' );
$f_hide = gpc_get_bool( 'hide' );
$f_save = gpc_get_bool( 'save' );
# set cookie values for hide, sort by, and dir
if ( isset( $f_save ) ) {
$t_manage_string = $f_hide.':'.$f_sort.':'.$f_dir;
setcookie( $g_manage_cookie, $t_manage_string, time()+$g_cookie_time_length, $g_cookie_path );
} else if ( !is_blank( $g_manage_cookie_val ) ) {
$t_manage_arr = explode( ':', $g_manage_cookie_val );
$f_hide = $t_manage_arr[0];
if ( isset( $t_manage_arr[1] ) ) {
$f_sort = $t_manage_arr[1];
} else {
$f_sort = 'username';
}
if ( isset( $t_manage_arr[2] ) ) {
$f_dir = $t_manage_arr[2];
} else {
$f_dir = 'DESC';
}
}
# Clean up the form variables
$c_sort = addslashes($f_sort);
if ($f_dir == 'ASC') {
$c_dir = 'ASC';
} else {
$c_dir = 'DESC';
}
if ($f_hide == 0) { # a 0 will turn it off
$c_hide = 0;
} else { # anything else (including 'on') will turn it on
$c_hide = 1;
}
?>
<?php print_page_top1() ?>
<?php print_page_top2() ?>
<?php print_manage_menu( 'manage_page.php' ) ?>
<?php # New Accounts Form BEGIN ?>
<?php
$days_old = 7;
$query = "SELECT *
FROM $g_mantis_user_table
WHERE TO_DAYS(NOW()) - TO_DAYS(date_created) <= '$days_old'
ORDER BY date_created DESC";
$result = db_query( $query );
$new_user_count = db_num_rows( $result );
?>
<br />
<table class="width100" cellspacing="1">
<tr>
<td class="form-title">
<?php echo lang_get( 'new_accounts_title' ) ?> (<?php echo lang_get( '1_week_title' ) ?>) [<?php echo $new_user_count ?>]
</td>
</tr>
<tr class="row-2">
<td>
<?php
for ($i=0;$i<$new_user_count;$i++) {
$row = db_fetch_array( $result );
$t_username = $row['username'];
echo $t_username.' : ';
}
?>
</td>
</tr>
</table>
<?php # New Accounts Form END ?>
<?php # Never Logged In Form BEGIN ?>
<?php
$query = "SELECT *
FROM $g_mantis_user_table
WHERE login_count=0
ORDER BY date_created";
$result = db_query( $query );
$user_count = db_num_rows( $result );
?>
<br />
<table class="width100" cellspacing="1">
<tr>
<td class="form-title">
<?php echo lang_get( 'never_logged_in_title' ) ?> [<?php echo $user_count ?>] <?php print_bracket_link( 'manage_prune.php', lang_get( 'prune_accounts' ) ) ?>
</td>
</tr>
<tr class="row-2">
<td>
<?php
for ($i=0;$i<$user_count;$i++) {
$row = db_fetch_array( $result );
$t_username = $row['username'];
echo $t_username.' : ';
}
?>
</td>
</tr>
</table>
<?php # Never Logged In Form END ?>
<?php # Manage Form BEGIN ?>
<?php
# Get the user data in $c_sort order
if ( 0 == $c_hide ) {
$query = "SELECT *, UNIX_TIMESTAMP(date_created) as date_created,
UNIX_TIMESTAMP(last_visit) as last_visit
FROM $g_mantis_user_table
ORDER BY '$c_sort' $c_dir";
} else {
$query = "SELECT *, UNIX_TIMESTAMP(date_created) as date_created,
UNIX_TIMESTAMP(last_visit) as last_visit
FROM $g_mantis_user_table
WHERE (TO_DAYS(NOW()) - TO_DAYS(last_visit) < '$days_old')
ORDER BY '$c_sort' $c_dir";
}
$result = db_query($query);
$user_count = db_num_rows( $result );
?>
<br />
<table class="width100" cellspacing="1">
<tr>
<td class="form-title" colspan="5">
<?php echo lang_get( 'manage_accounts_title' ) ?> [<?php echo $user_count ?>]
<?php print_bracket_link( 'manage_user_create_page.php', lang_get( 'create_new_account_link' ) ) ?>
</td>
<td class="center" colspan="2">
<form method="post" action="manage_page.php">
<input type="hidden" name="sort" value="<?php echo $c_sort ?>" />
<input type="hidden" name="dir" value="<?php echo $c_dir ?>" />
<input type="hidden" name="save" value="1" />
<input type="checkbox" name="hide" value="1" <?php check_checked( $c_hide, 1 ); ?> /> <?php echo lang_get( 'hide_inactive' ) ?>
<input type="submit" value="<?php echo lang_get( 'filter_button' ) ?>" />
</form>
</td>
</tr>
<tr class="row-category">
<td>
<?php print_manage_user_sort_link( 'manage_page.php', lang_get( 'username' ), 'username', $c_dir, $c_sort, $c_hide ) ?>
<?php print_sort_icon( $c_dir, $c_sort, 'username' ) ?>
</td>
<td>
<?php print_manage_user_sort_link( 'manage_page.php', lang_get( 'email' ), 'email', $c_dir, $c_sort, $c_hide ) ?>
<?php print_sort_icon( $c_dir, $c_sort, 'email' ) ?>
</td>
<td>
<?php print_manage_user_sort_link( 'manage_page.php', lang_get( 'access_level' ), 'access_level', $c_dir, $c_sort, $c_hide ) ?>
<?php print_sort_icon( $c_dir, $c_sort, 'access_level' ) ?>
</td>
<td>
<?php print_manage_user_sort_link( 'manage_page.php', lang_get( 'enabled' ), 'enabled', $c_dir, $c_sort, $c_hide ) ?>
<?php print_sort_icon( $c_dir, $c_sort, 'enabled' ) ?>
</td>
<td>
<?php print_manage_user_sort_link( 'manage_page.php', lang_get( 'p' ), 'protected', $c_dir, $c_sort, $c_hide ) ?>
<?php print_sort_icon( $c_dir, $c_sort, 'protected' ) ?>
</td>
<td>
<?php print_manage_user_sort_link( 'manage_page.php', lang_get( 'date_created' ), 'date_created', $c_dir, $c_sort, $c_hide ) ?>
<?php print_sort_icon( $c_dir, $c_sort, 'date_created' ) ?>
</td>
<td>
<?php print_manage_user_sort_link( 'manage_page.php', lang_get( 'last_visit' ), 'last_visit', $c_dir, $c_sort, $c_hide ) ?>
<?php print_sort_icon( $c_dir, $c_sort, 'last_visit' ) ?>
</td>
</tr>
<?php
for ($i=0;$i<$user_count;$i++) {
# prefix user data with u_
$row = db_fetch_array($result);
extract( $row, EXTR_PREFIX_ALL, 'u' );
$u_date_created = date( config_get( 'normal_date_format' ), $u_date_created );
$u_last_visit = date( config_get( 'normal_date_format' ), $u_last_visit );
?>
<tr <?php echo helper_alternate_class( $i ) ?>>
<td>
<a href="manage_user_page.php?user_id=<?php echo $u_id ?>"><?php echo $u_username ?></a>
</td>
<td>
<?php print_email_link( $u_email, $u_email ) ?>
</td>
<td align="center">
<?php echo get_enum_element( 'access_levels', $u_access_level ) ?>
</td>
<td align="center">
<?php echo trans_bool( $u_enabled ) ?>
</td>
<td align="center">
<?php echo trans_bool( $u_protected ) ?>
</td>
<td align="center">
<?php echo $u_date_created ?>
</td>
<td align="center">
<?php echo $u_last_visit ?>
</td>
</tr>
<?php
} # end for
?>
</table>
<?php # Manage Form END ?>
<?php print_page_bot1( __FILE__ ) ?>