|
|
4c79b5 |
|
|
|
4c79b5 |
# Mantis - a php based bugtracking system
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
|
|
|
4c79b5 |
# Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Mantis is free software: you can redistribute it and/or modify
|
|
|
4c79b5 |
# it under the terms of the GNU General Public License as published by
|
|
|
4c79b5 |
# the Free Software Foundation, either version 2 of the License, or
|
|
|
4c79b5 |
# (at your option) any later version.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Mantis is distributed in the hope that it will be useful,
|
|
|
4c79b5 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c79b5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
4c79b5 |
# GNU General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# You should have received a copy of the GNU General Public License
|
|
|
4c79b5 |
# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#------------------------------
|
|
|
4c79b5 |
# $Revision: 2643 $
|
|
|
4c79b5 |
# $Author: al $
|
|
|
4c79b5 |
# $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $
|
|
|
4c79b5 |
#------------------------------
|
|
|
4c79b5 |
|
|
|
4c79b5 |
require_once( 'core.php' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_core_path = config_get( 'core_path' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
require_once( $t_core_path . 'icon_api.php' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
auth_reauthenticate();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
access_ensure_global_level( config_get( 'manage_user_threshold' ) );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$f_sort = gpc_get_string( 'sort', 'username' );
|
|
|
4c79b5 |
$f_dir = gpc_get_string( 'dir', 'ASC' );
|
|
|
4c79b5 |
$f_hide = gpc_get_bool( 'hide' );
|
|
|
4c79b5 |
$f_save = gpc_get_bool( 'save' );
|
|
|
4c79b5 |
$f_prefix = strtoupper( gpc_get_string( 'prefix', config_get( 'default_manage_user_prefix' ) ) );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_user_table = config_get( 'mantis_user_table' );
|
|
|
4c79b5 |
$t_cookie_name = config_get( 'manage_cookie' );
|
|
|
4c79b5 |
$t_lock_image = '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Clean up the form variables
|
|
|
4c79b5 |
if ( ! in_array( $f_sort, db_field_names( $t_user_table ) ) ) {
|
|
|
4c79b5 |
$c_sort = 'username';
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$c_sort = addslashes($f_sort);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($f_dir == 'ASC') {
|
|
|
4c79b5 |
$c_dir = 'ASC';
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$c_dir = 'DESC';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($f_hide == 0) { # a 0 will turn it off
|
|
|
4c79b5 |
$c_hide = 0;
|
|
|
4c79b5 |
} else { # anything else (including 'on') will turn it on
|
|
|
4c79b5 |
$c_hide = 1;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
# set cookie values for hide, sort by, and dir
|
|
|
4c79b5 |
if ( $f_save ) {
|
|
|
4c79b5 |
$t_manage_string = $c_hide.':'.$c_sort.':'.$c_dir;
|
|
|
4c79b5 |
gpc_set_cookie( $t_cookie_name, $t_manage_string, true );
|
|
|
4c79b5 |
} else if ( !is_blank( gpc_get_cookie( $t_cookie_name, '' ) ) ) {
|
|
|
4c79b5 |
$t_manage_arr = explode( ':', gpc_get_cookie( $t_cookie_name ) );
|
|
|
4c79b5 |
$f_hide = $t_manage_arr[0];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( isset( $t_manage_arr[1] ) ) {
|
|
|
4c79b5 |
$f_sort = $t_manage_arr[1];
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$f_sort = 'username';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( isset( $t_manage_arr[2] ) ) {
|
|
|
4c79b5 |
$f_dir = $t_manage_arr[2];
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$f_dir = 'DESC';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$days_old = 7;
|
|
|
4c79b5 |
$query = "SELECT *
|
|
|
4c79b5 |
FROM $t_user_table
|
|
|
4c79b5 |
WHERE ".db_helper_compare_days(db_now(),"date_created","<= '$days_old'")."
|
|
|
4c79b5 |
ORDER BY date_created DESC";
|
|
|
4c79b5 |
$result = db_query( $query );
|
|
|
4c79b5 |
$new_user_count = db_num_rows( $result );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $new_user_count > 0 ) {
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
() []
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
for ($i=0;$i<$new_user_count;$i++) {
|
|
|
4c79b5 |
$row = db_fetch_array( $result );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $i > 0 ) {
|
|
|
4c79b5 |
echo ' : ';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo '', string_display( $row['username'] ), '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$query = "SELECT *
|
|
|
4c79b5 |
FROM $t_user_table
|
|
|
4c79b5 |
WHERE ( login_count = 0 ) AND ( date_created = last_visit )
|
|
|
4c79b5 |
ORDER BY date_created DESC";
|
|
|
4c79b5 |
$result = db_query( $query );
|
|
|
4c79b5 |
$user_count = db_num_rows( $result );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $user_count > 0 ) {
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
[]
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
for ($i=0;$i<$user_count;$i++) {
|
|
|
4c79b5 |
$row = db_fetch_array( $result );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $i > 0 ) {
|
|
|
4c79b5 |
echo ' : ';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo '', string_display( $row['username'] ), '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_prefix_array = array( 'ALL' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
for ( $i = 'A'; $i != 'AA'; $i++ ) {
|
|
|
4c79b5 |
$t_prefix_array[] = $i;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
for ( $i = 0; $i <= 9; $i++ ) {
|
|
|
4c79b5 |
$t_prefix_array[] = "$i";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_index_links = ' <center>';
|
|
|
4c79b5 |
foreach ( $t_prefix_array as $t_prefix ) {
|
|
|
4c79b5 |
if ( $t_prefix === 'ALL' ) {
|
|
|
4c79b5 |
$t_caption = lang_get( 'show_all_users' );
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$t_caption = $t_prefix;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $t_prefix == $f_prefix ) {
|
|
|
4c79b5 |
$t_link = "$t_caption";
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$t_link = '' . $t_caption . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$t_index_links .= '' . $t_link . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$t_index_links .= '</center>';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo $t_index_links;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $f_prefix === 'ALL' ) {
|
|
|
4c79b5 |
$t_where = '(1 = 1)';
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$c_prefix = db_prepare_string($f_prefix);
|
|
|
4c79b5 |
$t_where = "(username like '$c_prefix%')";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Get the user data in $c_sort order
|
|
|
4c79b5 |
if ( 0 == $c_hide ) {
|
|
|
4c79b5 |
$query = "SELECT *
|
|
|
4c79b5 |
FROM $t_user_table
|
|
|
4c79b5 |
WHERE $t_where
|
|
|
4c79b5 |
ORDER BY $c_sort $c_dir";
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$query = "SELECT *
|
|
|
4c79b5 |
FROM $t_user_table
|
|
|
4c79b5 |
WHERE (" . db_helper_compare_days(db_now(),"last_visit","< '$days_old'") . ") AND $t_where
|
|
|
4c79b5 |
ORDER BY $c_sort $c_dir";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$result = db_query($query);
|
|
|
4c79b5 |
$user_count = db_num_rows( $result );
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
[]
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
<form method="post" action="manage_user_page.php">
|
|
|
4c79b5 |
<input type="hidden" name="sort" value="<?php echo $c_sort ?>" />
|
|
|
4c79b5 |
<input type="hidden" name="dir" value="<?php echo $c_dir ?>" />
|
|
|
4c79b5 |
<input type="hidden" name="save" value="1" />
|
|
|
4c79b5 |
<label title="<?php echo lang_get( 'hide_inactive' ); ?>"><input type="checkbox" name="hide" value="1" <?php check_checked( $c_hide, 1 ); ?> /> </label>
|
|
|
4c79b5 |
<input type="submit" class="button" value="<?php echo lang_get( 'filter_button' ) ?>" />
|
|
|
4c79b5 |
</form>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
for ($i=0;$i<$user_count;$i++) {
|
|
|
4c79b5 |
# prefix user data with u_
|
|
|
4c79b5 |
$row = db_fetch_array($result);
|
|
|
4c79b5 |
extract( $row, EXTR_PREFIX_ALL, 'u' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$u_date_created = date( config_get( 'normal_date_format' ), db_unixtimestamp( $u_date_created ) );
|
|
|
4c79b5 |
$u_last_visit = date( config_get( 'normal_date_format' ), db_unixtimestamp( $u_last_visit ) );
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $u_protected ) {
|
|
|
4c79b5 |
echo " $t_lock_image";
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
echo ' ';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
} # end for
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|