.
/**
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/
/**
* MantisBT Core API's
*/
require_once( 'core.php' );
require_once( 'icon_api.php' );
auth_reauthenticate();
access_ensure_global_level( config_get( 'manage_user_threshold' ) );
$t_user_table = db_get_table( 'mantis_user_table' );
$t_cookie_name = config_get( 'manage_users_cookie' );
$t_lock_image = '';
$c_filter = '';
$f_save = gpc_get_bool( 'save' );
$f_filter = utf8_strtoupper( gpc_get_string( 'filter', config_get( 'default_manage_user_prefix' ) ) );
$f_page_number = gpc_get_int( 'page_number', 1 );
if( !$f_save && !is_blank( gpc_get_cookie( $t_cookie_name, '' ) ) ) {
$t_manage_arr = explode( ':', gpc_get_cookie( $t_cookie_name ) );
# Hide Inactive
$f_hide_inactive = (bool)$t_manage_arr[0];
# Sort field
if ( isset( $t_manage_arr[1] ) ) {
$f_sort = $t_manage_arr[1];
} else {
$f_sort = 'username';
}
# Sort order
if ( isset( $t_manage_arr[2] ) ) {
$f_dir = $t_manage_arr[2];
} else {
$f_dir = 'DESC';
}
# Show Disabled
if ( isset( $t_manage_arr[3] ) ) {
$f_show_disabled = $t_manage_arr[3];
}
} else {
$f_sort = gpc_get_string( 'sort', 'username' );
$f_dir = gpc_get_string( 'dir', 'ASC' );
$f_hide_inactive = gpc_get_bool( 'hideinactive' );
$f_show_disabled = gpc_get_bool( 'showdisabled' );
}
# Clean up the form variables
if ( !db_field_exists( $f_sort, $t_user_table ) ) {
$c_sort = 'username';
} else {
$c_sort = addslashes( $f_sort );
}
$c_dir = ( $f_dir == 'ASC' ) ? 'ASC' : 'DESC';
# 0 = show inactive users, anything else = hide them
$c_hide_inactive = ( $f_hide_inactive == 0 ) ? 0 : 1;
$t_hide_inactive_filter = '&hideinactive=' . $c_hide_inactive;
# 0 = hide disabled users, anything else = show them
$c_show_disabled = ( $f_show_disabled == 0 ) ? 0 : 1;
$t_show_disabled_filter = '&showdisabled=' . $c_show_disabled;
# set cookie values for hide inactive, sort by, dir and show disabled
if ( $f_save ) {
$t_manage_string = $c_hide_inactive.':'.$c_sort.':'.$c_dir.':'.$c_show_disabled;
gpc_set_cookie( $t_cookie_name, $t_manage_string, true );
}
html_page_top( lang_get( 'manage_users_link' ) );
print_manage_menu( 'manage_user_page.php' );
# New Accounts Form BEGIN
$days_old = 7 * SECONDS_PER_DAY;
$query = "SELECT *
FROM $t_user_table
WHERE ".db_helper_compare_days("" . db_now() . "","date_created","<= $days_old")."
ORDER BY date_created DESC";
$result = db_query_bound( $query );
$g_db->debug=false;
$new_user_count = db_num_rows( $result);
# Never Logged In Form BEGIN
$query = "SELECT *
FROM $t_user_table
WHERE ( login_count = 0 ) AND ( date_created = last_visit )
ORDER BY date_created DESC";
$result = db_query_bound( $query );
$unused_user_count = db_num_rows( $result );
# Manage Form BEGIN
$t_prefix_array = array();
$t_prefix_array['ALL'] = lang_get( 'show_all_users' );
for ( $i = 'A'; $i != 'AA'; $i++ ) {
$t_prefix_array[$i] = $i;
}
for ( $i = 0; $i <= 9; $i++ ) {
$t_prefix_array["$i"] = "$i";
}
$t_prefix_array['UNUSED'] = lang_get( 'users_unused' );
$t_prefix_array['NEW'] = lang_get( 'users_new' );
echo '
'; if ( $t_prefix === $f_filter ) { $c_filter = $f_filter; echo "$t_caption"; } else { print_manage_user_sort_link( 'manage_user_page.php', $t_caption, $c_sort, $c_dir, null, $c_hide_inactive, $t_prefix, $c_show_disabled ); } if ( $t_prefix === 'UNUSED' ) { echo ' [' . $unused_user_count . '] (' . lang_get( 'never_logged_in_title' ) . ')'; } else if ( $t_prefix === 'NEW' ) { echo ' [' . $new_user_count . '] (' . lang_get( '1_week_title' ) . ')'; } echo ' | '; } echo '