Blame Identity/Webenv/App/Mantis/1.1.2-1.fc9/manage_user_page.php

f2e824
f2e824
# Mantis - a php based bugtracking system
f2e824
f2e824
# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
f2e824
# Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
f2e824
f2e824
# Mantis is free software: you can redistribute it and/or modify
f2e824
# it under the terms of the GNU General Public License as published by
f2e824
# the Free Software Foundation, either version 2 of the License, or
f2e824
# (at your option) any later version.
f2e824
#
f2e824
# Mantis is distributed in the hope that it will be useful,
f2e824
# but WITHOUT ANY WARRANTY; without even the implied warranty of
f2e824
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f2e824
# GNU General Public License for more details.
f2e824
#
f2e824
# You should have received a copy of the GNU General Public License
f2e824
# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
f2e824
f2e824
	#------------------------------
f2e824
	#   $Revision: 2643 $
f2e824
	#     $Author: al $    
f2e824
	#       $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $  
f2e824
	#------------------------------
f2e824
f2e824
	require_once( 'core.php' );
f2e824
f2e824
	$t_core_path = config_get( 'core_path' );
f2e824
f2e824
	require_once( $t_core_path . 'icon_api.php' );
f2e824
f2e824
	auth_reauthenticate();
f2e824
f2e824
	access_ensure_global_level( config_get( 'manage_user_threshold' ) );
f2e824
f2e824
	$f_sort	= gpc_get_string( 'sort', 'username' );
f2e824
	$f_dir	= gpc_get_string( 'dir', 'ASC' );
f2e824
	$f_hide = gpc_get_bool( 'hide' );
f2e824
	$f_save = gpc_get_bool( 'save' );
f2e824
	$f_prefix = strtoupper( gpc_get_string( 'prefix', config_get( 'default_manage_user_prefix' ) ) );
f2e824
f2e824
	$t_user_table = config_get( 'mantis_user_table' );
f2e824
	$t_cookie_name = config_get( 'manage_cookie' );
f2e824
	$t_lock_image = '' . lang_get( 'protected' ) . '';
f2e824
f2e824
	# Clean up the form variables
f2e824
	if ( ! in_array( $f_sort, db_field_names( $t_user_table ) ) ) {
f2e824
        $c_sort = 'username';
f2e824
    } else {	 
f2e824
        $c_sort = addslashes($f_sort);
f2e824
    }
f2e824
f2e824
	if ($f_dir == 'ASC') {
f2e824
		$c_dir = 'ASC';
f2e824
	} else {
f2e824
		$c_dir = 'DESC';
f2e824
	}
f2e824
f2e824
	if ($f_hide == 0) { # a 0 will turn it off
f2e824
		$c_hide = 0;
f2e824
	} else {            # anything else (including 'on') will turn it on
f2e824
		$c_hide = 1;
f2e824
	}
f2e824
	# set cookie values for hide, sort by, and dir
f2e824
	if ( $f_save ) {
f2e824
		$t_manage_string = $c_hide.':'.$c_sort.':'.$c_dir;
f2e824
		gpc_set_cookie( $t_cookie_name, $t_manage_string, true );
f2e824
	} else if ( !is_blank( gpc_get_cookie( $t_cookie_name, '' ) ) ) {
f2e824
		$t_manage_arr = explode( ':', gpc_get_cookie( $t_cookie_name ) );
f2e824
		$f_hide = $t_manage_arr[0];
f2e824
f2e824
		if ( isset( $t_manage_arr[1] ) ) {
f2e824
			$f_sort = $t_manage_arr[1];
f2e824
		} else {
f2e824
			$f_sort = 'username';
f2e824
		}
f2e824
f2e824
		if ( isset( $t_manage_arr[2] ) ) {
f2e824
			$f_dir  = $t_manage_arr[2];
f2e824
		} else {
f2e824
			$f_dir = 'DESC';
f2e824
		}
f2e824
	}
f2e824
f2e824
?>
f2e824
f2e824
f2e824
f2e824
f2e824
f2e824
f2e824
f2e824
	$days_old = 7;
f2e824
	$query = "SELECT *
f2e824
		FROM $t_user_table
f2e824
		WHERE ".db_helper_compare_days(db_now(),"date_created","<= '$days_old'")."
f2e824
		ORDER BY date_created DESC";
f2e824
	$result = db_query( $query );
f2e824
	$new_user_count = db_num_rows( $result );
