|
|
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.'email_api.php' );
|
|
|
f2e824 |
|
|
|
f2e824 |
auth_reauthenticate();
|
|
|
f2e824 |
access_ensure_global_level( config_get( 'manage_user_threshold' ) );
|
|
|
f2e824 |
|
|
|
f2e824 |
$f_username = gpc_get_string( 'username' );
|
|
|
f2e824 |
$f_realname = gpc_get_string( 'realname' );
|
|
|
f2e824 |
$f_password = gpc_get_string( 'password', '' );
|
|
|
f2e824 |
$f_password_verify = gpc_get_string( 'password_verify', '' );
|
|
|
f2e824 |
$f_email = gpc_get_string( 'email' );
|
|
|
f2e824 |
$f_access_level = gpc_get_string( 'access_level' );
|
|
|
f2e824 |
$f_protected = gpc_get_bool( 'protected' );
|
|
|
f2e824 |
$f_enabled = gpc_get_bool( 'enabled' );
|
|
|
f2e824 |
|
|
|
f2e824 |
# check for empty username
|
|
|
f2e824 |
$f_username = trim( $f_username );
|
|
|
f2e824 |
if ( is_blank( $f_username ) ) {
|
|
|
f2e824 |
trigger_error( ERROR_EMPTY_FIELD, ERROR );
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
# Check the name for validity here so we do it before promting to use a
|
|
|
f2e824 |
# blank password (don't want to prompt the user if the process will fail
|
|
|
f2e824 |
# anyway)
|
|
|
f2e824 |
user_ensure_name_valid( $f_username );
|
|
|
f2e824 |
user_ensure_realname_valid( $f_realname );
|
|
|
f2e824 |
|
|
|
f2e824 |
if ( $f_password != $f_password_verify ) {
|
|
|
f2e824 |
trigger_error( ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR );
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$f_email = email_append_domain( $f_email );
|
|
|
f2e824 |
email_ensure_not_disposable( $f_email );
|
|
|
f2e824 |
|
|
|
f2e824 |
if ( ( ON == config_get( 'send_reset_password' ) ) && ( ON == config_get( 'enable_email_notification' ) ) ) {
|
|
|
f2e824 |
# Check code will be sent to the user directly via email. Dummy password set to random
|
|
|
f2e824 |
# Create random password
|
|
|
f2e824 |
$t_seed = $f_email . $f_username;
|
|
|
f2e824 |
$f_password = auth_generate_random_password( $t_seed );
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else {
|
|
|
f2e824 |
# Password won't to be sent by email. It entered by the admin
|
|
|
f2e824 |
# Now, if the password is empty, confirm that that is what we wanted
|
|
|
f2e824 |
if ( is_blank( $f_password ) ) {
|
|
|
f2e824 |
helper_ensure_confirmed( lang_get( 'empty_password_sure_msg' ),
|
|
|
f2e824 |
lang_get( 'empty_password_button' ) );
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
form_security_validate( 'manage_user_create' );
|
|
|
f2e824 |
|
|
|
f2e824 |
$t_cookie = user_create( $f_username, $f_password, $f_email, $f_access_level, $f_protected, $f_enabled, $f_realname );
|
|
|
f2e824 |
|
|
|
f2e824 |
if ( $t_cookie === false ) {
|
|
|
f2e824 |
$t_redirect_url = 'manage_user_page.php';
|
|
|
f2e824 |
} else {
|
|
|
f2e824 |
# ok, we created the user, get the row again
|
|
|
f2e824 |
$t_user_id = user_get_id_by_name( $f_username );
|
|
|
f2e824 |
$t_redirect_url = 'manage_user_edit_page.php?user_id=' . $t_user_id;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
html_page_top1();
|
|
|
f2e824 |
html_meta_redirect( $t_redirect_url );
|
|
|
f2e824 |
html_page_top2();
|
|
|
f2e824 |
?>
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
$t_access_level = get_enum_element( 'access_levels', $f_access_level );
|
|
|
f2e824 |
echo '' . lang_get( 'created_user_part1' ) . ' ' . $f_username . ' ' . lang_get( 'created_user_part2' ) . ' ' . $t_access_level . ' ';
|
|
|
f2e824 |
|
|
|
f2e824 |
print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
|
|
|
f2e824 |
?>
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|