Blame Identity/Models/Html/Mantis/1.1.2-1.fc9/manage_user_page.php

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

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

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

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