f2e824
f2e824
	if ( $new_user_count > 0 ) {
f2e824
?>
f2e824

f2e824
f2e824
f2e824
	
f2e824
		 () []
f2e824
	
f2e824
f2e824
>
f2e824
	
f2e824
f2e824
for ($i=0;$i<$new_user_count;$i++) {
f2e824
	$row = db_fetch_array( $result );
f2e824
f2e824
	if ( $i > 0 ) {
f2e824
		echo ' : ';
f2e824
	}
f2e824
f2e824
	echo '', string_display( $row['username'] ), '';
f2e824
}
f2e824
?>
f2e824
	
f2e824
f2e824
f2e824
f2e824
f2e824
f2e824
f2e824
	$query = "SELECT *
f2e824
		FROM $t_user_table
f2e824
		WHERE ( login_count = 0 ) AND ( date_created = last_visit )
f2e824
		ORDER BY date_created DESC";
f2e824
	$result = db_query( $query );
f2e824
	$user_count = db_num_rows( $result );
f2e824
f2e824
	if ( $user_count > 0 ) {
f2e824
?>
f2e824

f2e824
f2e824
f2e824
	
f2e824
		 [] 
f2e824
	
f2e824
f2e824
>
f2e824
	
f2e824
f2e824
	for ($i=0;$i<$user_count;$i++) {
f2e824
		$row = db_fetch_array( $result );
f2e824
f2e824
		if ( $i > 0 ) {
f2e824
			echo ' : ';
f2e824
		}
f2e824
f2e824
		echo '', string_display( $row['username'] ), '';
f2e824
	}
f2e824
?>
f2e824
	
f2e824
f2e824
f2e824
f2e824
f2e824
f2e824
f2e824
	$t_prefix_array = array( 'ALL' );
f2e824
f2e824
	for ( $i = 'A'; $i != 'AA'; $i++ ) {
f2e824
		$t_prefix_array[] = $i;
f2e824
	}
f2e824
f2e824
	for ( $i = 0; $i <= 9; $i++ ) {
f2e824
		$t_prefix_array[] = "$i";
f2e824
	}
f2e824
f2e824
	$t_index_links = '
<center>';
f2e824
	foreach ( $t_prefix_array as $t_prefix ) {
f2e824
		if ( $t_prefix === 'ALL' ) {
f2e824
			$t_caption = lang_get( 'show_all_users' );
f2e824
		} else {
f2e824
			$t_caption = $t_prefix;
f2e824
		}
f2e824
f2e824
		if ( $t_prefix == $f_prefix ) {
f2e824
			$t_link = "$t_caption";
f2e824
		} else {
f2e824
			$t_link = '' . $t_caption . '';
f2e824
		}
f2e824
		$t_index_links .= '' . $t_link . '';
f2e824
	}
f2e824
	$t_index_links .= '</center>';
f2e824
f2e824
	echo $t_index_links;
f2e824
f2e824
	if ( $f_prefix === 'ALL' ) {
f2e824
		$t_where = '(1 = 1)';
f2e824
	} else {
f2e824
		$c_prefix = db_prepare_string($f_prefix);
f2e824
		$t_where = "(username like '$c_prefix%')";
f2e824
	}
f2e824
f2e824
	# Get the user data in $c_sort order
f2e824
	if ( 0 == $c_hide ) {
f2e824
		$query = "SELECT *
f2e824
				FROM $t_user_table
f2e824
				WHERE $t_where
f2e824
				ORDER BY $c_sort $c_dir";
f2e824
	} else {
f2e824
		$query = "SELECT *
f2e824
				FROM $t_user_table
f2e824
				WHERE (" . db_helper_compare_days(db_now(),"last_visit","< '$days_old'") . ") AND $t_where
f2e824
				ORDER BY $c_sort $c_dir";
f2e824
	}
f2e824
f2e824
    $result = db_query($query);
f2e824
	$user_count = db_num_rows( $result );
f2e824
?>
f2e824

f2e824
f2e824
f2e824
	
f2e824
		 []
f2e824
		
f2e824
	
f2e824
	
f2e824
		<form method="post" action="manage_user_page.php">
f2e824
		<input type="hidden" name="sort" value="<?php echo $c_sort ?>" />
f2e824
		<input type="hidden" name="dir" value="<?php echo $c_dir ?>" />
f2e824
		<input type="hidden" name="save" value="1" />
f2e824
		<label title="<?php echo lang_get( 'hide_inactive' ); ?>"><input type="checkbox" name="hide" value="1" <?php check_checked( $c_hide, 1 ); ?> /> </label>
f2e824
		<input type="submit" class="button" value="<?php echo lang_get( 'filter_button' ) ?>" />
f2e824
		</form>
f2e824
	
f2e824
f2e824
f2e824
	
f2e824
		
f2e824
		
f2e824
	
f2e824
	
f2e824
		
f2e824
		
f2e824
	
f2e824
	
f2e824
		
f2e824
		
f2e824
	
f2e824
	
f2e824
		
f2e824
		
f2e824
	
f2e824
	
f2e824
		
f2e824
		
f2e824
	
f2e824
	
f2e824
		
f2e824
		
f2e824
	
f2e824
	
f2e824
		
f2e824
		
f2e824
	
f2e824
	
f2e824
		
f2e824
		
f2e824
	
f2e824
f2e824
f2e824
	for ($i=0;$i<$user_count;$i++) {
f2e824
		# prefix user data with u_
f2e824
		$row = db_fetch_array($result);
f2e824
		extract( $row, EXTR_PREFIX_ALL, 'u' );
f2e824
f2e824
		$u_date_created  = date( config_get( 'normal_date_format' ), db_unixtimestamp( $u_date_created ) );
f2e824
		$u_last_visit    = date( config_get( 'normal_date_format' ), db_unixtimestamp( $u_last_visit ) );
f2e824
?>
f2e824
>
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
	
f2e824
	
f2e824
	
f2e824
	
f2e824
          
f2e824
		if ( $u_protected ) {
f2e824
			echo " $t_lock_image";
f2e824
		} else {
f2e824
			echo ' ';
f2e824
		}
f2e824
          ?>
f2e824
        
f2e824
	
f2e824
	
f2e824
f2e824
f2e824
	}  # end for
f2e824
?>
f2e824
f2e824
f2e824
f2e824