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.78 2006/12/17 10:51:27 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 = (isset($signature)) ? str_replace('<br />', "\n", $signature) : '';
136 $signature_bbcode_uid = '';
138 // Run some validation on the optional fields. These are pass-by-ref, so they'll be changed to
139 // empty strings if they fail.
140 validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature);
142 $viewemail = ( isset($HTTP_POST_VARS['viewemail']) ) ? ( ($HTTP_POST_VARS['viewemail']) ? TRUE : 0 ) : 0;
143 $allowviewonline = ( isset($HTTP_POST_VARS['hideonline']) ) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : TRUE ) : TRUE;
144 $notifyreply = ( isset($HTTP_POST_VARS['notifyreply']) ) ? ( ($HTTP_POST_VARS['notifyreply']) ? TRUE : 0 ) : 0;
145 $notifypm = ( isset($HTTP_POST_VARS['notifypm']) ) ? ( ($HTTP_POST_VARS['notifypm']) ? TRUE : 0 ) : TRUE;
146 $popup_pm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE;
147 $sid = (isset($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : 0;
149 if ( $mode == 'register' )
151 $attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $board_config['allow_sig'];
153 $allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $board_config['allow_html'];
154 $allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $board_config['allow_bbcode'];
155 $allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $board_config['allow_smilies'];
159 $attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $userdata['user_attachsig'];
161 $allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $userdata['user_allowhtml'];
162 $allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $userdata['user_allowbbcode'];
163 $allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $userdata['user_allowsmile'];
166 $user_style = ( isset($HTTP_POST_VARS['style']) ) ? intval($HTTP_POST_VARS['style']) : $board_config['default_style'];
168 if ( !empty($HTTP_POST_VARS['language']) )
170 if ( preg_match('/^[a-z_]+$/i', $HTTP_POST_VARS['language']) )
172 $user_lang = htmlspecialchars($HTTP_POST_VARS['language']);
177 $error_msg = $lang['Fields_empty'];
182 $user_lang = $board_config['default_lang'];
185 $user_timezone = ( isset($HTTP_POST_VARS['timezone']) ) ? doubleval($HTTP_POST_VARS['timezone']) : $board_config['board_timezone'];
187 $sql = "SELECT config_value
188 FROM " . CONFIG_TABLE . "
189 WHERE config_name = 'default_dateformat'";
190 if ( !($result = $db->sql_query($sql)) )
192 message_die(GENERAL_ERROR, 'Could not select default dateformat', '', __LINE__, __FILE__, $sql);
194 $row = $db->sql_fetchrow($result);
195 $board_config['default_dateformat'] = $row['config_value'];
196 $user_dateformat = ( !empty($HTTP_POST_VARS['dateformat']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['dateformat'])) : $board_config['default_dateformat'];
198 $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']) : '' );
199 $user_avatar_category = ( isset($HTTP_POST_VARS['avatarcatname']) && $board_config['allow_avatar_local'] ) ? htmlspecialchars($HTTP_POST_VARS['avatarcatname']) : '' ;
201 $user_avatar_remoteurl = ( !empty($HTTP_POST_VARS['avatarremoteurl']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['avatarremoteurl'])) : '';
202 $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'] : '' );
203 $user_avatar_name = ( !empty($HTTP_POST_FILES['avatar']['name']) ) ? $HTTP_POST_FILES['avatar']['name'] : '';
204 $user_avatar_size = ( !empty($HTTP_POST_FILES['avatar']['size']) ) ? $HTTP_POST_FILES['avatar']['size'] : 0;
205 $user_avatar_filetype = ( !empty($HTTP_POST_FILES['avatar']['type']) ) ? $HTTP_POST_FILES['avatar']['type'] : '';
207 $user_avatar = ( empty($user_avatar_local) && $mode == 'editprofile' ) ? $userdata['user_avatar'] : '';
208 $user_avatar_type = ( empty($user_avatar_local) && $mode == 'editprofile' ) ? $userdata['user_avatar_type'] : '';
210 if ( (isset($HTTP_POST_VARS['avatargallery']) || isset($HTTP_POST_VARS['submitavatar']) || isset($HTTP_POST_VARS['cancelavatar'])) && (!isset($HTTP_POST_VARS['submit'])) )
212 $username = stripslashes($username);
213 $email = stripslashes($email);
214 $cur_password = htmlspecialchars(stripslashes($cur_password));
215 $new_password = htmlspecialchars(stripslashes($new_password));
216 $password_confirm = htmlspecialchars(stripslashes($password_confirm));
218 $icq = stripslashes($icq);
219 $aim = stripslashes($aim);
220 $msn = stripslashes($msn);
221 $yim = stripslashes($yim);
223 $website = stripslashes($website);
224 $location = stripslashes($location);
225 $occupation = stripslashes($occupation);
226 $interests = stripslashes($interests);
227 $signature = htmlspecialchars(stripslashes($signature));
229 $user_lang = stripslashes($user_lang);
230 $user_dateformat = stripslashes($user_dateformat);
232 if ( !isset($HTTP_POST_VARS['cancelavatar']))
234 $user_avatar = $user_avatar_category . '/' . $user_avatar_local;
235 $user_avatar_type = USER_AVATAR_GALLERY;
241 // Let's make sure the user isn't logged in while registering,
242 // and ensure that they were trying to register a second time
243 // (Prevents double registrations)
245 if ($mode == 'register' && ($userdata['session_logged_in'] || $username == $userdata['username']))
247 message_die(GENERAL_MESSAGE, $lang['Username_taken'], '', __LINE__, __FILE__);
251 // Did the user submit? In this case build a query to update the users profile in the DB
253 if ( isset($HTTP_POST_VARS['submit']) )
255 include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
258 if ($sid == '' || $sid != $userdata['session_id'])
261 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Session_invalid'];
265 if ( $mode == 'editprofile' )
267 if ( $user_id != $userdata['user_id'] )
270 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Wrong_Profile'];
273 else if ( $mode == 'register' )
275 if ( empty($username) || empty($new_password) || empty($password_confirm) || empty($email) )
278 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
282 if ($board_config['enable_confirm'] && $mode == 'register')
284 if (empty($HTTP_POST_VARS['confirm_id']))
287 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
291 $confirm_id = htmlspecialchars($HTTP_POST_VARS['confirm_id']);
292 if (!preg_match('/^[A-Za-z0-9]+$/', $confirm_id))
298 FROM ' . CONFIRM_TABLE . "
299 WHERE confirm_id = '$confirm_id'
300 AND session_id = '" . $userdata['session_id'] . "'";
301 if (!($result = $db->sql_query($sql)))
303 message_die(GENERAL_ERROR, 'Could not obtain confirmation code', '', __LINE__, __FILE__, $sql);
306 if ($row = $db->sql_fetchrow($result))
308 if ($row['code'] != $confirm_code)
311 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
315 $sql = 'DELETE FROM ' . CONFIRM_TABLE . "
316 WHERE confirm_id = '$confirm_id'
317 AND session_id = '" . $userdata['session_id'] . "'";
318 if (!$db->sql_query($sql))
320 message_die(GENERAL_ERROR, 'Could not delete confirmation code', '', __LINE__, __FILE__, $sql);
327 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
329 $db->sql_freeresult($result);
334 if ( !empty($new_password) && !empty($password_confirm) )
336 if ( $new_password != $password_confirm )
339 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
341 else if ( strlen($new_password) > 32 )
344 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_long'];
348 if ( $mode == 'editprofile' )
350 $sql = "SELECT user_password
351 FROM " . USERS_TABLE . "
352 WHERE user_id = $user_id";
353 if ( !($result = $db->sql_query($sql)) )
355 message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
358 $row = $db->sql_fetchrow($result);
360 if ( $row['user_password'] != md5($cur_password) )
363 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
369 $new_password = md5($new_password);
370 $passwd_sql = "user_password = '$new_password', ";
374 else if ( ( empty($new_password) && !empty($password_confirm) ) || ( !empty($new_password) && empty($password_confirm) ) )
377 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
381 // Do a ban check on this email address
383 if ( $email != $userdata['user_email'] || $mode == 'register' )
385 $result = validate_email($email);
386 if ( $result['error'] )
388 $email = $userdata['user_email'];
391 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
394 if ( $mode == 'editprofile' )
396 $sql = "SELECT user_password
397 FROM " . USERS_TABLE . "
398 WHERE user_id = $user_id";
399 if ( !($result = $db->sql_query($sql)) )
401 message_die(GENERAL_ERROR, 'Could not obtain user_password information', '', __LINE__, __FILE__, $sql);
404 $row = $db->sql_fetchrow($result);
406 if ( $row['user_password'] != md5($cur_password) )
408 $email = $userdata['user_email'];
411 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Current_password_mismatch'];
417 if ( $board_config['allow_namechange'] || $mode == 'register' )
419 if ( empty($username) )
421 // Error is already triggered, since one field is empty.
424 else if ( $username != $userdata['username'] || $mode == 'register')
426 if (strtolower($username) != strtolower($userdata['username']) || $mode == 'register')
428 $result = validate_username($username);
429 if ( $result['error'] )
432 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
438 $username_sql = "username = '" . str_replace("\'", "''", $username) . "', ";
443 if ( $signature != '' )
445 if ( strlen($signature) > $board_config['max_sig_chars'] )
448 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
451 if ( !isset($signature_bbcode_uid) || $signature_bbcode_uid == '' )
453 $signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
455 $signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
458 if ( $website != '' )
460 rawurlencode($website);
465 if ( isset($HTTP_POST_VARS['avatardel']) && $mode == 'editprofile' )
467 $avatar_sql = user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
470 if ( ( !empty($user_avatar_upload) || !empty($user_avatar_name) ) && $board_config['allow_avatar_upload'] )
472 if ( !empty($user_avatar_upload) )
474 $avatar_mode = (empty($user_avatar_name)) ? 'remote' : 'local';
475 $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);
477 else if ( !empty($user_avatar_name) )
479 $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
482 $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $l_avatar_size;
485 else if ( $user_avatar_remoteurl != '' && $board_config['allow_avatar_remote'] )
487 user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
488 $avatar_sql = user_avatar_url($mode, $error, $error_msg, $user_avatar_remoteurl);
490 else if ( $user_avatar_local != '' && $board_config['allow_avatar_local'] )
492 user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
493 $avatar_sql = user_avatar_gallery($mode, $error, $error_msg, $user_avatar_local, $user_avatar_category);
498 if ( $avatar_sql == '' )
500 $avatar_sql = ( $mode == 'editprofile' ) ? '' : "'', " . USER_AVATAR_NONE;
503 if ( $mode == 'editprofile' )
505 if ( $email != $userdata['user_email'] && $board_config['require_activation'] != USER_ACTIVATION_NONE && $userdata['user_level'] != ADMIN )
509 $user_actkey = gen_rand_string(true);
510 $key_len = 54 - ( strlen($server_url) );
511 $key_len = ( $key_len > 6 ) ? $key_len : 6;
512 $user_actkey = substr($user_actkey, 0, $key_len);
514 if ( $userdata['session_logged_in'] )
516 session_end($userdata['session_id'], $userdata['user_id']);
525 $sql = "UPDATE " . USERS_TABLE . "
526 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 . "
527 WHERE user_id = $user_id";
528 if ( !($result = $db->sql_query($sql)) )
530 message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
533 // We remove all stored login keys since the password has been updated
534 // and change the current one (if applicable)
535 if ( !empty($passwd_sql) )
537 session_reset_keys($user_id, $user_ip);
543 // The users account has been deactivated, send them an email with a new activation key
545 include($phpbb_root_path . 'includes/emailer.'.$phpEx);
546 $emailer = new emailer($board_config['smtp_delivery']);
548 if ( $board_config['require_activation'] != USER_ACTIVATION_ADMIN )
550 $emailer->from($board_config['board_email']);
551 $emailer->replyto($board_config['board_email']);
553 $emailer->use_template('user_activate', stripslashes($user_lang));
554 $emailer->email_address($email);
555 $emailer->set_subject($lang['Reactivate']);
557 $emailer->assign_vars(array(
558 'SITENAME' => $board_config['sitename'],
559 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
560 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
562 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
567 else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
569 $sql = 'SELECT user_email, user_lang
570 FROM ' . USERS_TABLE . '
571 WHERE user_level = ' . ADMIN;
573 if ( !($result = $db->sql_query($sql)) )
575 message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
578 while ($row = $db->sql_fetchrow($result))
580 $emailer->from($board_config['board_email']);
581 $emailer->replyto($board_config['board_email']);
583 $emailer->email_address(trim($row['user_email']));
584 $emailer->use_template("admin_activate", $row['user_lang']);
585 $emailer->set_subject($lang['Reactivate']);
587 $emailer->assign_vars(array(
588 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
589 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
591 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
596 $db->sql_freeresult($result);
599 $message = $lang['Profile_updated_inactive'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
603 $message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
606 $template->assign_vars(array(
607 "META" => '<meta http-equiv="refresh" content="5;url=' . append_sid("index.$phpEx") . '">')
610 message_die(GENERAL_MESSAGE, $message);
614 $sql = "SELECT MAX(user_id) AS total
615 FROM " . USERS_TABLE;
616 if ( !($result = $db->sql_query($sql)) )
618 message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
621 if ( !($row = $db->sql_fetchrow($result)) )
623 message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
625 $user_id = $row['total'] + 1;
630 $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)
631 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, ";
632 if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
634 $user_actkey = gen_rand_string(true);
635 $key_len = 54 - (strlen($server_url));
636 $key_len = ( $key_len > 6 ) ? $key_len : 6;
637 $user_actkey = substr($user_actkey, 0, $key_len);
638 $sql .= "0, '" . str_replace("\'", "''", $user_actkey) . "')";
645 if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
647 message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
650 $sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
651 VALUES ('', 'Personal User', 1, 0)";
652 if ( !($result = $db->sql_query($sql)) )
654 message_die(GENERAL_ERROR, 'Could not insert data into groups table', '', __LINE__, __FILE__, $sql);
657 $group_id = $db->sql_nextid();
659 $sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
660 VALUES ($user_id, $group_id, 0)";
661 if( !($result = $db->sql_query($sql, END_TRANSACTION)) )
663 message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
668 $message = $lang['COPPA'];
669 $email_template = 'coppa_welcome_inactive';
671 else if ( $board_config['require_activation'] == USER_ACTIVATION_SELF )
673 $message = $lang['Account_inactive'];
674 $email_template = 'user_welcome_inactive';
676 else if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
678 $message = $lang['Account_inactive_admin'];
679 $email_template = 'admin_welcome_inactive';
683 $message = $lang['Account_added'];
684 $email_template = 'user_welcome';
687 include($phpbb_root_path . 'includes/emailer.'.$phpEx);
688 $emailer = new emailer($board_config['smtp_delivery']);
690 $emailer->from($board_config['board_email']);
691 $emailer->replyto($board_config['board_email']);
693 $emailer->use_template($email_template, stripslashes($user_lang));
694 $emailer->email_address($email);
695 $emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename']));
699 $emailer->assign_vars(array(
700 'SITENAME' => $board_config['sitename'],
701 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
702 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
703 'PASSWORD' => $password_confirm,
704 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
706 'FAX_INFO' => $board_config['coppa_fax'],
707 'MAIL_INFO' => $board_config['coppa_mail'],
708 'EMAIL_ADDRESS' => $email,
713 'WEB_SITE' => $website,
715 'OCC' => $occupation,
716 'INTERESTS' => $interests,
717 'SITENAME' => $board_config['sitename']));
721 $emailer->assign_vars(array(
722 'SITENAME' => $board_config['sitename'],
723 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
724 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
725 'PASSWORD' => $password_confirm,
726 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
728 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
735 if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
737 $sql = "SELECT user_email, user_lang
738 FROM " . USERS_TABLE . "
739 WHERE user_level = " . ADMIN;
741 if ( !($result = $db->sql_query($sql)) )
743 message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
746 while ($row = $db->sql_fetchrow($result))
748 $emailer->from($board_config['board_email']);
749 $emailer->replyto($board_config['board_email']);
751 $emailer->email_address(trim($row['user_email']));
752 $emailer->use_template("admin_activate", $row['user_lang']);
753 $emailer->set_subject($lang['New_account_subject']);
755 $emailer->assign_vars(array(
756 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
757 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
759 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
764 $db->sql_freeresult($result);
767 $message = $message . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
769 message_die(GENERAL_MESSAGE, $message);
770 } // if mode == register
778 // If an error occured we need to stripslashes on returned data
780 $username = stripslashes($username);
781 $email = stripslashes($email);
784 $password_confirm = '';
786 $icq = stripslashes($icq);
787 $aim = str_replace('+', ' ', stripslashes($aim));
788 $msn = stripslashes($msn);
789 $yim = stripslashes($yim);
791 $website = stripslashes($website);
792 $location = stripslashes($location);
793 $occupation = stripslashes($occupation);
794 $interests = stripslashes($interests);
795 $signature = stripslashes($signature);
796 $signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $signature) : $signature;
798 $user_lang = stripslashes($user_lang);
799 $user_dateformat = stripslashes($user_dateformat);
802 else if ( $mode == 'editprofile' && !isset($HTTP_POST_VARS['avatargallery']) && !isset($HTTP_POST_VARS['submitavatar']) && !isset($HTTP_POST_VARS['cancelavatar']) )
804 $user_id = $userdata['user_id'];
805 $username = $userdata['username'];
806 $email = $userdata['user_email'];
809 $password_confirm = '';
811 $icq = $userdata['user_icq'];
812 $aim = str_replace('+', ' ', $userdata['user_aim']);
813 $msn = $userdata['user_msnm'];
814 $yim = $userdata['user_yim'];
816 $website = $userdata['user_website'];
817 $location = $userdata['user_from'];
818 $occupation = $userdata['user_occ'];
819 $interests = $userdata['user_interests'];
820 $signature_bbcode_uid = $userdata['user_sig_bbcode_uid'];
821 $signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $userdata['user_sig']) : $userdata['user_sig'];
823 $viewemail = $userdata['user_viewemail'];
824 $notifypm = $userdata['user_notify_pm'];
825 $popup_pm = $userdata['user_popup_pm'];
826 $notifyreply = $userdata['user_notify'];
827 $attachsig = $userdata['user_attachsig'];
828 $allowhtml = $userdata['user_allowhtml'];
829 $allowbbcode = $userdata['user_allowbbcode'];
830 $allowsmilies = $userdata['user_allowsmile'];
831 $allowviewonline = $userdata['user_allow_viewonline'];
833 $user_avatar = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar'] : '';
834 $user_avatar_type = ( $userdata['user_allowavatar'] ) ? $userdata['user_avatar_type'] : USER_AVATAR_NONE;
836 $user_style = $userdata['user_style'];
837 $user_lang = $userdata['user_lang'];
838 $user_timezone = $userdata['user_timezone'];
839 $user_dateformat = $userdata['user_dateformat'];
845 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
847 make_jumpbox('viewforum.'.$phpEx);
849 if ( $mode == 'editprofile' )
851 if ( $user_id != $userdata['user_id'] )
854 $error_msg = $lang['Wrong_Profile'];
858 if( isset($HTTP_POST_VARS['avatargallery']) && !$error )
860 include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
862 $avatar_category = ( !empty($HTTP_POST_VARS['avatarcategory']) ) ? htmlspecialchars($HTTP_POST_VARS['avatarcategory']) : '';
864 $template->set_filenames(array(
865 'body' => 'profile_avatar_gallery.tpl')
868 $allowviewonline = !$allowviewonline;
870 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']);
874 include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
876 if ( !isset($coppa) )
881 if ( !isset($user_style) )
883 $user_style = $board_config['default_style'];
887 if ( $user_avatar_type )
889 switch( $user_avatar_type )
891 case USER_AVATAR_UPLOAD:
892 $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" />' : '';
894 case USER_AVATAR_REMOTE:
895 $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $user_avatar . '" alt="" />' : '';
897 case USER_AVATAR_GALLERY:
898 $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" />' : '';
903 $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
904 $s_hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
905 if( $mode == 'editprofile' )
907 $s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />';
909 // Send the users current email address. If they change it, and account activation is turned on
910 // the user account will be disabled and the user will have to reactivate their account.
912 $s_hidden_fields .= '<input type="hidden" name="current_email" value="' . $userdata['user_email'] . '" />';
915 if ( !empty($user_avatar_local) )
917 $s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" /><input type="hidden" name="avatarcatname" value="' . $user_avatar_category . '" />';
920 $html_status = ( $userdata['user_allowhtml'] && $board_config['allow_html'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
921 $bbcode_status = ( $userdata['user_allowbbcode'] && $board_config['allow_bbcode'] ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF'];
922 $smilies_status = ( $userdata['user_allowsmile'] && $board_config['allow_smilies'] ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];
926 $template->set_filenames(array(
927 'reg_header' => 'error_body.tpl')
929 $template->assign_vars(array(
930 'ERROR_MESSAGE' => $error_msg)
932 $template->assign_var_from_handle('ERROR_BOX', 'reg_header');
935 $template->set_filenames(array(
936 'body' => 'profile_add_body.tpl')
939 if ( $mode == 'editprofile' )
941 $template->assign_block_vars('switch_edit_profile', array());
944 if ( ($mode == 'register') || ($board_config['allow_namechange']) )
946 $template->assign_block_vars('switch_namechange_allowed', array());
950 $template->assign_block_vars('switch_namechange_disallowed', array());
954 // Visual Confirmation
956 if (!empty($board_config['enable_confirm']) && $mode == 'register')
958 $sql = 'SELECT session_id
959 FROM ' . SESSIONS_TABLE;
960 if (!($result = $db->sql_query($sql)))
962 message_die(GENERAL_ERROR, 'Could not select session data', '', __LINE__, __FILE__, $sql);
965 if ($row = $db->sql_fetchrow($result))
970 $confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'";
972 while ($row = $db->sql_fetchrow($result));
974 $sql = 'DELETE FROM ' . CONFIRM_TABLE . "
975 WHERE session_id NOT IN ($confirm_sql)";
976 if (!$db->sql_query($sql))
978 message_die(GENERAL_ERROR, 'Could not delete stale confirm data', '', __LINE__, __FILE__, $sql);
981 $db->sql_freeresult($result);
983 $sql = 'SELECT COUNT(session_id) AS attempts
984 FROM ' . CONFIRM_TABLE . "
985 WHERE session_id = '" . $userdata['session_id'] . "'";
986 if (!($result = $db->sql_query($sql)))
988 message_die(GENERAL_ERROR, 'Could not obtain confirm code count', '', __LINE__, __FILE__, $sql);
991 if ($row = $db->sql_fetchrow($result))
993 if ($row['attempts'] > 3)
995 message_die(GENERAL_MESSAGE, $lang['Too_many_registers']);
998 $db->sql_freeresult($result);
1000 // Generate the required confirmation code
1001 // NB 0 (zero) could get confused with O (the letter) so we make change it
1003 $code = substr(str_replace('0', 'Z', strtoupper(base_convert($code, 16, 35))), 2, 6);
1005 $confirm_id = md5(uniqid($user_ip));
1007 $sql = 'INSERT INTO ' . CONFIRM_TABLE . " (confirm_id, session_id, code)
1008 VALUES ('$confirm_id', '". $userdata['session_id'] . "', '$code')";
1009 if (!$db->sql_query($sql))
1011 message_die(GENERAL_ERROR, 'Could not insert new confirm code information', '', __LINE__, __FILE__, $sql);
1016 $confirm_image = '<img src="' . append_sid("profile.$phpEx?mode=confirm&id=$confirm_id") . '" alt="" title="" />';
1017 $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';
1019 $template->assign_block_vars('switch_confirm', array());
1024 // Let's do an overall check for settings/versions which would prevent
1025 // us from doing file uploads....
1027 $ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
1028 $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"';
1030 $template->assign_vars(array(
1031 'USERNAME' => isset($username) ? $username : '',
1032 'CUR_PASSWORD' => isset($cur_password) ? $cur_password : '',
1033 'NEW_PASSWORD' => isset($new_password) ? $new_password : '',
1034 'PASSWORD_CONFIRM' => isset($password_confirm) ? $password_confirm : '',
1035 'EMAIL' => isset($email) ? $email : '',
1036 'CONFIRM_IMG' => $confirm_image,
1041 'OCCUPATION' => $occupation,
1042 'INTERESTS' => $interests,
1043 'LOCATION' => $location,
1044 'WEBSITE' => $website,
1045 'SIGNATURE' => str_replace('<br />', "\n", $signature),
1046 'VIEW_EMAIL_YES' => ( $viewemail ) ? 'checked="checked"' : '',
1047 'VIEW_EMAIL_NO' => ( !$viewemail ) ? 'checked="checked"' : '',
1048 'HIDE_USER_YES' => ( !$allowviewonline ) ? 'checked="checked"' : '',
1049 'HIDE_USER_NO' => ( $allowviewonline ) ? 'checked="checked"' : '',
1050 'NOTIFY_PM_YES' => ( $notifypm ) ? 'checked="checked"' : '',
1051 'NOTIFY_PM_NO' => ( !$notifypm ) ? 'checked="checked"' : '',
1052 'POPUP_PM_YES' => ( $popup_pm ) ? 'checked="checked"' : '',
1053 'POPUP_PM_NO' => ( !$popup_pm ) ? 'checked="checked"' : '',
1054 'ALWAYS_ADD_SIGNATURE_YES' => ( $attachsig ) ? 'checked="checked"' : '',
1055 'ALWAYS_ADD_SIGNATURE_NO' => ( !$attachsig ) ? 'checked="checked"' : '',
1056 'NOTIFY_REPLY_YES' => ( $notifyreply ) ? 'checked="checked"' : '',
1057 'NOTIFY_REPLY_NO' => ( !$notifyreply ) ? 'checked="checked"' : '',
1058 'ALWAYS_ALLOW_BBCODE_YES' => ( $allowbbcode ) ? 'checked="checked"' : '',
1059 'ALWAYS_ALLOW_BBCODE_NO' => ( !$allowbbcode ) ? 'checked="checked"' : '',
1060 'ALWAYS_ALLOW_HTML_YES' => ( $allowhtml ) ? 'checked="checked"' : '',
1061 'ALWAYS_ALLOW_HTML_NO' => ( !$allowhtml ) ? 'checked="checked"' : '',
1062 'ALWAYS_ALLOW_SMILIES_YES' => ( $allowsmilies ) ? 'checked="checked"' : '',
1063 'ALWAYS_ALLOW_SMILIES_NO' => ( !$allowsmilies ) ? 'checked="checked"' : '',
1064 'ALLOW_AVATAR' => $board_config['allow_avatar_upload'],
1065 'AVATAR' => $avatar_img,
1066 'AVATAR_SIZE' => $board_config['avatar_filesize'],
1067 'LANGUAGE_SELECT' => language_select($user_lang, 'language'),
1068 'STYLE_SELECT' => style_select($user_style, 'style'),
1069 'TIMEZONE_SELECT' => tz_select($user_timezone, 'timezone'),
1070 'DATE_FORMAT' => $user_dateformat,
1071 'HTML_STATUS' => $html_status,
1072 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
1073 'SMILIES_STATUS' => $smilies_status,
1075 'L_CURRENT_PASSWORD' => $lang['Current_password'],
1076 'L_NEW_PASSWORD' => ( $mode == 'register' ) ? $lang['Password'] : $lang['New_password'],
1077 'L_CONFIRM_PASSWORD' => $lang['Confirm_password'],
1078 'L_CONFIRM_PASSWORD_EXPLAIN' => ( $mode == 'editprofile' ) ? $lang['Confirm_password_explain'] : '',
1079 'L_PASSWORD_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_if_changed'] : '',
1080 'L_PASSWORD_CONFIRM_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_confirm_if_changed'] : '',
1081 'L_SUBMIT' => $lang['Submit'],
1082 'L_RESET' => $lang['Reset'],
1083 'L_ICQ_NUMBER' => $lang['ICQ'],
1084 'L_MESSENGER' => $lang['MSNM'],
1085 'L_YAHOO' => $lang['YIM'],
1086 'L_WEBSITE' => $lang['Website'],
1087 'L_AIM' => $lang['AIM'],
1088 'L_LOCATION' => $lang['Location'],
1089 'L_OCCUPATION' => $lang['Occupation'],
1090 'L_BOARD_LANGUAGE' => $lang['Board_lang'],
1091 'L_BOARD_STYLE' => $lang['Board_style'],
1092 'L_TIMEZONE' => $lang['Timezone'],
1093 'L_DATE_FORMAT' => $lang['Date_format'],
1094 'L_DATE_FORMAT_EXPLAIN' => $lang['Date_format_explain'],
1095 'L_YES' => $lang['Yes'],
1096 'L_NO' => $lang['No'],
1097 'L_INTERESTS' => $lang['Interests'],
1098 'L_ALWAYS_ALLOW_SMILIES' => $lang['Always_smile'],
1099 'L_ALWAYS_ALLOW_BBCODE' => $lang['Always_bbcode'],
1100 'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'],
1101 'L_HIDE_USER' => $lang['Hide_user'],
1102 'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
1104 'L_AVATAR_PANEL' => $lang['Avatar_panel'],
1105 'L_AVATAR_EXPLAIN' => sprintf($lang['Avatar_explain'], $board_config['avatar_max_width'], $board_config['avatar_max_height'], (round($board_config['avatar_filesize'] / 1024))),
1106 'L_UPLOAD_AVATAR_FILE' => $lang['Upload_Avatar_file'],
1107 'L_UPLOAD_AVATAR_URL' => $lang['Upload_Avatar_URL'],
1108 'L_UPLOAD_AVATAR_URL_EXPLAIN' => $lang['Upload_Avatar_URL_explain'],
1109 'L_AVATAR_GALLERY' => $lang['Select_from_gallery'],
1110 'L_SHOW_GALLERY' => $lang['View_avatar_gallery'],
1111 'L_LINK_REMOTE_AVATAR' => $lang['Link_remote_Avatar'],
1112 'L_LINK_REMOTE_AVATAR_EXPLAIN' => $lang['Link_remote_Avatar_explain'],
1113 'L_DELETE_AVATAR' => $lang['Delete_Image'],
1114 'L_CURRENT_IMAGE' => $lang['Current_Image'],
1116 'L_SIGNATURE' => $lang['Signature'],
1117 'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars']),
1118 'L_NOTIFY_ON_REPLY' => $lang['Always_notify'],
1119 'L_NOTIFY_ON_REPLY_EXPLAIN' => $lang['Always_notify_explain'],
1120 'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'],
1121 'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'],
1122 'L_POPUP_ON_PRIVMSG_EXPLAIN' => $lang['Popup_on_privmsg_explain'],
1123 'L_PREFERENCES' => $lang['Preferences'],
1124 'L_PUBLIC_VIEW_EMAIL' => $lang['Public_view_email'],
1125 'L_ITEMS_REQUIRED' => $lang['Items_required'],
1126 'L_REGISTRATION_INFO' => $lang['Registration_info'],
1127 'L_PROFILE_INFO' => $lang['Profile_info'],
1128 'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'],
1129 'L_EMAIL_ADDRESS' => $lang['Email_address'],
1131 'L_CONFIRM_CODE_IMPAIRED' => sprintf($lang['Confirm_code_impaired'], '<a href="mailto:' . $board_config['board_email'] . '">', '</a>'),
1132 'L_CONFIRM_CODE' => $lang['Confirm_code'],
1133 'L_CONFIRM_CODE_EXPLAIN' => $lang['Confirm_code_explain'],
1135 'S_ALLOW_AVATAR_UPLOAD' => $board_config['allow_avatar_upload'],
1136 'S_ALLOW_AVATAR_LOCAL' => $board_config['allow_avatar_local'],
1137 'S_ALLOW_AVATAR_REMOTE' => $board_config['allow_avatar_remote'],
1138 'S_HIDDEN_FIELDS' => $s_hidden_fields,
1139 'S_FORM_ENCTYPE' => $form_enctype,
1140 'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
1144 // This is another cheat using the block_var capability
1145 // of the templates to 'fake' an IF...ELSE...ENDIF solution
1148 if ( $mode != 'register' )
1150 if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
1152 $template->assign_block_vars('switch_avatar_block', array() );
1154 if ( $board_config['allow_avatar_upload'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_path'])) )
1156 if ( $form_enctype != '' )
1158 $template->assign_block_vars('switch_avatar_block.switch_avatar_local_upload', array() );
1160 $template->assign_block_vars('switch_avatar_block.switch_avatar_remote_upload', array() );
1163 if ( $board_config['allow_avatar_remote'] )
1165 $template->assign_block_vars('switch_avatar_block.switch_avatar_remote_link', array() );
1168 if ( $board_config['allow_avatar_local'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_gallery_path'])) )
1170 $template->assign_block_vars('switch_avatar_block.switch_avatar_local_gallery', array() );
1176 $template->pparse('body');
1178 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);