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.58 2004/11/18 17:49:45 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 // ---------------------------------------
76 $page_title = ( $mode == 'editprofile' ) ? $lang['Edit_profile'] : $lang['Register'];
78 if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) )
80 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
84 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
87 $coppa = ( empty($HTTP_POST_VARS['coppa']) && empty($HTTP_GET_VARS['coppa']) ) ? 0 : TRUE;
90 // Check and initialize some variables if needed
93 isset($HTTP_POST_VARS['submit']) ||
94 isset($HTTP_POST_VARS['avatargallery']) ||
95 isset($HTTP_POST_VARS['submitavatar']) ||
96 isset($HTTP_POST_VARS['cancelavatar']) ||
99 include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
100 include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
101 include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
103 if ( $mode == 'editprofile' )
105 $user_id = intval($HTTP_POST_VARS['user_id']);
106 $current_email = trim(htmlspecialchars($HTTP_POST_VARS['current_email']));
109 $strip_var_list = array('username' => 'username', 'email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests');
110 $strip_var_list['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 $trim_var_list = array('cur_password' => 'cur_password', 'new_password' => 'new_password', 'password_confirm' => 'password_confirm', 'signature' => 'signature');
125 while( list($var, $param) = @each($trim_var_list) )
127 if ( !empty($HTTP_POST_VARS[$param]) )
129 $$var = trim($HTTP_POST_VARS[$param]);
133 $signature = str_replace('<br />', "\n", $signature);
135 // Run some validation on the optional fields. These are pass-by-ref, so they'll be changed to
136 // empty strings if they fail.
137 validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature);
139 $viewemail = ( isset($HTTP_POST_VARS['viewemail']) ) ? ( ($HTTP_POST_VARS['viewemail']) ? TRUE : 0 ) : 0;
140 $allowviewonline = ( isset($HTTP_POST_VARS['hideonline']) ) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : TRUE ) : TRUE;
141 $notifyreply = ( isset($HTTP_POST_VARS['notifyreply']) ) ? ( ($HTTP_POST_VARS['notifyreply']) ? TRUE : 0 ) : 0;
142 $notifypm = ( isset($HTTP_POST_VARS['notifypm']) ) ? ( ($HTTP_POST_VARS['notifypm']) ? TRUE : 0 ) : TRUE;
143 $popup_pm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE;
145 if ( $mode == 'register' )
147 $attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $board_config['allow_sig'];
149 $allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $board_config['allow_html'];
150 $allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $board_config['allow_bbcode'];
151 $allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $board_config['allow_smilies'];
155 $attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : 0;
157 $allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $userdata['user_allowhtml'];
158 $allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $userdata['user_allowbbcode'];
159 $allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $userdata['user_allowsmile'];
162 $user_style = ( isset($HTTP_POST_VARS['style']) ) ? intval($HTTP_POST_VARS['style']) : $board_config['default_style'];
164 if ( !empty($HTTP_POST_VARS['language']) )
166 if ( preg_match('/^[a-z_]+$/i', $HTTP_POST_VARS['language']) )
168 $user_lang = htmlspecialchars($HTTP_POST_VARS['language']);
173 $error_msg = $lang['Fields_empty'];
178 $user_lang = $board_config['default_lang'];
181 $user_timezone = ( isset($HTTP_POST_VARS['timezone']) ) ? doubleval($HTTP_POST_VARS['timezone']) : $board_config['board_timezone'];
183 $sql = "SELECT config_value
184 FROM " . CONFIG_TABLE . "
185 WHERE config_name = 'default_dateformat'";
186 if ( !($result = $db->sql_query($sql)) )
188 message_die(GENERAL_ERROR, 'Could not select default dateformat', '', __LINE__, __FILE__, $sql);
190 $row = $db->sql_fetchrow($result);
191 $board_config['default_dateformat'] = $row['config_value'];
192 $user_dateformat = ( !empty($HTTP_POST_VARS['dateformat']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['dateformat'])) : $board_config['default_dateformat'];
194 $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']) : '' );
196 $user_avatar_remoteurl = ( !empty($HTTP_POST_VARS['avatarremoteurl']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['avatarremoteurl'])) : '';
197 $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'] : '' );
198 $user_avatar_name = ( !empty($HTTP_POST_FILES['avatar']['name']) ) ? $HTTP_POST_FILES['avatar']['name'] : '';
199 $user_avatar_size = ( !empty($HTTP_POST_FILES['avatar']['size']) ) ? $HTTP_POST_FILES['avatar']['size'] : 0;
200 $user_avatar_filetype = ( !empty($HTTP_POST_FILES['avatar']['type']) ) ? $HTTP_POST_FILES['avatar']['type'] : '';
202 $user_avatar = ( empty($user_avatar_loc) && $mode == 'editprofile' ) ? $userdata['user_avatar'] : '';
203 $user_avatar_type = ( empty($user_avatar_loc) && $mode == 'editprofile' ) ? $userdata['user_avatar_type'] : '';
205 if ( (isset($HTTP_POST_VARS['avatargallery']) || isset($HTTP_POST_VARS['submitavatar']) || isset($HTTP_POST_VARS['cancelavatar'])) && (!isset($HTTP_POST_VARS['submit'])) )
207 $username = stripslashes($username);
208 $email = stripslashes($email);
209 $cur_password = htmlspecialchars(stripslashes($cur_password));
210 $new_password = htmlspecialchars(stripslashes($new_password));
211 $password_confirm = htmlspecialchars(stripslashes($password_confirm));
213 $icq = stripslashes($icq);
214 $aim = stripslashes($aim);
215 $msn = stripslashes($msn);
216 $yim = stripslashes($yim);
218 $website = stripslashes($website);
219 $location = stripslashes($location);
220 $occupation = stripslashes($occupation);
221 $interests = stripslashes($interests);
222 $signature = stripslashes($signature);
224 $user_lang = stripslashes($user_lang);
225 $user_dateformat = stripslashes($user_dateformat);
227 if ( !isset($HTTP_POST_VARS['cancelavatar']))
229 $user_avatar = $user_avatar_local;
230 $user_avatar_type = USER_AVATAR_GALLERY;
236 // Let's make sure the user isn't logged in while registering,
237 // and ensure that they were trying to register a second time
238 // (Prevents double registrations)
240 if ($mode == 'register' && ($userdata['session_logged_in'] || $username == $userdata['username']))
242 message_die(GENERAL_MESSAGE, $lang['Username_taken'], '', __LINE__, __FILE__);
246 // Did the user submit? In this case build a query to update the users profile in the DB
248 if ( isset($HTTP_POST_VARS['submit']) )
250 include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
253 if ( $mode == 'editprofile' )
255 if ( $user_id != $userdata['user_id'] )
258 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Wrong_Profile'];
261 else if ( $mode == 'register' )
263 if ( empty($username) || empty($new_password) || empty($password_confirm) || empty($email) )
266 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
270 if ($board_config['enable_confirm'] && $mode == 'register')
272 if (empty($HTTP_POST_VARS['confirm_id']))
275 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
279 $confirm_id = htmlspecialchars($HTTP_POST_VARS['confirm_id']);
280 if (!preg_match('/^[A-Za-z0-9]+$/', $confirm_id))
286 FROM ' . CONFIRM_TABLE . "
287 WHERE confirm_id = '$confirm_id'
288 AND session_id = '" . $userdata['session_id'] . "'";
289 if (!($result = $db->sql_query($sql)))
291 message_die(GENERAL_ERROR, 'Could not obtain confirmation code', __LINE__, __FILE__, $sql);
294 if ($row = $db->sql_fetchrow($result))
296 if ($row['code'] != $confirm_code)
299 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
303 $sql = 'DELETE FROM ' . CONFIRM_TABLE . "
304 WHERE confirm_id = '$confirm_id'
305 AND session_id = '" . $userdata['session_id'] . "'";
306 if (!$db->sql_query($sql))
308 message_die(GENERAL_ERROR, 'Could not delete confirmation code', __LINE__, __FILE__, $sql);
315 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
317 $db->sql_freeresult($result);
322 if ( !empty($new_password) && !empty($password_confirm) )
324 if ( $new_password != $password_confirm )
327 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
329 else if ( strlen($new_password) > 32 )
332 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_long'];
336 if ( $mode == 'editprofile' )
338 $sql = "SELECT user_password
339 FROM " . USERS_TABLE . "
340 WHERE user_id = $user_id";
341 if ( !($result = $db->sql_query($sql)) )
343 message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
346 $row = $db->sql_fetchrow($result);
348 if ( $row['user_password'] != md5($cur_password) )
351 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
357 $new_password = md5($new_password);
358 $passwd_sql = "user_password = '$new_password', ";
362 else if ( ( empty($new_password) && !empty($password_confirm) ) || ( !empty($new_password) && empty($password_confirm) ) )
365 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
369 // Do a ban check on this email address
371 if ( $email != $userdata['user_email'] || $mode == 'register' )
373 $result = validate_email($email);
374 if ( $result['error'] )
376 $email = $userdata['user_email'];
379 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
382 if ( $mode == 'editprofile' )
384 $sql = "SELECT user_password
385 FROM " . USERS_TABLE . "
386 WHERE user_id = $user_id";
387 if ( !($result = $db->sql_query($sql)) )
389 message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
392 $row = $db->sql_fetchrow($result);
394 if ( $row['user_password'] != md5($cur_password) )
396 $email = $userdata['user_email'];
399 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
405 if ( $board_config['allow_namechange'] || $mode == 'register' )
407 if ( empty($username) )
409 // Error is already triggered, since one field is empty.
412 else if ( $username != $userdata['username'] || $mode == 'register' )
414 if (strtolower($username) != strtolower($userdata['username']))
416 $result = validate_username($username);
417 if ( $result['error'] )
420 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
426 $username_sql = "username = '" . str_replace("\'", "''", $username) . "', ";
431 if ( $signature != '' )
433 if ( strlen($signature) > $board_config['max_sig_chars'] )
436 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
439 if ( $signature_bbcode_uid == '' )
441 $signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
443 $signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
446 if ( $website != '' )
448 rawurlencode($website);
453 if ( isset($HTTP_POST_VARS['avatardel']) && $mode == 'editprofile' )
455 $avatar_sql = user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
458 if ( ( !empty($user_avatar_upload) || !empty($user_avatar_name) ) && $board_config['allow_avatar_upload'] )
460 if ( !empty($user_avatar_upload) )
462 $avatar_mode = ( !empty($user_avatar_name) ) ? 'local' : 'remote';
463 $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);
465 else if ( !empty($user_avatar_name) )
467 $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
470 $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $l_avatar_size;
473 else if ( $user_avatar_remoteurl != '' && $board_config['allow_avatar_remote'] )
475 if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) )
477 @unlink(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']));
479 $avatar_sql = user_avatar_url($mode, $error, $error_msg, $user_avatar_remoteurl);
481 else if ( $user_avatar_local != '' && $board_config['allow_avatar_local'] )
483 if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) )
485 @unlink(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']));
487 $avatar_sql = user_avatar_gallery($mode, $error, $error_msg, $user_avatar_local);
492 if ( $avatar_sql == '' )
494 $avatar_sql = ( $mode == 'editprofile' ) ? '' : "'', " . USER_AVATAR_NONE;
497 if ( $mode == 'editprofile' )
499 if ( $email != $userdata['user_email'] && $board_config['require_activation'] != USER_ACTIVATION_NONE && $userdata['user_level'] != ADMIN )
503 $user_actkey = gen_rand_string(true);
504 $key_len = 54 - ( strlen($server_url) );
505 $key_len = ( $key_len > 6 ) ? $key_len : 6;
506 $user_actkey = substr($user_actkey, 0, $key_len);
508 if ( $userdata['session_logged_in'] )
510 session_end($userdata['session_id'], $userdata['user_id']);
519 $sql = "UPDATE " . USERS_TABLE . "
520 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 . "
521 WHERE user_id = $user_id";
522 if ( !($result = $db->sql_query($sql)) )
524 message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
530 // The users account has been deactivated, send them an email with a new activation key
532 include($phpbb_root_path . 'includes/emailer.'.$phpEx);
533 $emailer = new emailer($board_config['smtp_delivery']);
535 $emailer->from($board_config['board_email']);
536 $emailer->replyto($board_config['board_email']);
538 $emailer->use_template('user_activate', stripslashes($user_lang));
539 $emailer->email_address($email);
540 $emailer->set_subject($lang['Reactivate']);
542 $emailer->assign_vars(array(
543 'SITENAME' => $board_config['sitename'],
544 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
545 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
547 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
552 $message = $lang['Profile_updated_inactive'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
556 $message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
559 $template->assign_vars(array(
560 "META" => '<meta http-equiv="refresh" content="5;url=' . append_sid("index.$phpEx") . '">')
563 message_die(GENERAL_MESSAGE, $message);
567 $sql = "SELECT MAX(user_id) AS total
568 FROM " . USERS_TABLE;
569 if ( !($result = $db->sql_query($sql)) )
571 message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
574 if ( !($row = $db->sql_fetchrow($result)) )
576 message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
578 $user_id = $row['total'] + 1;
583 $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)
584 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, ";
585 if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
587 $user_actkey = gen_rand_string(true);
588 $key_len = 54 - (strlen($server_url));
589 $key_len = ( $key_len > 6 ) ? $key_len : 6;
590 $user_actkey = substr($user_actkey, 0, $key_len);
591 $sql .= "0, '" . str_replace("\'", "''", $user_actkey) . "')";
598 if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
600 message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
603 $sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
604 VALUES ('', 'Personal User', 1, 0)";
605 if ( !($result = $db->sql_query($sql)) )
607 message_die(GENERAL_ERROR, 'Could not insert data into groups table', '', __LINE__, __FILE__, $sql);
610 $group_id = $db->sql_nextid();
612 $sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
613 VALUES ($user_id, $group_id, 0)";
614 if( !($result = $db->sql_query($sql, END_TRANSACTION)) )
616 message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
621 $message = $lang['COPPA'];
622 $email_template = 'coppa_welcome_inactive';
624 else if ( $board_config['require_activation'] == USER_ACTIVATION_SELF )
626 $message = $lang['Account_inactive'];
627 $email_template = 'user_welcome_inactive';
629 else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
631 $message = $lang['Account_inactive_admin'];
632 $email_template = 'admin_welcome_inactive';
636 $message = $lang['Account_added'];
637 $email_template = 'user_welcome';
640 include($phpbb_root_path . 'includes/emailer.'.$phpEx);
641 $emailer = new emailer($board_config['smtp_delivery']);
643 $emailer->from($board_config['board_email']);
644 $emailer->replyto($board_config['board_email']);
646 $emailer->use_template($email_template, stripslashes($user_lang));
647 $emailer->email_address($email);
648 $emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename']));
652 $emailer->assign_vars(array(
653 'SITENAME' => $board_config['sitename'],
654 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
655 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
656 'PASSWORD' => $password_confirm,
657 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
659 'FAX_INFO' => $board_config['coppa_fax'],
660 'MAIL_INFO' => $board_config['coppa_mail'],
661 'EMAIL_ADDRESS' => $email,
666 'WEB_SITE' => $website,
668 'OCC' => $occupation,
669 'INTERESTS' => $interests,
670 'SITENAME' => $board_config['sitename']));
674 $emailer->assign_vars(array(
675 'SITENAME' => $board_config['sitename'],
676 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
677 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
678 'PASSWORD' => $password_confirm,
679 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
681 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
688 if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
690 $sql = "SELECT user_email, user_lang
691 FROM " . USERS_TABLE . "
692 WHERE user_level = " . ADMIN;
694 if ( !($result = $db->sql_query($sql)) )
696 message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
699 while ($row = $db->sql_fetchrow($result))
701 $emailer->from($board_config['board_email']);
702 $emailer->replyto($board_config['board_email']);
704 $emailer->email_address(trim($row['user_email']));
705 $emailer->use_template("admin_activate", $row['user_lang']);
706 $emailer->set_subject($lang['New_account_subject']);
708 $emailer->assign_vars(array(
709 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
710 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
712 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
717 $db->sql_freeresult($result);
720 $message = $message . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
722 message_die(GENERAL_MESSAGE, $message);
723 } // if mode == register
731 // If an error occured we need to stripslashes on returned data
733 $username = stripslashes($username);
734 $email = stripslashes($email);
736 $password_confirm = '';
738 $icq = stripslashes($icq);
739 $aim = str_replace('+', ' ', stripslashes($aim));
740 $msn = stripslashes($msn);
741 $yim = stripslashes($yim);
743 $website = stripslashes($website);
744 $location = stripslashes($location);
745 $occupation = stripslashes($occupation);
746 $interests = stripslashes($interests);
747 $signature = stripslashes($signature);
748 $signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $signature) : $signature;
750 $user_lang = stripslashes($user_lang);
751 $user_dateformat = stripslashes($user_dateformat);
754 else if ( $mode == 'editprofile' && !isset($HTTP_POST_VARS['avatargallery']) && !isset($HTTP_POST_VARS['submitavatar']) && !isset($HTTP_POST_VARS['cancelavatar']) )
756 $user_id = $userdata['user_id'];
757 $username = $userdata['username'];
758 $email = $userdata['user_email'];
760 $password_confirm = '';
762 $icq = $userdata['user_icq'];
763 $aim = str_replace('+', ' ', $userdata['user_aim']);
764 $msn = $userdata['user_msnm'];
765 $yim = $userdata['user_yim'];
767 $website = $userdata['user_website'];
768 $location = $userdata['user_from'];
769 $occupation = $userdata['user_occ'];
770 $interests = $userdata['user_interests'];
771 $signature_bbcode_uid = $userdata['user_sig_bbcode_uid'];
772 $signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $userdata['user_sig']) : $userdata['user_sig'];
774 $viewemail = $userdata['user_viewemail'];
775 $notifypm = $userdata['user_notify_pm'];
776 $popup_pm = $userdata['user_popup_pm'];
777 $notifyreply = $userdata['user_notify'];
778 $attachsig = $userdata['user_attachsig'];
779 $allowhtml = $userdata['user_allowhtml'];
780 $allowbbcode = $userdata['user_allowbbcode'];
781 $allowsmilies = $userdata['user_allowsmile'];
782 $allowviewonline = $userdata['user_allow_viewonline'];
784 $user_avatar = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar'] : '';
785 $user_avatar_type = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar_type'] : USER_AVATAR_NONE;
787 $user_style = $userdata['user_style'];
788 $user_lang = $userdata['user_lang'];
789 $user_timezone = $userdata['user_timezone'];
790 $user_dateformat = $userdata['user_dateformat'];
796 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
798 make_jumpbox('viewforum.'.$phpEx);
800 if ( $mode == 'editprofile' )
802 if ( $user_id != $userdata['user_id'] )
805 $error_msg = $lang['Wrong_Profile'];
809 if( isset($HTTP_POST_VARS['avatargallery']) && !$error )
811 include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
813 $avatar_category = ( !empty($HTTP_POST_VARS['avatarcategory']) ) ? htmlspecialchars($HTTP_POST_VARS['avatarcategory']) : '';
815 $template->set_filenames(array(
816 'body' => 'profile_avatar_gallery.tpl')
819 $allowviewonline = !$allowviewonline;
821 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']);
825 include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
827 if ( !isset($coppa) )
832 if ( !isset($user_template) )
834 $selected_template = $board_config['system_template'];
838 if ( $user_avatar_type )
840 switch( $user_avatar_type )
842 case USER_AVATAR_UPLOAD:
843 $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" />' : '';
845 case USER_AVATAR_REMOTE:
846 $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $user_avatar . '" alt="" />' : '';
848 case USER_AVATAR_GALLERY:
849 $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" />' : '';
854 $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
855 if( $mode == 'editprofile' )
857 $s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />';
859 // Send the users current email address. If they change it, and account activation is turned on
860 // the user account will be disabled and the user will have to reactivate their account.
862 $s_hidden_fields .= '<input type="hidden" name="current_email" value="' . $userdata['user_email'] . '" />';
865 if ( !empty($user_avatar_local) )
867 $s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" />';
870 $html_status = ( $userdata['user_allowhtml'] && $board_config['allow_html'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
871 $bbcode_status = ( $userdata['user_allowbbcode'] && $board_config['allow_bbcode'] ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF'];
872 $smilies_status = ( $userdata['user_allowsmile'] && $board_config['allow_smilies'] ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];
876 $template->set_filenames(array(
877 'reg_header' => 'error_body.tpl')
879 $template->assign_vars(array(
880 'ERROR_MESSAGE' => $error_msg)
882 $template->assign_var_from_handle('ERROR_BOX', 'reg_header');
885 $template->set_filenames(array(
886 'body' => 'profile_add_body.tpl')
889 if ( $mode == 'editprofile' )
891 $template->assign_block_vars('switch_edit_profile', array());
894 if ( ($mode == 'register') || ($board_config['allow_namechange']) )
896 $template->assign_block_vars('switch_namechange_allowed', array());
900 $template->assign_block_vars('switch_namechange_disallowed', array());
904 // Visual Confirmation
906 if (!empty($board_config['enable_confirm']) && $mode == 'register')
908 $sql = 'SELECT session_id
909 FROM ' . SESSIONS_TABLE;
910 if (!($result = $db->sql_query($sql)))
912 message_die(GENERAL_ERROR, 'Could not select session data', '', __LINE__, __FILE__, $sql);
915 if ($row = $db->sql_fetchrow($result))
920 $confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'";
922 while ($row = $db->sql_fetchrow($result));
924 $sql = 'DELETE FROM ' . CONFIRM_TABLE . "
925 WHERE session_id NOT IN ($confirm_sql)";
926 if (!$db->sql_query($sql))
928 message_die(GENERAL_ERROR, 'Could not delete stale confirm data', '', __LINE__, __FILE__, $sql);
931 $db->sql_freeresult($result);
933 $sql = 'SELECT COUNT(session_id) AS attempts
934 FROM ' . CONFIRM_TABLE . "
935 WHERE session_id = '" . $userdata['session_id'] . "'";
936 if (!($result = $db->sql_query($sql)))
938 message_die(GENERAL_ERROR, 'Could not obtain confirm code count', '', __LINE__, __FILE__, $sql);
941 if ($row = $db->sql_fetchrow($result))
943 if ($row['attempts'] > 3)
945 message_die(GENERAL_MESSAGE, $lang['Too_many_registers']);
948 $db->sql_freeresult($result);
950 $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');
952 list($usec, $sec) = explode(' ', microtime());
953 mt_srand($sec * $usec);
955 $max_chars = count($confirm_chars) - 1;
957 for ($i = 0; $i < 6; $i++)
959 $code .= $confirm_chars[mt_rand(0, $max_chars)];
962 $confirm_id = md5(uniqid($user_ip));
964 $sql = 'INSERT INTO ' . CONFIRM_TABLE . " (confirm_id, session_id, code)
965 VALUES ('$confirm_id', '". $userdata['session_id'] . "', '$code')";
966 if (!$db->sql_query($sql))
968 message_die(GENERAL_ERROR, 'Could not insert new confirm code information', '', __LINE__, __FILE__, $sql);
973 $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="" />';
974 $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';
976 $template->assign_block_vars('switch_confirm', array());
981 // Let's do an overall check for settings/versions which would prevent
982 // us from doing file uploads....
984 $ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
985 $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"';
987 $template->assign_vars(array(
988 'USERNAME' => $username,
989 'CUR_PASSWORD' => $cur_password,
990 'NEW_PASSWORD' => $new_password,
991 'PASSWORD_CONFIRM' => $password_confirm,
993 'CONFIRM_IMG' => $confirm_image,
998 'OCCUPATION' => $occupation,
999 'INTERESTS' => $interests,
1000 'LOCATION' => $location,
1001 'WEBSITE' => $website,
1002 'SIGNATURE' => str_replace('<br />', "\n", $signature),
1003 'VIEW_EMAIL_YES' => ( $viewemail ) ? 'checked="checked"' : '',
1004 'VIEW_EMAIL_NO' => ( !$viewemail ) ? 'checked="checked"' : '',
1005 'HIDE_USER_YES' => ( !$allowviewonline ) ? 'checked="checked"' : '',
1006 'HIDE_USER_NO' => ( $allowviewonline ) ? 'checked="checked"' : '',
1007 'NOTIFY_PM_YES' => ( $notifypm ) ? 'checked="checked"' : '',
1008 'NOTIFY_PM_NO' => ( !$notifypm ) ? 'checked="checked"' : '',
1009 'POPUP_PM_YES' => ( $popup_pm ) ? 'checked="checked"' : '',
1010 'POPUP_PM_NO' => ( !$popup_pm ) ? 'checked="checked"' : '',
1011 'ALWAYS_ADD_SIGNATURE_YES' => ( $attachsig ) ? 'checked="checked"' : '',
1012 'ALWAYS_ADD_SIGNATURE_NO' => ( !$attachsig ) ? 'checked="checked"' : '',
1013 'NOTIFY_REPLY_YES' => ( $notifyreply ) ? 'checked="checked"' : '',
1014 'NOTIFY_REPLY_NO' => ( !$notifyreply ) ? 'checked="checked"' : '',
1015 'ALWAYS_ALLOW_BBCODE_YES' => ( $allowbbcode ) ? 'checked="checked"' : '',
1016 'ALWAYS_ALLOW_BBCODE_NO' => ( !$allowbbcode ) ? 'checked="checked"' : '',
1017 'ALWAYS_ALLOW_HTML_YES' => ( $allowhtml ) ? 'checked="checked"' : '',
1018 'ALWAYS_ALLOW_HTML_NO' => ( !$allowhtml ) ? 'checked="checked"' : '',
1019 'ALWAYS_ALLOW_SMILIES_YES' => ( $allowsmilies ) ? 'checked="checked"' : '',
1020 'ALWAYS_ALLOW_SMILIES_NO' => ( !$allowsmilies ) ? 'checked="checked"' : '',
1021 'ALLOW_AVATAR' => $board_config['allow_avatar_upload'],
1022 'AVATAR' => $avatar_img,
1023 'AVATAR_SIZE' => $board_config['avatar_filesize'],
1024 'LANGUAGE_SELECT' => language_select($user_lang, 'language'),
1025 'STYLE_SELECT' => style_select($user_style, 'style'),
1026 'TIMEZONE_SELECT' => tz_select($user_timezone, 'timezone'),
1027 'DATE_FORMAT' => $user_dateformat,
1028 'HTML_STATUS' => $html_status,
1029 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
1030 'SMILIES_STATUS' => $smilies_status,
1032 'L_CURRENT_PASSWORD' => $lang['Current_password'],
1033 'L_NEW_PASSWORD' => ( $mode == 'register' ) ? $lang['Password'] : $lang['New_password'],
1034 'L_CONFIRM_PASSWORD' => $lang['Confirm_password'],
1035 'L_CONFIRM_PASSWORD_EXPLAIN' => ( $mode == 'editprofile' ) ? $lang['Confirm_password_explain'] : '',
1036 'L_PASSWORD_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_if_changed'] : '',
1037 'L_PASSWORD_CONFIRM_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_confirm_if_changed'] : '',
1038 'L_SUBMIT' => $lang['Submit'],
1039 'L_RESET' => $lang['Reset'],
1040 'L_ICQ_NUMBER' => $lang['ICQ'],
1041 'L_MESSENGER' => $lang['MSNM'],
1042 'L_YAHOO' => $lang['YIM'],
1043 'L_WEBSITE' => $lang['Website'],
1044 'L_AIM' => $lang['AIM'],
1045 'L_LOCATION' => $lang['Location'],
1046 'L_OCCUPATION' => $lang['Occupation'],
1047 'L_BOARD_LANGUAGE' => $lang['Board_lang'],
1048 'L_BOARD_STYLE' => $lang['Board_style'],
1049 'L_TIMEZONE' => $lang['Timezone'],
1050 'L_DATE_FORMAT' => $lang['Date_format'],
1051 'L_DATE_FORMAT_EXPLAIN' => $lang['Date_format_explain'],
1052 'L_YES' => $lang['Yes'],
1053 'L_NO' => $lang['No'],
1054 'L_INTERESTS' => $lang['Interests'],
1055 'L_ALWAYS_ALLOW_SMILIES' => $lang['Always_smile'],
1056 'L_ALWAYS_ALLOW_BBCODE' => $lang['Always_bbcode'],
1057 'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'],
1058 'L_HIDE_USER' => $lang['Hide_user'],
1059 'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
1061 'L_AVATAR_PANEL' => $lang['Avatar_panel'],
1062 'L_AVATAR_EXPLAIN' => sprintf($lang['Avatar_explain'], $board_config['avatar_max_width'], $board_config['avatar_max_height'], (round($board_config['avatar_filesize'] / 1024))),
1063 'L_UPLOAD_AVATAR_FILE' => $lang['Upload_Avatar_file'],
1064 'L_UPLOAD_AVATAR_URL' => $lang['Upload_Avatar_URL'],
1065 'L_UPLOAD_AVATAR_URL_EXPLAIN' => $lang['Upload_Avatar_URL_explain'],
1066 'L_AVATAR_GALLERY' => $lang['Select_from_gallery'],
1067 'L_SHOW_GALLERY' => $lang['View_avatar_gallery'],
1068 'L_LINK_REMOTE_AVATAR' => $lang['Link_remote_Avatar'],
1069 'L_LINK_REMOTE_AVATAR_EXPLAIN' => $lang['Link_remote_Avatar_explain'],
1070 'L_DELETE_AVATAR' => $lang['Delete_Image'],
1071 'L_CURRENT_IMAGE' => $lang['Current_Image'],
1073 'L_SIGNATURE' => $lang['Signature'],
1074 'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars']),
1075 'L_NOTIFY_ON_REPLY' => $lang['Always_notify'],
1076 'L_NOTIFY_ON_REPLY_EXPLAIN' => $lang['Always_notify_explain'],
1077 'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'],
1078 'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'],
1079 'L_POPUP_ON_PRIVMSG_EXPLAIN' => $lang['Popup_on_privmsg_explain'],
1080 'L_PREFERENCES' => $lang['Preferences'],
1081 'L_PUBLIC_VIEW_EMAIL' => $lang['Public_view_email'],
1082 'L_ITEMS_REQUIRED' => $lang['Items_required'],
1083 'L_REGISTRATION_INFO' => $lang['Registration_info'],
1084 'L_PROFILE_INFO' => $lang['Profile_info'],
1085 'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'],
1086 'L_EMAIL_ADDRESS' => $lang['Email_address'],
1088 'L_CONFIRM_CODE_IMPAIRED' => sprintf($lang['Confirm_code_impaired'], '<a href="mailto:' . $board_config['board_email'] . '">', '</a>'),
1089 'L_CONFIRM_CODE' => $lang['Confirm_code'],
1090 'L_CONFIRM_CODE_EXPLAIN' => $lang['Confirm_code_explain'],
1092 'S_ALLOW_AVATAR_UPLOAD' => $board_config['allow_avatar_upload'],
1093 'S_ALLOW_AVATAR_LOCAL' => $board_config['allow_avatar_local'],
1094 'S_ALLOW_AVATAR_REMOTE' => $board_config['allow_avatar_remote'],
1095 'S_HIDDEN_FIELDS' => $s_hidden_fields,
1096 'S_FORM_ENCTYPE' => $form_enctype,
1097 'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
1101 // This is another cheat using the block_var capability
1102 // of the templates to 'fake' an IF...ELSE...ENDIF solution
1105 if ( $mode != 'register' )
1107 if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
1109 $template->assign_block_vars('switch_avatar_block', array() );
1111 if ( $board_config['allow_avatar_upload'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_path'])) )
1113 if ( $form_enctype != '' )
1115 $template->assign_block_vars('switch_avatar_block.switch_avatar_local_upload', array() );
1117 $template->assign_block_vars('switch_avatar_block.switch_avatar_remote_upload', array() );
1120 if ( $board_config['allow_avatar_remote'] )
1122 $template->assign_block_vars('switch_avatar_block.switch_avatar_remote_link', array() );
1125 if ( $board_config['allow_avatar_local'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_gallery_path'])) )
1127 $template->assign_block_vars('switch_avatar_block.switch_avatar_local_gallery', array() );
1133 $template->pparse('body');
1135 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);