2 /***************************************************************************
5 * begin : Saturday, Feb 13, 2001
6 * copyright : (C) 2001 The phpBB Group
7 * email : support@phpbb.com
9 * $Id: usercp_register.php,v 1.20.2.70 2005/12/29 11:51:11 acydburn Exp $
12 ***************************************************************************/
14 /***************************************************************************
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
22 ***************************************************************************/
26 This code has been modified from its original form by psoTFX @ phpbb.com
27 Changes introduce the back-ported phpBB 2.2 visual confirmation code.
29 NOTE: Anyone using the modified code contained within this script MUST include
30 a relevant message such as this in usercp_register.php ... failure to do so
31 will affect a breach of Section 2a of the GPL and our copyright
33 png visual confirmation system : (c) phpBB Group, 2003 : All Rights Reserved
37 if ( !defined('IN_PHPBB') )
39 die("Hacking attempt");
43 $unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#');
44 $unhtml_specialchars_replace = array('>', '<', '"', '&');
46 // ---------------------------------------
47 // Load agreement template since user has not yet
48 // agreed to registration conditions/coppa
52 global $userdata, $template, $lang, $phpbb_root_path, $phpEx;
54 $template->set_filenames(array(
55 'body' => 'agreement.tpl')
58 $template->assign_vars(array(
59 'REGISTRATION' => $lang['Registration'],
60 'AGREEMENT' => $lang['Reg_agreement'],
61 "AGREE_OVER_13" => $lang['Agree_over_13'],
62 "AGREE_UNDER_13" => $lang['Agree_under_13'],
63 'DO_NOT_AGREE' => $lang['Agree_not'],
65 "U_AGREE_OVER13" => append_sid("profile.$phpEx?mode=register&agreed=true"),
66 "U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&agreed=true&coppa=true"))
69 $template->pparse('body');
73 // ---------------------------------------
77 $page_title = ( $mode == 'editprofile' ) ? $lang['Edit_profile'] : $lang['Register'];
79 if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) )
81 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
85 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
88 $coppa = ( empty($HTTP_POST_VARS['coppa']) && empty($HTTP_GET_VARS['coppa']) ) ? 0 : TRUE;
91 // Check and initialize some variables if needed
94 isset($HTTP_POST_VARS['submit']) ||
95 isset($HTTP_POST_VARS['avatargallery']) ||
96 isset($HTTP_POST_VARS['submitavatar']) ||
97 isset($HTTP_POST_VARS['cancelavatar']) ||
100 include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
101 include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
102 include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
104 if ( $mode == 'editprofile' )
106 $user_id = intval($HTTP_POST_VARS['user_id']);
107 $current_email = trim(htmlspecialchars($HTTP_POST_VARS['current_email']));
110 $strip_var_list = array('email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests', 'confirm_code' => 'confirm_code');
112 // Strip all tags from data ... may p**s some people off, bah, strip_tags is
113 // doing the job but can still break HTML output ... have no choice, have
114 // to use htmlspecialchars ... be prepared to be moaned at.
115 while( list($var, $param) = @each($strip_var_list) )
117 if ( !empty($HTTP_POST_VARS[$param]) )
119 $$var = trim(htmlspecialchars($HTTP_POST_VARS[$param]));
123 $username = ( !empty($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
125 $trim_var_list = array('cur_password' => 'cur_password', 'new_password' => 'new_password', 'password_confirm' => 'password_confirm', 'signature' => 'signature');
127 while( list($var, $param) = @each($trim_var_list) )
129 if ( !empty($HTTP_POST_VARS[$param]) )
131 $$var = trim($HTTP_POST_VARS[$param]);
135 $signature = str_replace('<br />', "\n", $signature);
137 // Run some validation on the optional fields. These are pass-by-ref, so they'll be changed to
138 // empty strings if they fail.
139 validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature);
141 $viewemail = ( isset($HTTP_POST_VARS['viewemail']) ) ? ( ($HTTP_POST_VARS['viewemail']) ? TRUE : 0 ) : 0;
142 $allowviewonline = ( isset($HTTP_POST_VARS['hideonline']) ) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : TRUE ) : TRUE;
143 $notifyreply = ( isset($HTTP_POST_VARS['notifyreply']) ) ? ( ($HTTP_POST_VARS['notifyreply']) ? TRUE : 0 ) : 0;
144 $notifypm = ( isset($HTTP_POST_VARS['notifypm']) ) ? ( ($HTTP_POST_VARS['notifypm']) ? TRUE : 0 ) : TRUE;
145 $popup_pm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE;
147 if ( $mode == 'register' )
149 $attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $board_config['allow_sig'];
151 $allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $board_config['allow_html'];
152 $allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $board_config['allow_bbcode'];
153 $allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $board_config['allow_smilies'];
157 $attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $userdata['user_attachsig'];
159 $allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $userdata['user_allowhtml'];
160 $allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $userdata['user_allowbbcode'];
161 $allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $userdata['user_allowsmile'];
164 $user_style = ( isset($HTTP_POST_VARS['style']) ) ? intval($HTTP_POST_VARS['style']) : $board_config['default_style'];
166 if ( !empty($HTTP_POST_VARS['language']) )
168 if ( preg_match('/^[a-z_]+$/i', $HTTP_POST_VARS['language']) )
170 $user_lang = htmlspecialchars($HTTP_POST_VARS['language']);
175 $error_msg = $lang['Fields_empty'];
180 $user_lang = $board_config['default_lang'];
183 $user_timezone = ( isset($HTTP_POST_VARS['timezone']) ) ? doubleval($HTTP_POST_VARS['timezone']) : $board_config['board_timezone'];
185 $sql = "SELECT config_value
186 FROM " . CONFIG_TABLE . "
187 WHERE config_name = 'default_dateformat'";
188 if ( !($result = $db->sql_query($sql)) )
190 message_die(GENERAL_ERROR, 'Could not select default dateformat', '', __LINE__, __FILE__, $sql);
192 $row = $db->sql_fetchrow($result);
193 $board_config['default_dateformat'] = $row['config_value'];
194 $user_dateformat = ( !empty($HTTP_POST_VARS['dateformat']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['dateformat'])) : $board_config['default_dateformat'];
196 $user_avatar_local = ( isset($HTTP_POST_VARS['avatarselect']) && !empty($HTTP_POST_VARS['submitavatar']) && $board_config['allow_avatar_local'] ) ? htmlspecialchars($HTTP_POST_VARS['avatarselect']) : ( ( isset($HTTP_POST_VARS['avatarlocal']) ) ? htmlspecialchars($HTTP_POST_VARS['avatarlocal']) : '' );
197 $user_avatar_category = ( isset($HTTP_POST_VARS['avatarcatname']) && $board_config['allow_avatar_local'] ) ? htmlspecialchars($HTTP_POST_VARS['avatarcatname']) : '' ;
199 $user_avatar_remoteurl = ( !empty($HTTP_POST_VARS['avatarremoteurl']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['avatarremoteurl'])) : '';
200 $user_avatar_upload = ( !empty($HTTP_POST_VARS['avatarurl']) ) ? trim($HTTP_POST_VARS['avatarurl']) : ( ( $HTTP_POST_FILES['avatar']['tmp_name'] != "none") ? $HTTP_POST_FILES['avatar']['tmp_name'] : '' );
201 $user_avatar_name = ( !empty($HTTP_POST_FILES['avatar']['name']) ) ? $HTTP_POST_FILES['avatar']['name'] : '';
202 $user_avatar_size = ( !empty($HTTP_POST_FILES['avatar']['size']) ) ? $HTTP_POST_FILES['avatar']['size'] : 0;
203 $user_avatar_filetype = ( !empty($HTTP_POST_FILES['avatar']['type']) ) ? $HTTP_POST_FILES['avatar']['type'] : '';
205 $user_avatar = ( empty($user_avatar_local) && $mode == 'editprofile' ) ? $userdata['user_avatar'] : '';
206 $user_avatar_type = ( empty($user_avatar_local) && $mode == 'editprofile' ) ? $userdata['user_avatar_type'] : '';
208 if ( (isset($HTTP_POST_VARS['avatargallery']) || isset($HTTP_POST_VARS['submitavatar']) || isset($HTTP_POST_VARS['cancelavatar'])) && (!isset($HTTP_POST_VARS['submit'])) )
210 $username = stripslashes($username);
211 $email = stripslashes($email);
212 $cur_password = htmlspecialchars(stripslashes($cur_password));
213 $new_password = htmlspecialchars(stripslashes($new_password));
214 $password_confirm = htmlspecialchars(stripslashes($password_confirm));
216 $icq = stripslashes($icq);
217 $aim = stripslashes($aim);
218 $msn = stripslashes($msn);
219 $yim = stripslashes($yim);
221 $website = stripslashes($website);
222 $location = stripslashes($location);
223 $occupation = stripslashes($occupation);
224 $interests = stripslashes($interests);
225 $signature = htmlspecialchars(stripslashes($signature));
227 $user_lang = stripslashes($user_lang);
228 $user_dateformat = stripslashes($user_dateformat);
230 if ( !isset($HTTP_POST_VARS['cancelavatar']))
232 $user_avatar = $user_avatar_category . '/' . $user_avatar_local;
233 $user_avatar_type = USER_AVATAR_GALLERY;
239 // Let's make sure the user isn't logged in while registering,
240 // and ensure that they were trying to register a second time
241 // (Prevents double registrations)
243 if ($mode == 'register' && ($userdata['session_logged_in'] || $username == $userdata['username']))
245 message_die(GENERAL_MESSAGE, $lang['Username_taken'], '', __LINE__, __FILE__);
249 // Did the user submit? In this case build a query to update the users profile in the DB
251 if ( isset($HTTP_POST_VARS['submit']) )
253 include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
256 if ( $mode == 'editprofile' )
258 if ( $user_id != $userdata['user_id'] )
261 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Wrong_Profile'];
264 else if ( $mode == 'register' )
266 if ( empty($username) || empty($new_password) || empty($password_confirm) || empty($email) )
269 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
273 if ($board_config['enable_confirm'] && $mode == 'register')
275 if (empty($HTTP_POST_VARS['confirm_id']))
278 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
282 $confirm_id = htmlspecialchars($HTTP_POST_VARS['confirm_id']);
283 if (!preg_match('/^[A-Za-z0-9]+$/', $confirm_id))
289 FROM ' . CONFIRM_TABLE . "
290 WHERE confirm_id = '$confirm_id'
291 AND session_id = '" . $userdata['session_id'] . "'";
292 if (!($result = $db->sql_query($sql)))
294 message_die(GENERAL_ERROR, 'Could not obtain confirmation code', __LINE__, __FILE__, $sql);
297 if ($row = $db->sql_fetchrow($result))
299 // Only compare one char if the zlib-extension is not loaded
300 if (!@extension_loaded('zlib'))
302 $row['code'] = substr($row['code'], -1);
305 if ($row['code'] != $confirm_code)
308 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
312 $sql = 'DELETE FROM ' . CONFIRM_TABLE . "
313 WHERE confirm_id = '$confirm_id'
314 AND session_id = '" . $userdata['session_id'] . "'";
315 if (!$db->sql_query($sql))
317 message_die(GENERAL_ERROR, 'Could not delete confirmation code', __LINE__, __FILE__, $sql);
324 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
326 $db->sql_freeresult($result);
331 if ( !empty($new_password) && !empty($password_confirm) )
333 if ( $new_password != $password_confirm )
336 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
338 else if ( strlen($new_password) > 32 )
341 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_long'];
345 if ( $mode == 'editprofile' )
347 $sql = "SELECT user_password
348 FROM " . USERS_TABLE . "
349 WHERE user_id = $user_id";
350 if ( !($result = $db->sql_query($sql)) )
352 message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
355 $row = $db->sql_fetchrow($result);
357 if ( $row['user_password'] != md5($cur_password) )
360 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
366 $new_password = md5($new_password);
367 $passwd_sql = "user_password = '$new_password', ";
371 else if ( ( empty($new_password) && !empty($password_confirm) ) || ( !empty($new_password) && empty($password_confirm) ) )
374 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
378 // Do a ban check on this email address
380 if ( $email != $userdata['user_email'] || $mode == 'register' )
382 $result = validate_email($email);
383 if ( $result['error'] )
385 $email = $userdata['user_email'];
388 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
391 if ( $mode == 'editprofile' )
393 $sql = "SELECT user_password
394 FROM " . USERS_TABLE . "
395 WHERE user_id = $user_id";
396 if ( !($result = $db->sql_query($sql)) )
398 message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
401 $row = $db->sql_fetchrow($result);
403 if ( $row['user_password'] != md5($cur_password) )
405 $email = $userdata['user_email'];
408 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
414 if ( $board_config['allow_namechange'] || $mode == 'register' )
416 if ( empty($username) )
418 // Error is already triggered, since one field is empty.
421 else if ( $username != $userdata['username'] || $mode == 'register')
423 if (strtolower($username) != strtolower($userdata['username']) || $mode == 'register')
425 $result = validate_username($username);
426 if ( $result['error'] )
429 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
435 $username_sql = "username = '" . str_replace("\'", "''", $username) . "', ";
440 if ( $signature != '' )
442 if ( strlen($signature) > $board_config['max_sig_chars'] )
445 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
448 if ( !isset($signature_bbcode_uid) || $signature_bbcode_uid == '' )
450 $signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
452 $signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
455 if ( $website != '' )
457 rawurlencode($website);
462 if ( isset($HTTP_POST_VARS['avatardel']) && $mode == 'editprofile' )
464 $avatar_sql = user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
467 if ( ( !empty($user_avatar_upload) || !empty($user_avatar_name) ) && $board_config['allow_avatar_upload'] )
469 if ( !empty($user_avatar_upload) )
471 $avatar_mode = (empty($user_avatar_name)) ? 'remote' : 'local';
472 $avatar_sql = user_avatar_upload($mode, $avatar_mode, $userdata['user_avatar'], $userdata['user_avatar_type'], $error, $error_msg, $user_avatar_upload, $user_avatar_name, $user_avatar_size, $user_avatar_filetype);
474 else if ( !empty($user_avatar_name) )
476 $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
479 $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $l_avatar_size;
482 else if ( $user_avatar_remoteurl != '' && $board_config['allow_avatar_remote'] )
484 user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
485 $avatar_sql = user_avatar_url($mode, $error, $error_msg, $user_avatar_remoteurl);
487 else if ( $user_avatar_local != '' && $board_config['allow_avatar_local'] )
489 user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
490 $avatar_sql = user_avatar_gallery($mode, $error, $error_msg, $user_avatar_local, $user_avatar_category);
495 if ( $avatar_sql == '' )
497 $avatar_sql = ( $mode == 'editprofile' ) ? '' : "'', " . USER_AVATAR_NONE;
500 if ( $mode == 'editprofile' )
502 if ( $email != $userdata['user_email'] && $board_config['require_activation'] != USER_ACTIVATION_NONE && $userdata['user_level'] != ADMIN )
506 $user_actkey = gen_rand_string(true);
507 $key_len = 54 - ( strlen($server_url) );
508 $key_len = ( $key_len > 6 ) ? $key_len : 6;
509 $user_actkey = substr($user_actkey, 0, $key_len);
511 if ( $userdata['session_logged_in'] )
513 session_end($userdata['session_id'], $userdata['user_id']);
522 $sql = "UPDATE " . USERS_TABLE . "
523 SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popup_pm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . "
524 WHERE user_id = $user_id";
525 if ( !($result = $db->sql_query($sql)) )
527 message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
533 // The users account has been deactivated, send them an email with a new activation key
535 include($phpbb_root_path . 'includes/emailer.'.$phpEx);
536 $emailer = new emailer($board_config['smtp_delivery']);
538 if ( $board_config['require_activation'] != USER_ACTIVATION_ADMIN )
540 $emailer->from($board_config['board_email']);
541 $emailer->replyto($board_config['board_email']);
543 $emailer->use_template('user_activate', stripslashes($user_lang));
544 $emailer->email_address($email);
545 $emailer->set_subject($lang['Reactivate']);
547 $emailer->assign_vars(array(
548 'SITENAME' => $board_config['sitename'],
549 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
550 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
552 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
557 else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
559 $sql = 'SELECT user_email, user_lang
560 FROM ' . USERS_TABLE . '
561 WHERE user_level = ' . ADMIN;
563 if ( !($result = $db->sql_query($sql)) )
565 message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
568 while ($row = $db->sql_fetchrow($result))
570 $emailer->from($board_config['board_email']);
571 $emailer->replyto($board_config['board_email']);
573 $emailer->email_address(trim($row['user_email']));
574 $emailer->use_template("admin_activate", $row['user_lang']);
575 $emailer->set_subject($lang['Reactivate']);
577 $emailer->assign_vars(array(
578 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
579 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
581 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
586 $db->sql_freeresult($result);
589 $message = $lang['Profile_updated_inactive'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
593 $message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
596 $template->assign_vars(array(
597 "META" => '<meta http-equiv="refresh" content="5;url=' . append_sid("index.$phpEx") . '">')
600 message_die(GENERAL_MESSAGE, $message);
604 $sql = "SELECT MAX(user_id) AS total
605 FROM " . USERS_TABLE;
606 if ( !($result = $db->sql_query($sql)) )
608 message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
611 if ( !($row = $db->sql_fetchrow($result)) )
613 message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
615 $user_id = $row['total'] + 1;
620 $sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
621 VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";
622 if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
624 $user_actkey = gen_rand_string(true);
625 $key_len = 54 - (strlen($server_url));
626 $key_len = ( $key_len > 6 ) ? $key_len : 6;
627 $user_actkey = substr($user_actkey, 0, $key_len);
628 $sql .= "0, '" . str_replace("\'", "''", $user_actkey) . "')";
635 if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
637 message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
640 $sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
641 VALUES ('', 'Personal User', 1, 0)";
642 if ( !($result = $db->sql_query($sql)) )
644 message_die(GENERAL_ERROR, 'Could not insert data into groups table', '', __LINE__, __FILE__, $sql);
647 $group_id = $db->sql_nextid();
649 $sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
650 VALUES ($user_id, $group_id, 0)";
651 if( !($result = $db->sql_query($sql, END_TRANSACTION)) )
653 message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
658 $message = $lang['COPPA'];
659 $email_template = 'coppa_welcome_inactive';
661 else if ( $board_config['require_activation'] == USER_ACTIVATION_SELF )
663 $message = $lang['Account_inactive'];
664 $email_template = 'user_welcome_inactive';
666 else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
668 $message = $lang['Account_inactive_admin'];
669 $email_template = 'admin_welcome_inactive';
673 $message = $lang['Account_added'];
674 $email_template = 'user_welcome';
677 include($phpbb_root_path . 'includes/emailer.'.$phpEx);
678 $emailer = new emailer($board_config['smtp_delivery']);
680 $emailer->from($board_config['board_email']);
681 $emailer->replyto($board_config['board_email']);
683 $emailer->use_template($email_template, stripslashes($user_lang));
684 $emailer->email_address($email);
685 $emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename']));
689 $emailer->assign_vars(array(
690 'SITENAME' => $board_config['sitename'],
691 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
692 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
693 'PASSWORD' => $password_confirm,
694 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
696 'FAX_INFO' => $board_config['coppa_fax'],
697 'MAIL_INFO' => $board_config['coppa_mail'],
698 'EMAIL_ADDRESS' => $email,
703 'WEB_SITE' => $website,
705 'OCC' => $occupation,
706 'INTERESTS' => $interests,
707 'SITENAME' => $board_config['sitename']));
711 $emailer->assign_vars(array(
712 'SITENAME' => $board_config['sitename'],
713 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
714 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
715 'PASSWORD' => $password_confirm,
716 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
718 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
725 if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
727 $sql = "SELECT user_email, user_lang
728 FROM " . USERS_TABLE . "
729 WHERE user_level = " . ADMIN;
731 if ( !($result = $db->sql_query($sql)) )
733 message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
736 while ($row = $db->sql_fetchrow($result))
738 $emailer->from($board_config['board_email']);
739 $emailer->replyto($board_config['board_email']);
741 $emailer->email_address(trim($row['user_email']));
742 $emailer->use_template("admin_activate", $row['user_lang']);
743 $emailer->set_subject($lang['New_account_subject']);
745 $emailer->assign_vars(array(
746 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
747 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
749 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
754 $db->sql_freeresult($result);
757 $message = $message . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
759 message_die(GENERAL_MESSAGE, $message);
760 } // if mode == register
768 // If an error occured we need to stripslashes on returned data
770 $username = stripslashes($username);
771 $email = stripslashes($email);
773 $password_confirm = '';
775 $icq = stripslashes($icq);
776 $aim = str_replace('+', ' ', stripslashes($aim));
777 $msn = stripslashes($msn);
778 $yim = stripslashes($yim);
780 $website = stripslashes($website);
781 $location = stripslashes($location);
782 $occupation = stripslashes($occupation);
783 $interests = stripslashes($interests);
784 $signature = stripslashes($signature);
785 $signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $signature) : $signature;
787 $user_lang = stripslashes($user_lang);
788 $user_dateformat = stripslashes($user_dateformat);
791 else if ( $mode == 'editprofile' && !isset($HTTP_POST_VARS['avatargallery']) && !isset($HTTP_POST_VARS['submitavatar']) && !isset($HTTP_POST_VARS['cancelavatar']) )
793 $user_id = $userdata['user_id'];
794 $username = $userdata['username'];
795 $email = $userdata['user_email'];
797 $password_confirm = '';
799 $icq = $userdata['user_icq'];
800 $aim = str_replace('+', ' ', $userdata['user_aim']);
801 $msn = $userdata['user_msnm'];
802 $yim = $userdata['user_yim'];
804 $website = $userdata['user_website'];
805 $location = $userdata['user_from'];
806 $occupation = $userdata['user_occ'];
807 $interests = $userdata['user_interests'];
808 $signature_bbcode_uid = $userdata['user_sig_bbcode_uid'];
809 $signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $userdata['user_sig']) : $userdata['user_sig'];
811 $viewemail = $userdata['user_viewemail'];
812 $notifypm = $userdata['user_notify_pm'];
813 $popup_pm = $userdata['user_popup_pm'];
814 $notifyreply = $userdata['user_notify'];
815 $attachsig = $userdata['user_attachsig'];
816 $allowhtml = $userdata['user_allowhtml'];
817 $allowbbcode = $userdata['user_allowbbcode'];
818 $allowsmilies = $userdata['user_allowsmile'];
819 $allowviewonline = $userdata['user_allow_viewonline'];
821 $user_avatar = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar'] : '';
822 $user_avatar_type = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar_type'] : USER_AVATAR_NONE;
824 $user_style = $userdata['user_style'];
825 $user_lang = $userdata['user_lang'];
826 $user_timezone = $userdata['user_timezone'];
827 $user_dateformat = $userdata['user_dateformat'];
833 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
835 make_jumpbox('viewforum.'.$phpEx);
837 if ( $mode == 'editprofile' )
839 if ( $user_id != $userdata['user_id'] )
842 $error_msg = $lang['Wrong_Profile'];
846 if( isset($HTTP_POST_VARS['avatargallery']) && !$error )
848 include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
850 $avatar_category = ( !empty($HTTP_POST_VARS['avatarcategory']) ) ? htmlspecialchars($HTTP_POST_VARS['avatarcategory']) : '';
852 $template->set_filenames(array(
853 'body' => 'profile_avatar_gallery.tpl')
856 $allowviewonline = !$allowviewonline;
858 display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, $new_password, $cur_password, $password_confirm, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $viewemail, $notifypm, $popup_pm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat, $userdata['session_id']);
862 include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
864 if ( !isset($coppa) )
869 if ( !isset($user_style) )
871 $user_style = $board_config['default_style'];
875 if ( $user_avatar_type )
877 switch( $user_avatar_type )
879 case USER_AVATAR_UPLOAD:
880 $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" />' : '';
882 case USER_AVATAR_REMOTE:
883 $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $user_avatar . '" alt="" />' : '';
885 case USER_AVATAR_GALLERY:
886 $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" />' : '';
891 $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
892 if( $mode == 'editprofile' )
894 $s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />';
896 // Send the users current email address. If they change it, and account activation is turned on
897 // the user account will be disabled and the user will have to reactivate their account.
899 $s_hidden_fields .= '<input type="hidden" name="current_email" value="' . $userdata['user_email'] . '" />';
902 if ( !empty($user_avatar_local) )
904 $s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" /><input type="hidden" name="avatarcatname" value="' . $user_avatar_category . '" />';
907 $html_status = ( $userdata['user_allowhtml'] && $board_config['allow_html'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
908 $bbcode_status = ( $userdata['user_allowbbcode'] && $board_config['allow_bbcode'] ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF'];
909 $smilies_status = ( $userdata['user_allowsmile'] && $board_config['allow_smilies'] ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];
913 $template->set_filenames(array(
914 'reg_header' => 'error_body.tpl')
916 $template->assign_vars(array(
917 'ERROR_MESSAGE' => $error_msg)
919 $template->assign_var_from_handle('ERROR_BOX', 'reg_header');
922 $template->set_filenames(array(
923 'body' => 'profile_add_body.tpl')
926 if ( $mode == 'editprofile' )
928 $template->assign_block_vars('switch_edit_profile', array());
931 if ( ($mode == 'register') || ($board_config['allow_namechange']) )
933 $template->assign_block_vars('switch_namechange_allowed', array());
937 $template->assign_block_vars('switch_namechange_disallowed', array());
941 // Visual Confirmation
943 if (!empty($board_config['enable_confirm']) && $mode == 'register')
945 $sql = 'SELECT session_id
946 FROM ' . SESSIONS_TABLE;
947 if (!($result = $db->sql_query($sql)))
949 message_die(GENERAL_ERROR, 'Could not select session data', '', __LINE__, __FILE__, $sql);
952 if ($row = $db->sql_fetchrow($result))
957 $confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'";
959 while ($row = $db->sql_fetchrow($result));
961 $sql = 'DELETE FROM ' . CONFIRM_TABLE . "
962 WHERE session_id NOT IN ($confirm_sql)";
963 if (!$db->sql_query($sql))
965 message_die(GENERAL_ERROR, 'Could not delete stale confirm data', '', __LINE__, __FILE__, $sql);
968 $db->sql_freeresult($result);
970 $sql = 'SELECT COUNT(session_id) AS attempts
971 FROM ' . CONFIRM_TABLE . "
972 WHERE session_id = '" . $userdata['session_id'] . "'";
973 if (!($result = $db->sql_query($sql)))
975 message_die(GENERAL_ERROR, 'Could not obtain confirm code count', '', __LINE__, __FILE__, $sql);
978 if ($row = $db->sql_fetchrow($result))
980 if ($row['attempts'] > 3)
982 message_die(GENERAL_MESSAGE, $lang['Too_many_registers']);
985 $db->sql_freeresult($result);
987 $confirm_chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');
989 list($usec, $sec) = explode(' ', microtime());
990 mt_srand($sec * $usec);
992 $max_chars = count($confirm_chars) - 1;
994 for ($i = 0; $i < 6; $i++)
996 $code .= $confirm_chars[mt_rand(0, $max_chars)];
999 $confirm_id = md5(uniqid($user_ip));
1001 $sql = 'INSERT INTO ' . CONFIRM_TABLE . " (confirm_id, session_id, code)
1002 VALUES ('$confirm_id', '". $userdata['session_id'] . "', '$code')";
1003 if (!$db->sql_query($sql))
1005 message_die(GENERAL_ERROR, 'Could not insert new confirm code information', '', __LINE__, __FILE__, $sql);
1010 $confirm_image = (@extension_loaded('zlib')) ? '<img src="' . append_sid("profile.$phpEx?mode=confirm&id=$confirm_id") . '" alt="" title="" />' : '<img src="' . append_sid("profile.$phpEx?mode=confirm&id=$confirm_id&c=1") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&id=$confirm_id&c=2") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&id=$confirm_id&c=3") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&id=$confirm_id&c=4") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&id=$confirm_id&c=5") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&id=$confirm_id&c=6") . '" alt="" title="" />';
1011 $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';
1013 $template->assign_block_vars('switch_confirm', array());
1018 // Let's do an overall check for settings/versions which would prevent
1019 // us from doing file uploads....
1021 $ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
1022 $form_enctype = ( @$ini_val('file_uploads') == '0' || strtolower(@$ini_val('file_uploads') == 'off') || phpversion() == '4.0.4pl1' || !$board_config['allow_avatar_upload'] || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' : 'enctype="multipart/form-data"';
1024 $template->assign_vars(array(
1025 'USERNAME' => $username,
1026 'CUR_PASSWORD' => $cur_password,
1027 'NEW_PASSWORD' => $new_password,
1028 'PASSWORD_CONFIRM' => $password_confirm,
1030 'CONFIRM_IMG' => $confirm_image,
1035 'OCCUPATION' => $occupation,
1036 'INTERESTS' => $interests,
1037 'LOCATION' => $location,
1038 'WEBSITE' => $website,
1039 'SIGNATURE' => str_replace('<br />', "\n", $signature),
1040 'VIEW_EMAIL_YES' => ( $viewemail ) ? 'checked="checked"' : '',
1041 'VIEW_EMAIL_NO' => ( !$viewemail ) ? 'checked="checked"' : '',
1042 'HIDE_USER_YES' => ( !$allowviewonline ) ? 'checked="checked"' : '',
1043 'HIDE_USER_NO' => ( $allowviewonline ) ? 'checked="checked"' : '',
1044 'NOTIFY_PM_YES' => ( $notifypm ) ? 'checked="checked"' : '',
1045 'NOTIFY_PM_NO' => ( !$notifypm ) ? 'checked="checked"' : '',
1046 'POPUP_PM_YES' => ( $popup_pm ) ? 'checked="checked"' : '',
1047 'POPUP_PM_NO' => ( !$popup_pm ) ? 'checked="checked"' : '',
1048 'ALWAYS_ADD_SIGNATURE_YES' => ( $attachsig ) ? 'checked="checked"' : '',
1049 'ALWAYS_ADD_SIGNATURE_NO' => ( !$attachsig ) ? 'checked="checked"' : '',
1050 'NOTIFY_REPLY_YES' => ( $notifyreply ) ? 'checked="checked"' : '',
1051 'NOTIFY_REPLY_NO' => ( !$notifyreply ) ? 'checked="checked"' : '',
1052 'ALWAYS_ALLOW_BBCODE_YES' => ( $allowbbcode ) ? 'checked="checked"' : '',
1053 'ALWAYS_ALLOW_BBCODE_NO' => ( !$allowbbcode ) ? 'checked="checked"' : '',
1054 'ALWAYS_ALLOW_HTML_YES' => ( $allowhtml ) ? 'checked="checked"' : '',
1055 'ALWAYS_ALLOW_HTML_NO' => ( !$allowhtml ) ? 'checked="checked"' : '',
1056 'ALWAYS_ALLOW_SMILIES_YES' => ( $allowsmilies ) ? 'checked="checked"' : '',
1057 'ALWAYS_ALLOW_SMILIES_NO' => ( !$allowsmilies ) ? 'checked="checked"' : '',
1058 'ALLOW_AVATAR' => $board_config['allow_avatar_upload'],
1059 'AVATAR' => $avatar_img,
1060 'AVATAR_SIZE' => $board_config['avatar_filesize'],
1061 'LANGUAGE_SELECT' => language_select($user_lang, 'language'),
1062 'STYLE_SELECT' => style_select($user_style, 'style'),
1063 'TIMEZONE_SELECT' => tz_select($user_timezone, 'timezone'),
1064 'DATE_FORMAT' => $user_dateformat,
1065 'HTML_STATUS' => $html_status,
1066 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
1067 'SMILIES_STATUS' => $smilies_status,
1069 'L_CURRENT_PASSWORD' => $lang['Current_password'],
1070 'L_NEW_PASSWORD' => ( $mode == 'register' ) ? $lang['Password'] : $lang['New_password'],
1071 'L_CONFIRM_PASSWORD' => $lang['Confirm_password'],
1072 'L_CONFIRM_PASSWORD_EXPLAIN' => ( $mode == 'editprofile' ) ? $lang['Confirm_password_explain'] : '',
1073 'L_PASSWORD_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_if_changed'] : '',
1074 'L_PASSWORD_CONFIRM_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_confirm_if_changed'] : '',
1075 'L_SUBMIT' => $lang['Submit'],
1076 'L_RESET' => $lang['Reset'],
1077 'L_ICQ_NUMBER' => $lang['ICQ'],
1078 'L_MESSENGER' => $lang['MSNM'],
1079 'L_YAHOO' => $lang['YIM'],
1080 'L_WEBSITE' => $lang['Website'],
1081 'L_AIM' => $lang['AIM'],
1082 'L_LOCATION' => $lang['Location'],
1083 'L_OCCUPATION' => $lang['Occupation'],
1084 'L_BOARD_LANGUAGE' => $lang['Board_lang'],
1085 'L_BOARD_STYLE' => $lang['Board_style'],
1086 'L_TIMEZONE' => $lang['Timezone'],
1087 'L_DATE_FORMAT' => $lang['Date_format'],
1088 'L_DATE_FORMAT_EXPLAIN' => $lang['Date_format_explain'],
1089 'L_YES' => $lang['Yes'],
1090 'L_NO' => $lang['No'],
1091 'L_INTERESTS' => $lang['Interests'],
1092 'L_ALWAYS_ALLOW_SMILIES' => $lang['Always_smile'],
1093 'L_ALWAYS_ALLOW_BBCODE' => $lang['Always_bbcode'],
1094 'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'],
1095 'L_HIDE_USER' => $lang['Hide_user'],
1096 'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
1098 'L_AVATAR_PANEL' => $lang['Avatar_panel'],
1099 'L_AVATAR_EXPLAIN' => sprintf($lang['Avatar_explain'], $board_config['avatar_max_width'], $board_config['avatar_max_height'], (round($board_config['avatar_filesize'] / 1024))),
1100 'L_UPLOAD_AVATAR_FILE' => $lang['Upload_Avatar_file'],
1101 'L_UPLOAD_AVATAR_URL' => $lang['Upload_Avatar_URL'],
1102 'L_UPLOAD_AVATAR_URL_EXPLAIN' => $lang['Upload_Avatar_URL_explain'],
1103 'L_AVATAR_GALLERY' => $lang['Select_from_gallery'],
1104 'L_SHOW_GALLERY' => $lang['View_avatar_gallery'],
1105 'L_LINK_REMOTE_AVATAR' => $lang['Link_remote_Avatar'],
1106 'L_LINK_REMOTE_AVATAR_EXPLAIN' => $lang['Link_remote_Avatar_explain'],
1107 'L_DELETE_AVATAR' => $lang['Delete_Image'],
1108 'L_CURRENT_IMAGE' => $lang['Current_Image'],
1110 'L_SIGNATURE' => $lang['Signature'],
1111 'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars']),
1112 'L_NOTIFY_ON_REPLY' => $lang['Always_notify'],
1113 'L_NOTIFY_ON_REPLY_EXPLAIN' => $lang['Always_notify_explain'],
1114 'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'],
1115 'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'],
1116 'L_POPUP_ON_PRIVMSG_EXPLAIN' => $lang['Popup_on_privmsg_explain'],
1117 'L_PREFERENCES' => $lang['Preferences'],
1118 'L_PUBLIC_VIEW_EMAIL' => $lang['Public_view_email'],
1119 'L_ITEMS_REQUIRED' => $lang['Items_required'],
1120 'L_REGISTRATION_INFO' => $lang['Registration_info'],
1121 'L_PROFILE_INFO' => $lang['Profile_info'],
1122 'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'],
1123 'L_EMAIL_ADDRESS' => $lang['Email_address'],
1125 'L_CONFIRM_CODE_IMPAIRED' => sprintf($lang['Confirm_code_impaired'], '<a href="mailto:' . $board_config['board_email'] . '">', '</a>'),
1126 'L_CONFIRM_CODE' => $lang['Confirm_code'],
1127 'L_CONFIRM_CODE_EXPLAIN' => $lang['Confirm_code_explain'],
1129 'S_ALLOW_AVATAR_UPLOAD' => $board_config['allow_avatar_upload'],
1130 'S_ALLOW_AVATAR_LOCAL' => $board_config['allow_avatar_local'],
1131 'S_ALLOW_AVATAR_REMOTE' => $board_config['allow_avatar_remote'],
1132 'S_HIDDEN_FIELDS' => $s_hidden_fields,
1133 'S_FORM_ENCTYPE' => $form_enctype,
1134 'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
1138 // This is another cheat using the block_var capability
1139 // of the templates to 'fake' an IF...ELSE...ENDIF solution
1142 if ( $mode != 'register' )
1144 if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
1146 $template->assign_block_vars('switch_avatar_block', array() );
1148 if ( $board_config['allow_avatar_upload'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_path'])) )
1150 if ( $form_enctype != '' )
1152 $template->assign_block_vars('switch_avatar_block.switch_avatar_local_upload', array() );
1154 $template->assign_block_vars('switch_avatar_block.switch_avatar_remote_upload', array() );
1157 if ( $board_config['allow_avatar_remote'] )
1159 $template->assign_block_vars('switch_avatar_block.switch_avatar_remote_link', array() );
1162 if ( $board_config['allow_avatar_local'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_gallery_path'])) )
1164 $template->assign_block_vars('switch_avatar_block.switch_avatar_local_gallery', array() );
1170 $template->pparse('body');
1172 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);