[ Index ] |
|
Code source de Mantis 1.1.0rc3 |
1 <?php 2 # Mantis - a php based bugtracking system 3 4 # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 5 # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net 6 7 # Mantis 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, either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # Mantis is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with Mantis. If not, see <http://www.gnu.org/licenses/>. 19 20 # -------------------------------------------------------- 21 # $Id: manage_user_page.php,v 1.64.2.1 2007-10-13 22:33:55 giallu Exp $ 22 # -------------------------------------------------------- 23 24 require_once ( 'core.php' ); 25 26 $t_core_path = config_get( 'core_path' ); 27 28 require_once ( $t_core_path . 'icon_api.php' ); 29 30 auth_reauthenticate(); 31 32 access_ensure_global_level( config_get( 'manage_user_threshold' ) ); 33 34 $f_sort = gpc_get_string( 'sort', 'username' ); 35 $f_dir = gpc_get_string( 'dir', 'ASC' ); 36 $f_hide = gpc_get_bool( 'hide' ); 37 $f_save = gpc_get_bool( 'save' ); 38 $f_prefix = strtoupper( gpc_get_string( 'prefix', config_get( 'default_manage_user_prefix' ) ) ); 39 40 $t_user_table = config_get( 'mantis_user_table' ); 41 $t_cookie_name = config_get( 'manage_cookie' ); 42 $t_lock_image = '<img src="' . config_get( 'icon_path' ) . 'protected.gif" width="8" height="15" border="0" alt="' . lang_get( 'protected' ) . '" />'; 43 44 # Clean up the form variables 45 if ( ! in_array( $f_sort, db_field_names( $t_user_table ) ) ) { 46 $c_sort = 'username'; 47 } else { 48 $c_sort = addslashes($f_sort); 49 } 50 51 if ($f_dir == 'ASC') { 52 $c_dir = 'ASC'; 53 } else { 54 $c_dir = 'DESC'; 55 } 56 57 if ($f_hide == 0) { # a 0 will turn it off 58 $c_hide = 0; 59 } else { # anything else (including 'on') will turn it on 60 $c_hide = 1; 61 } 62 # set cookie values for hide, sort by, and dir 63 if ( $f_save ) { 64 $t_manage_string = $c_hide.':'.$c_sort.':'.$c_dir; 65 gpc_set_cookie( $t_cookie_name, $t_manage_string, true ); 66 } else if ( !is_blank( gpc_get_cookie( $t_cookie_name, '' ) ) ) { 67 $t_manage_arr = explode( ':', gpc_get_cookie( $t_cookie_name ) ); 68 $f_hide = $t_manage_arr[0]; 69 70 if ( isset( $t_manage_arr[1] ) ) { 71 $f_sort = $t_manage_arr[1]; 72 } else { 73 $f_sort = 'username'; 74 } 75 76 if ( isset( $t_manage_arr[2] ) ) { 77 $f_dir = $t_manage_arr[2]; 78 } else { 79 $f_dir = 'DESC'; 80 } 81 } 82 83 ?> 84 <?php html_page_top1( lang_get( 'manage_users_link' ) ) ?> 85 <?php html_page_top2() ?> 86 87 <?php print_manage_menu( 'manage_user_page.php' ) ?> 88 89 <?php # New Accounts Form BEGIN ?> 90 <?php 91 $days_old = 7; 92 $query = "SELECT * 93 FROM $t_user_table 94 WHERE ".db_helper_compare_days(db_now(),"date_created","<= '$days_old'")." 95 ORDER BY date_created DESC"; 96 $result = db_query( $query ); 97 $new_user_count = db_num_rows( $result ); 98 99 if ( $new_user_count > 0 ) { 100 ?> 101 <br /> 102 <table class="width100" cellspacing="1"> 103 <tr> 104 <td class="form-title"> 105 <?php echo lang_get( 'new_accounts_title' ) ?> (<?php echo lang_get( '1_week_title' ) ?>) [<?php echo $new_user_count ?>] 106 </td> 107 </tr> 108 <tr <?php echo helper_alternate_class() ?>> 109 <td> 110 <?php 111 for ($i=0;$i<$new_user_count;$i++) { 112 $row = db_fetch_array( $result ); 113 114 if ( $i > 0 ) { 115 echo ' : '; 116 } 117 118 echo '<a href="manage_user_edit_page.php?user_id=', $row['id'], '">', string_display( $row['username'] ), '</a>'; 119 } 120 ?> 121 </td> 122 </tr> 123 </table> 124 <?php } # New Accounts Form END ?> 125 126 <?php # Never Logged In Form BEGIN ?> 127 <?php 128 $query = "SELECT * 129 FROM $t_user_table 130 WHERE ( login_count = 0 ) AND ( date_created = last_visit ) 131 ORDER BY date_created DESC"; 132 $result = db_query( $query ); 133 $user_count = db_num_rows( $result ); 134 135 if ( $user_count > 0 ) { 136 ?> 137 <br /> 138 <table class="width100" cellspacing="1"> 139 <tr> 140 <td class="form-title"> 141 <?php echo lang_get( 'never_logged_in_title' ) ?> [<?php echo $user_count ?>] <?php print_button( 'manage_user_prune.php', lang_get( 'prune_accounts' ) ); ?> 142 </td> 143 </tr> 144 <tr <?php echo helper_alternate_class() ?>> 145 <td> 146 <?php 147 for ($i=0;$i<$user_count;$i++) { 148 $row = db_fetch_array( $result ); 149 150 if ( $i > 0 ) { 151 echo ' : '; 152 } 153 154 echo '<a href="manage_user_edit_page.php?user_id=', $row['id'], '">', string_display( $row['username'] ), '</a>'; 155 } 156 ?> 157 </td> 158 </tr> 159 </table> 160 <?php } # Never Logged In Form END ?> 161 162 <?php # Manage Form BEGIN ?> 163 <?php 164 $t_prefix_array = array( 'ALL' ); 165 166 for ( $i = 'A'; $i != 'AA'; $i++ ) { 167 $t_prefix_array[] = $i; 168 } 169 170 for ( $i = 0; $i <= 9; $i++ ) { 171 $t_prefix_array[] = "$i"; 172 } 173 174 $t_index_links = '<br /><center><table class="width75"><tr>'; 175 foreach ( $t_prefix_array as $t_prefix ) { 176 if ( $t_prefix === 'ALL' ) { 177 $t_caption = lang_get( 'show_all_users' ); 178 } else { 179 $t_caption = $t_prefix; 180 } 181 182 if ( $t_prefix == $f_prefix ) { 183 $t_link = "<strong>$t_caption</strong>"; 184 } else { 185 $t_link = '<a href="manage_user_page.php?prefix=' . $t_prefix .'">' . $t_caption . '</a>'; 186 } 187 $t_index_links .= '<td>' . $t_link . '</td>'; 188 } 189 $t_index_links .= '</tr></table></center>'; 190 191 echo $t_index_links; 192 193 if ( $f_prefix === 'ALL' ) { 194 $t_where = '(1 = 1)'; 195 } else { 196 $c_prefix = db_prepare_string($f_prefix); 197 $t_where = "(username like '$c_prefix%')"; 198 } 199 200 # Get the user data in $c_sort order 201 if ( 0 == $c_hide ) { 202 $query = "SELECT * 203 FROM $t_user_table 204 WHERE $t_where 205 ORDER BY $c_sort $c_dir"; 206 } else { 207 $query = "SELECT * 208 FROM $t_user_table 209 WHERE (" . db_helper_compare_days(db_now(),"last_visit","< '$days_old'") . ") AND $t_where 210 ORDER BY $c_sort $c_dir"; 211 } 212 213 $result = db_query($query); 214 $user_count = db_num_rows( $result ); 215 ?> 216 <br /> 217 <table class="width100" cellspacing="1"> 218 <tr> 219 <td class="form-title" colspan="5"> 220 <?php echo lang_get( 'manage_accounts_title' ) ?> [<?php echo $user_count ?>] 221 <?php print_button( 'manage_user_create_page.php', lang_get( 'create_new_account_link' ) ) ?> 222 </td> 223 <td class="center" colspan="2"> 224 <form method="post" action="manage_user_page.php"> 225 <input type="hidden" name="sort" value="<?php echo $c_sort ?>" /> 226 <input type="hidden" name="dir" value="<?php echo $c_dir ?>" /> 227 <input type="hidden" name="save" value="1" /> 228 <input type="checkbox" name="hide" value="1" <?php check_checked( $c_hide, 1 ); ?> /> <?php echo lang_get( 'hide_inactive' ) ?> 229 <input type="submit" class="button" value="<?php echo lang_get( 'filter_button' ) ?>" /> 230 </form> 231 </td> 232 </tr> 233 <tr class="row-category"> 234 <td> 235 <?php print_manage_user_sort_link( 'manage_user_page.php', lang_get( 'username' ), 'username', $c_dir, $c_sort, $c_hide ) ?> 236 <?php print_sort_icon( $c_dir, $c_sort, 'username' ) ?> 237 </td> 238 <td> 239 <?php print_manage_user_sort_link( 'manage_user_page.php', lang_get( 'realname' ), 'realname', $c_dir, $c_sort, $c_hide ) ?> 240 <?php print_sort_icon( $c_dir, $c_sort, 'realname' ) ?> 241 </td> 242 <td> 243 <?php print_manage_user_sort_link( 'manage_user_page.php', lang_get( 'email' ), 'email', $c_dir, $c_sort, $c_hide ) ?> 244 <?php print_sort_icon( $c_dir, $c_sort, 'email' ) ?> 245 </td> 246 <td> 247 <?php print_manage_user_sort_link( 'manage_user_page.php', lang_get( 'access_level' ), 'access_level', $c_dir, $c_sort, $c_hide ) ?> 248 <?php print_sort_icon( $c_dir, $c_sort, 'access_level' ) ?> 249 </td> 250 <td> 251 <?php print_manage_user_sort_link( 'manage_user_page.php', lang_get( 'enabled' ), 'enabled', $c_dir, $c_sort, $c_hide ) ?> 252 <?php print_sort_icon( $c_dir, $c_sort, 'enabled' ) ?> 253 </td> 254 <td> 255 <?php print_manage_user_sort_link( 'manage_user_page.php', $t_lock_image, 'protected', $c_dir, $c_sort, $c_hide ) ?> 256 <?php print_sort_icon( $c_dir, $c_sort, 'protected' ) ?> 257 </td> 258 <td> 259 <?php print_manage_user_sort_link( 'manage_user_page.php', lang_get( 'date_created' ), 'date_created', $c_dir, $c_sort, $c_hide ) ?> 260 <?php print_sort_icon( $c_dir, $c_sort, 'date_created' ) ?> 261 </td> 262 <td> 263 <?php print_manage_user_sort_link( 'manage_user_page.php', lang_get( 'last_visit' ), 'last_visit', $c_dir, $c_sort, $c_hide ) ?> 264 <?php print_sort_icon( $c_dir, $c_sort, 'last_visit' ) ?> 265 </td> 266 </tr> 267 <?php 268 for ($i=0;$i<$user_count;$i++) { 269 # prefix user data with u_ 270 $row = db_fetch_array($result); 271 extract( $row, EXTR_PREFIX_ALL, 'u' ); 272 273 $u_date_created = date( config_get( 'normal_date_format' ), db_unixtimestamp( $u_date_created ) ); 274 $u_last_visit = date( config_get( 'normal_date_format' ), db_unixtimestamp( $u_last_visit ) ); 275 ?> 276 <tr <?php echo helper_alternate_class( $i ) ?>> 277 <td> 278 <a href="manage_user_edit_page.php?user_id=<?php echo $u_id ?>"><?php echo string_display( $u_username ) ?></a> 279 </td> 280 <td><?php echo string_display( $u_realname ) ?></td> 281 <td><?php print_email_link( $u_email, $u_email ) ?></td> 282 <td><?php echo get_enum_element( 'access_levels', $u_access_level ) ?></td> 283 <td><?php echo trans_bool( $u_enabled ) ?></td> 284 <td class="center"> 285 <?php 286 if ( $u_protected ) { 287 echo " $t_lock_image"; 288 } else { 289 echo ' '; 290 } 291 ?> 292 </td> 293 <td><?php echo $u_date_created ?></td> 294 <td><?php echo $u_last_visit ?></td> 295 </tr> 296 <?php 297 } # end for 298 ?> 299 </table> 300 <?php # Manage Form END ?> 301 302 <?php html_page_bottom1( __FILE__ ) ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |