.
#------------------------------
# $Revision: 2643 $
# $Author: al $
# $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $
#------------------------------
require_once( 'core.php' );
$t_core_path = config_get( 'core_path' );
require_once( $t_core_path . 'icon_api.php' );
auth_reauthenticate();
access_ensure_global_level( config_get( 'manage_user_threshold' ) );
$f_sort = gpc_get_string( 'sort', 'username' );
$f_dir = gpc_get_string( 'dir', 'ASC' );
$f_hide = gpc_get_bool( 'hide' );
$f_save = gpc_get_bool( 'save' );
$f_prefix = strtoupper( gpc_get_string( 'prefix', config_get( 'default_manage_user_prefix' ) ) );
$t_user_table = config_get( 'mantis_user_table' );
$t_cookie_name = config_get( 'manage_cookie' );
$t_lock_image = '';
# Clean up the form variables
if ( ! in_array( $f_sort, db_field_names( $t_user_table ) ) ) {
$c_sort = 'username';
} else {
$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;
}
# set cookie values for hide, sort by, and dir
if ( $f_save ) {
$t_manage_string = $c_hide.':'.$c_sort.':'.$c_dir;
gpc_set_cookie( $t_cookie_name, $t_manage_string, true );
} else if ( !is_blank( gpc_get_cookie( $t_cookie_name, '' ) ) ) {
$t_manage_arr = explode( ':', gpc_get_cookie( $t_cookie_name ) );
$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';
}
}
?>
0 ) {
?>
0 ) {
?>
';
foreach ( $t_prefix_array as $t_prefix ) {
if ( $t_prefix === 'ALL' ) {
$t_caption = lang_get( 'show_all_users' );
} else {
$t_caption = $t_prefix;
}
if ( $t_prefix == $f_prefix ) {
$t_link = "$t_caption";
} else {
$t_link = '' . $t_caption . '';
}
$t_index_links .= '' . $t_link . ' | ';
}
$t_index_links .= '
';
echo $t_index_links;
if ( $f_prefix === 'ALL' ) {
$t_where = '(1 = 1)';
} else {
$c_prefix = db_prepare_string($f_prefix);
$t_where = "(username like '$c_prefix%')";
}
# Get the user data in $c_sort order
if ( 0 == $c_hide ) {
$query = "SELECT *
FROM $t_user_table
WHERE $t_where
ORDER BY $c_sort $c_dir";
} else {
$query = "SELECT *
FROM $t_user_table
WHERE (" . db_helper_compare_days(db_now(),"last_visit","< '$days_old'") . ") AND $t_where
ORDER BY $c_sort $c_dir";
}
$result = db_query($query);
$user_count = db_num_rows( $result );
?>