[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file updates the current user's profile! 4 * 5 * This file is part of the evoCore framework - {@link http://evocore.net/} 6 * See also {@link http://sourceforge.net/projects/evocms/}. 7 * 8 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/} 9 * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}. 10 * 11 * {@internal License choice 12 * - If you have received this file as part of a package, please find the license.txt file in 13 * the same folder or the closest folder above for complete license terms. 14 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/) 15 * then you must choose one of the following licenses before using the file: 16 * - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php 17 * - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php 18 * }} 19 * 20 * {@internal Open Source relicensing agreement: 21 * Daniel HAHLER grants Francois PLANQUE the right to license 22 * Daniel HAHLER's contributions to this file and the b2evolution project 23 * under any OSI approved OSS license (http://www.opensource.org/licenses/). 24 * }} 25 * 26 * @package htsrv 27 * 28 * {@internal Below is a list of authors who have contributed to design/coding of this file: }} 29 * @author fplanque: Francois PLANQUE 30 * @author blueyed: Daniel HAHLER 31 * 32 * 33 * @todo integrate it into the skins to avoid ugly die() on error and confusing redirect on success. 34 * 35 * @version $Id: profile_update.php,v 1.50 2007/04/26 00:11:14 fplanque Exp $ 36 */ 37 38 /** 39 * Initialize everything: 40 */ 41 require_once dirname(__FILE__).'/../conf/_config.php'; 42 43 require_once $inc_path.'_main.inc.php'; 44 45 // Getting GET or POST parameters: 46 param( 'checkuser_id', 'integer', '' ); 47 param( 'newuser_firstname', 'string', '' ); 48 param( 'newuser_lastname', 'string', '' ); 49 param( 'newuser_nickname', 'string', '' ); 50 param( 'newuser_idmode', 'string', '' ); 51 param( 'newuser_locale', 'string', $default_locale ); 52 param( 'newuser_icq', 'string', '' ); 53 param( 'newuser_aim', 'string', '' ); 54 param( 'newuser_msn', 'string', '' ); 55 param( 'newuser_yim', 'string', '' ); 56 param( 'newuser_url', 'string', '' ); 57 param( 'newuser_email', 'string', '' ); 58 param( 'newuser_allow_msgform', 'integer', 0 ); // checkbox 59 param( 'newuser_notify', 'integer', 0 ); // checkbox 60 param( 'newuser_showonline', 'integer', 0 ); // checkbox 61 param( 'pass1', 'string', '' ); 62 param( 'pass2', 'string', '' ); 63 64 /** 65 * Basic security checks: 66 */ 67 if( ! is_logged_in() ) 68 { // must be logged in! 69 bad_request_die( T_('You are not logged in.') ); 70 } 71 72 if( $checkuser_id != $current_User->ID ) 73 { // Can only edit your own profile 74 bad_request_die( 'You are not logged in under the same account you are trying to modify.' ); 75 } 76 77 if( $demo_mode && ($current_User->login == 'demouser') ) 78 { 79 bad_request_die( 'Demo mode: you can\'t edit the demouser profile!<br />[<a href="javascript:history.go(-1)">' 80 . T_('Back to profile') . '</a>]' ); 81 } 82 83 /** 84 * Additional checks: 85 */ 86 profile_check_params( array( 87 'nickname' => $newuser_nickname, 88 'icq' => $newuser_icq, 89 'email' => $newuser_email, 90 'url' => $newuser_url, 91 'pass1' => $pass1, 92 'pass2' => $pass2, 93 'pass_required' => false ), $current_User ); 94 95 96 if( $Messages->count('error') ) 97 { 98 header('Content-type: text/html; charset='.$io_charset); 99 // TODO: dh> these error should get displayed with the profile form itself, or at least there should be a "real HTML page" here (without JS-backlink) 100 $Messages->display( T_('Cannot update profile. Please correct the following errors:'), 101 '[<a href="javascript:history.go(-1)">' . T_('Back to profile') . '</a>]' ); 102 debug_info(); 103 exit; 104 } 105 106 107 // Do the update: 108 109 $updatepassword = ''; 110 if( !empty($pass1) ) 111 { 112 $newuser_pass = md5($pass1); 113 $current_User->set( 'pass', $newuser_pass ); 114 } 115 116 $current_User->set( 'firstname', $newuser_firstname ); 117 $current_User->set( 'lastname', $newuser_lastname ); 118 $current_User->set( 'nickname', $newuser_nickname ); 119 $current_User->set( 'icq', $newuser_icq ); 120 $current_User->set_email( $newuser_email ); 121 $current_User->set( 'url', $newuser_url ); 122 $current_User->set( 'aim', $newuser_aim ); 123 $current_User->set( 'msn', $newuser_msn ); 124 $current_User->set( 'yim', $newuser_yim ); 125 $current_User->set( 'idmode', $newuser_idmode ); 126 $current_User->set( 'locale', $newuser_locale ); 127 $current_User->set( 'allow_msgform', $newuser_allow_msgform ); 128 $current_User->set( 'notify', $newuser_notify ); 129 $current_User->set( 'showonline', $newuser_showonline ); 130 131 132 // Set Messages into user's session, so they get restored on the next page (after redirect): 133 if( $current_User->dbupdate() ) 134 { 135 $Messages->add( T_('Your profile has been updated.'), 'success' ); 136 } 137 else 138 { 139 $Messages->add( T_('Your profile has not been changed.'), 'note' ); 140 } 141 142 143 header_nocache(); 144 // redirect Will save $Messages into Session: 145 header_redirect(); 146 147 /* 148 * $Log: profile_update.php,v $ 149 * Revision 1.50 2007/04/26 00:11:14 fplanque 150 * (c) 2007 151 * 152 * Revision 1.49 2007/01/27 19:52:51 blueyed 153 * Fixed charset when displaying errors 154 * 155 * Revision 1.48 2006/11/26 02:30:38 fplanque 156 * doc / todo 157 * 158 * Revision 1.47 2006/11/24 18:27:22 blueyed 159 * Fixed link to b2evo CVS browsing interface in file docblocks 160 * 161 * Revision 1.46 2006/11/24 18:06:02 blueyed 162 * Handle saving of $Messages centrally in header_redirect() 163 * 164 * Revision 1.45 2006/06/19 20:59:37 fplanque 165 * noone should die anonymously... 166 * 167 * Revision 1.44 2006/04/22 02:36:38 blueyed 168 * Validate users on registration through email link (+cleanup around it) 169 * 170 * Revision 1.43 2006/04/20 12:15:32 fplanque 171 * no message 172 * 173 * Revision 1.42 2006/04/19 23:50:39 blueyed 174 * Normalized Messages handling (error displaying and transport in Session) 175 * 176 * Revision 1.41 2006/04/19 20:13:48 fplanque 177 * do not restrict to :// (does not catch subdomains, not even www.) 178 * 179 * Revision 1.40 2006/04/11 21:22:25 fplanque 180 * partial cleanup 181 * 182 */ 183 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |