|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
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 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# GNU General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
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.'email_api.php' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
auth_reauthenticate();
|
|
|
4c79b5 |
access_ensure_global_level( config_get( 'manage_user_threshold' ) );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$f_username = gpc_get_string( 'username' );
|
|
|
4c79b5 |
$f_realname = gpc_get_string( 'realname' );
|
|
|
4c79b5 |
$f_password = gpc_get_string( 'password', '' );
|
|
|
4c79b5 |
$f_password_verify = gpc_get_string( 'password_verify', '' );
|
|
|
4c79b5 |
$f_email = gpc_get_string( 'email' );
|
|
|
4c79b5 |
$f_access_level = gpc_get_string( 'access_level' );
|
|
|
4c79b5 |
$f_protected = gpc_get_bool( 'protected' );
|
|
|
4c79b5 |
$f_enabled = gpc_get_bool( 'enabled' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# check for empty username
|
|
|
4c79b5 |
$f_username = trim( $f_username );
|
|
|
4c79b5 |
if ( is_blank( $f_username ) ) {
|
|
|
4c79b5 |
trigger_error( ERROR_EMPTY_FIELD, ERROR );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# anyway)
|
|
|
4c79b5 |
user_ensure_name_valid( $f_username );
|
|
|
4c79b5 |
user_ensure_realname_valid( $f_realname );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $f_password != $f_password_verify ) {
|
|
|
4c79b5 |
trigger_error( ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$f_email = email_append_domain( $f_email );
|
|
|
4c79b5 |
email_ensure_not_disposable( $f_email );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( ( ON == config_get( 'send_reset_password' ) ) && ( ON == config_get( 'enable_email_notification' ) ) ) {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Create random password
|
|
|
4c79b5 |
$t_seed = $f_email . $f_username;
|
|
|
4c79b5 |
$f_password = auth_generate_random_password( $t_seed );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Now, if the password is empty, confirm that that is what we wanted
|
|
|
4c79b5 |
if ( is_blank( $f_password ) ) {
|
|
|
4c79b5 |
helper_ensure_confirmed( lang_get( 'empty_password_sure_msg' ),
|
|
|
4c79b5 |
lang_get( 'empty_password_button' ) );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
form_security_validate( 'manage_user_create' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_cookie = user_create( $f_username, $f_password, $f_email, $f_access_level, $f_protected, $f_enabled, $f_realname );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $t_cookie === false ) {
|
|
|
4c79b5 |
$t_redirect_url = 'manage_user_page.php';
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_user_id = user_get_id_by_name( $f_username );
|
|
|
4c79b5 |
$t_redirect_url = 'manage_user_edit_page.php?user_id=' . $t_user_id;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
html_page_top1();
|
|
|
4c79b5 |
html_meta_redirect( $t_redirect_url );
|
|
|
4c79b5 |
html_page_top2();
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_access_level = get_enum_element( 'access_levels', $f_access_level );
|
|
|
4c79b5 |
echo '' . lang_get( 'created_user_part1' ) . ' ' . $f_username . ' ' . lang_get( 'created_user_part2' ) . ' ' . $t_access_level . ' ';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|