Changeset 25237 for trunk/include/functions_user.inc.php
- Timestamp:
- Oct 30, 2013, 1:54:46 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_user.inc.php
r25116 r25237 126 126 * @param string $password 127 127 * @param string $mail_adress 128 * @param bool $ with_notifications128 * @param bool $notify_admin 129 129 * @param &array $errors 130 * @param bool $notify_user 130 131 * @return int|bool 131 132 */ 132 function register_user($login, $password, $mail_address, 133 $with_notification = true, &$errors = array()) 133 function register_user($login, $password, $mail_address, $notify_admin=true, &$errors = array(), $notify_user=false) 134 134 { 135 135 global $conf; … … 170 170 } 171 171 172 $errors = trigger_event('register_user_check', 173 $errors, 174 array( 175 'username'=>$login, 176 'password'=>$password, 177 'email'=>$mail_address, 178 ) 179 ); 172 $errors = trigger_event( 173 'register_user_check', 174 $errors, 175 array( 176 'username'=>$login, 177 'password'=>$password, 178 'email'=>$mail_address, 179 ) 180 ); 180 181 181 182 // if no error until here, registration of the user 182 183 if (count($errors) == 0) 183 184 { 184 $insert = 185 array( 186 $conf['user_fields']['username'] => pwg_db_real_escape_string($login), 187 $conf['user_fields']['password'] => $conf['password_hash']($password), 188 $conf['user_fields']['email'] => $mail_address 189 ); 185 $insert = array( 186 $conf['user_fields']['username'] => pwg_db_real_escape_string($login), 187 $conf['user_fields']['password'] => $conf['password_hash']($password), 188 $conf['user_fields']['email'] => $mail_address 189 ); 190 190 191 191 single_insert(USERS_TABLE, $insert); … … 204 204 while ($row = pwg_db_fetch_assoc($result)) 205 205 { 206 207 208 206 $inserts[] = array( 207 'user_id' => $user_id, 208 'group_id' => $row['id'] 209 209 ); 210 210 } … … 216 216 217 217 $override = null; 218 if ($with_notification and $conf['browser_language']) 219 { 220 if ( !get_browser_language($override['language']) ) 218 if ($notify_admin and $conf['browser_language']) 219 { 220 if (!get_browser_language($override['language'])) 221 { 221 222 $override=null; 223 } 222 224 } 223 225 create_user_infos($user_id, $override); 224 226 225 if ($ with_notification and $conf['email_admin_on_new_user'])227 if ($notify_admin and $conf['email_admin_on_new_user']) 226 228 { 227 229 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 228 $admin_url = get_absolute_root_url() 229 .'admin.php?page=user_list&username='.$login; 230 231 $keyargs_content = array 232 ( 230 $admin_url = get_absolute_root_url().'admin.php?page=user_list&username='.$login; 231 232 $keyargs_content = array( 233 233 get_l10n_args('User: %s', stripslashes($login)), 234 234 get_l10n_args('Email: %s', $_POST['mail_address']), 235 235 get_l10n_args('', ''), 236 236 get_l10n_args('Admin: %s', $admin_url) 237 ); 238 239 pwg_mail_notification_admins 240 ( 237 ); 238 239 pwg_mail_notification_admins( 241 240 get_l10n_args('Registration of %s', stripslashes($login)), 242 241 $keyargs_content 243 ); 244 } 245 246 trigger_action('register_user', 242 ); 243 } 244 245 if ($notify_user and email_check_format($mail_address)) 246 { 247 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 248 249 $keyargs_content = array( 250 get_l10n_args('Hello %s,', $login), 251 get_l10n_args('Thank you for registering at %s!', $conf['gallery_title']), 252 get_l10n_args('', ''), 253 get_l10n_args('Here are your connection settings', ''), 254 get_l10n_args('Username: %s', $login), 255 get_l10n_args('Password: %s', $password), 256 get_l10n_args('Email: %s', $mail_address), 257 get_l10n_args('', ''), 258 get_l10n_args('If you think you\'ve received this email in error, please contact us at %s', get_webmaster_mail_address()), 259 ); 260 261 pwg_mail( 262 $mail_address, 263 array( 264 'subject' => '['.$conf['gallery_title'].'] '.l10n('Registration'), 265 'content' => l10n_args($keyargs_content), 266 'content_format' => 'text/plain', 267 ) 268 ); 269 } 270 271 trigger_action( 272 'register_user', 247 273 array( 248 274 'id'=>$user_id, 249 275 'username'=>$login, 250 276 'email'=>$mail_address, 251 )277 ) 252 278 ); 253 279
Note: See TracChangeset
for help on using the changeset viewer.