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

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

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

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

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