[ Index ] |
|
Code source de Mantis 1.1.0rc3 |
1 <?php 2 # Mantis - a php based bugtracking system 3 4 # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 5 # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net 6 7 # Mantis is free software: you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation, either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # Mantis is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with Mantis. If not, see <http://www.gnu.org/licenses/>. 19 20 # -------------------------------------------------------- 21 # $Id: account_update.php,v 1.41.2.1 2007-10-13 22:32:23 giallu Exp $ 22 # -------------------------------------------------------- 23 ?> 24 <?php 25 # This page updates a user's information 26 # If an account is protected then changes are forbidden 27 # The page gets redirected back to account_page.php 28 ?> 29 <?php 30 require_once ( 'core.php' ); 31 32 $t_core_path = config_get( 'core_path' ); 33 34 require_once( $t_core_path.'email_api.php' ); 35 ?> 36 <?php 37 auth_ensure_user_authenticated(); 38 39 current_user_ensure_unprotected(); 40 ?> 41 <?php 42 $f_email = gpc_get_string( 'email', '' ); 43 $f_realname = gpc_get_string( 'realname', '' ); 44 $f_password = gpc_get_string( 'password', '' ); 45 $f_password_confirm = gpc_get_string( 'password_confirm', '' ); 46 47 $f_email = email_append_domain( $f_email ); 48 49 email_ensure_not_disposable( $f_email ); 50 51 # get the user id once, so that if we decide in the future to enable this for 52 # admins / managers to change details of other users. 53 $t_user_id = auth_get_current_user_id(); 54 55 $t_redirect = 'account_page.php'; 56 57 $t_email_updated = false; 58 $t_password_updated = false; 59 $t_realname_updated = false; 60 61 # @@@ Listing what fields were updated is not standard behaviour of Mantis 62 # it also complicates the code. 63 64 if ( $f_email != user_get_email( $t_user_id ) ) { 65 user_set_email( $t_user_id, $f_email ); 66 $t_email_updated = true; 67 } 68 69 if ( $f_realname != user_get_field( $t_user_id, 'realname' ) ) { 70 # checks for problems with realnames 71 $t_username = user_get_field( $t_user_id, 'username' ); 72 switch ( user_is_realname_unique( $t_username, $f_realname ) ) { 73 case 1: 74 break; 75 case 0: 76 default: 77 trigger_error( ERROR_USER_REAL_MATCH_USER, ERROR ); 78 break; 79 } 80 user_set_realname( $t_user_id, $f_realname ); 81 $t_realname_updated = true; 82 } 83 84 # Update password if the two match and are not empty 85 if ( !is_blank( $f_password ) ) { 86 if ( $f_password != $f_password_confirm ) { 87 trigger_error( ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR ); 88 } else { 89 if ( !auth_does_password_match( $t_user_id, $f_password ) ) { 90 user_set_password( $t_user_id, $f_password ); 91 $t_password_updated = true; 92 } 93 } 94 } 95 96 html_page_top1(); 97 html_meta_redirect( $t_redirect ); 98 html_page_top2(); 99 100 echo '<br /><div align="center">'; 101 102 if ( $t_email_updated ) { 103 echo lang_get( 'email_updated' ) . '<br />'; 104 } 105 106 if ( $t_password_updated ) { 107 echo lang_get( 'password_updated' ) . '<br />'; 108 } 109 110 if ( $t_realname_updated ) { 111 echo lang_get( 'realname_updated' ) . '<br />'; 112 } 113 114 echo lang_get( 'operation_successful' ) . '<br />'; 115 print_bracket_link( $t_redirect, lang_get( 'proceed' ) ); 116 echo '</div>'; 117 html_page_bottom1( __FILE__ ); 118 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |