Blame Extras/phpBB/3.0.4/includes/ucp/ucp_register.php

4c79b5
4c79b5
/**
4c79b5
*
4c79b5
* @package ucp
4c79b5
* @version $Id: ucp_register.php 8782 2008-08-23 17:20:55Z acydburn $
4c79b5
* @copyright (c) 2005 phpBB Group
4c79b5
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
4c79b5
*
4c79b5
*/
4c79b5
4c79b5
/**
4c79b5
* @ignore
4c79b5
*/
4c79b5
if (!defined('IN_PHPBB'))
4c79b5
{
4c79b5
	exit;
4c79b5
}
4c79b5
4c79b5
/**
4c79b5
* ucp_register
4c79b5
* Board registration
4c79b5
* @package ucp
4c79b5
*/
4c79b5
class ucp_register
4c79b5
{
4c79b5
	var $u_action;
4c79b5
4c79b5
	function main($id, $mode)
4c79b5
	{
4c79b5
		global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
4c79b5
4c79b5
		//
4c79b5
		if ($config['require_activation'] == USER_ACTIVATION_DISABLE)
4c79b5
		{
4c79b5
			trigger_error('UCP_REGISTER_DISABLE');
4c79b5
		}
4c79b5
4c79b5
		include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
4c79b5
4c79b5
		$confirm_id		= request_var('confirm_id', '');
4c79b5
		$coppa			= (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false;
4c79b5
		$agreed			= (!empty($_POST['agreed'])) ? 1 : 0;
4c79b5
		$submit			= (isset($_POST['submit'])) ? true : false;
4c79b5
		$change_lang	= request_var('change_lang', '');
4c79b5
		$user_lang		= request_var('lang', $user->lang_name);
4c79b5
4c79b5
		if ($agreed)
4c79b5
		{
4c79b5
			add_form_key('ucp_register');
4c79b5
		}
4c79b5
		else
4c79b5
		{
4c79b5
			add_form_key('ucp_register_terms');
4c79b5
		}
4c79b5
4c79b5
4c79b5
		if ($change_lang || $user_lang != $config['default_lang'])
4c79b5
		{
4c79b5
			$use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang);
4c79b5
4c79b5
			if (file_exists($user->lang_path . $use_lang . '/'))
4c79b5
			{
4c79b5
				if ($change_lang)
4c79b5
				{
4c79b5
					$submit = false;
4c79b5
4c79b5
					// Setting back agreed to let the user view the agreement in his/her language
4c79b5
					$agreed = (empty($_GET['change_lang'])) ? 0 : $agreed;
4c79b5
				}
4c79b5
4c79b5
				$user->lang_name = $lang = $use_lang;
4c79b5
				$user->lang = array();
4c79b5
				$user->add_lang(array('common', 'ucp'));
4c79b5
			}
4c79b5
			else
4c79b5
			{
4c79b5
				$change_lang = '';
4c79b5
				$user_lang = $user->lang_name;
4c79b5
			}
4c79b5
		}
4c79b5
4c79b5
		$cp = new custom_profile();
4c79b5
4c79b5
		$error = $cp_data = $cp_error = array();
4c79b5
4c79b5
4c79b5
		if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable']))
4c79b5
		{
4c79b5
			$add_lang = ($change_lang) ? '&change_lang=' . urlencode($change_lang) : '';
4c79b5
			$add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : '';
4c79b5
4c79b5
			$s_hidden_fields = ($confirm_id) ? array('confirm_id' => $confirm_id) : array();
4c79b5
4c79b5
			// If we change the language, we want to pass on some more possible parameter.
4c79b5
			if ($change_lang)
4c79b5
			{
4c79b5
				// We do not include the password
4c79b5
				$s_hidden_fields = array_merge($s_hidden_fields, array(
4c79b5
					'username'			=> utf8_normalize_nfc(request_var('username', '', true)),
4c79b5
					'email'				=> strtolower(request_var('email', '')),
4c79b5
					'email_confirm'		=> strtolower(request_var('email_confirm', '')),
4c79b5
					'confirm_code'		=> request_var('confirm_code', ''),
4c79b5
					'confirm_id'		=> request_var('confirm_id', ''),
4c79b5
					'lang'				=> $user->lang_name,
4c79b5
					'tz'				=> request_var('tz', (float) $config['board_timezone']),
4c79b5
				));
4c79b5
			}
4c79b5
4c79b5
			if ($coppa === false && $config['coppa_enable'])
4c79b5
			{
4c79b5
				$now = getdate();
4c79b5
				$coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']);
4c79b5
				unset($now);
4c79b5
4c79b5
				$template->assign_vars(array(
4c79b5
					'L_COPPA_NO'		=> sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday),
4c79b5
					'L_COPPA_YES'		=> sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday),
4c79b5
4c79b5
					'U_COPPA_NO'		=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0' . $add_lang),
4c79b5
					'U_COPPA_YES'		=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1' . $add_lang),
4c79b5
4c79b5
					'S_SHOW_COPPA'		=> true,
4c79b5
					'S_HIDDEN_FIELDS'	=> build_hidden_fields($s_hidden_fields),
4c79b5
					'S_UCP_ACTION'		=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang),
4c79b5
				));
4c79b5
			}
4c79b5
			else
4c79b5
			{
4c79b5
				$template->assign_vars(array(
4c79b5
					'L_TERMS_OF_USE'	=> sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()),
4c79b5
4c79b5
					'S_SHOW_COPPA'		=> false,
4c79b5
					'S_REGISTRATION'	=> true,
4c79b5
					'S_HIDDEN_FIELDS'	=> build_hidden_fields($s_hidden_fields),
4c79b5
					'S_UCP_ACTION'		=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang . $add_coppa),
4c79b5
					)
4c79b5
				);
4c79b5
			}
4c79b5
4c79b5
			$this->tpl_name = 'ucp_agreement';
4c79b5
			return;
4c79b5
		}
4c79b5
4c79b5
4c79b5
		// Try to manually determine the timezone and adjust the dst if the server date/time complies with the default setting +/- 1
4c79b5
		$timezone = date('Z') / 3600;
4c79b5
		$is_dst = date('I');
4c79b5
4c79b5
		if ($config['board_timezone'] == $timezone || $config['board_timezone'] == ($timezone - 1))
4c79b5
		{
4c79b5
			$timezone = ($is_dst) ? $timezone - 1 : $timezone;
4c79b5
4c79b5
			if (!isset($user->lang['tz_zones'][(string) $timezone]))
4c79b5
			{
4c79b5
				$timezone = $config['board_timezone'];
4c79b5
			}
4c79b5
		}
4c79b5
		else
4c79b5
		{
4c79b5
			$is_dst = $config['board_dst'];
4c79b5
			$timezone = $config['board_timezone'];
4c79b5
		}
4c79b5
4c79b5
		$data = array(
4c79b5
			'username'			=> utf8_normalize_nfc(request_var('username', '', true)),
4c79b5
			'new_password'		=> request_var('new_password', '', true),
4c79b5
			'password_confirm'	=> request_var('password_confirm', '', true),
4c79b5
			'email'				=> strtolower(request_var('email', '')),
4c79b5
			'email_confirm'		=> strtolower(request_var('email_confirm', '')),
4c79b5
			'confirm_code'		=> request_var('confirm_code', ''),
4c79b5
			'lang'				=> basename(request_var('lang', $user->lang_name)),
4c79b5
			'tz'				=> request_var('tz', (float) $timezone),
4c79b5
		);
4c79b5
4c79b5
		// Check and initialize some variables if needed
4c79b5
		if ($submit)
4c79b5
		{
4c79b5
			$error = validate_data($data, array(
4c79b5
				'username'			=> array(
4c79b5
					array('string', false, $config['min_name_chars'], $config['max_name_chars']),
4c79b5
					array('username', '')),
4c79b5
				'new_password'		=> array(
4c79b5
					array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
4c79b5
					array('password')),
4c79b5
				'password_confirm'	=> array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
4c79b5
				'email'				=> array(
4c79b5
					array('string', false, 6, 60),
4c79b5
					array('email')),
4c79b5
				'email_confirm'		=> array('string', false, 6, 60),
4c79b5
				'confirm_code'		=> array('string', !$config['enable_confirm'], 5, 8),
4c79b5
				'tz'				=> array('num', false, -14, 14),
4c79b5
				'lang'				=> array('match', false, '#^[a-z_\-]{2,}$#i'),
4c79b5
			));
4c79b5
			if (!check_form_key('ucp_register'))
4c79b5
			{
4c79b5
				$error[] = $user->lang['FORM_INVALID'];
4c79b5
			}
4c79b5
			// Replace "error" strings with their real, localised form
4c79b5
			$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
4c79b5
4c79b5
			// DNSBL check
4c79b5
			if ($config['check_dnsbl'])
4c79b5
			{
4c79b5
				if (($dnsbl = $user->check_dnsbl('register')) !== false)
4c79b5
				{
4c79b5
					$error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]);
4c79b5
				}
4c79b5
			}
4c79b5
4c79b5
			// validate custom profile fields
4c79b5
			$cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error);
4c79b5
4c79b5
			// Visual Confirmation handling
4c79b5
			$wrong_confirm = false;
4c79b5
			if ($config['enable_confirm'])
4c79b5
			{
4c79b5
				if (!$confirm_id)
4c79b5
				{
4c79b5
					$error[] = $user->lang['CONFIRM_CODE_WRONG'];
4c79b5
					$wrong_confirm = true;
4c79b5
				}
4c79b5
				else
4c79b5
				{
4c79b5
					$sql = 'SELECT code
4c79b5
						FROM ' . CONFIRM_TABLE . "
4c79b5
						WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
4c79b5
							AND session_id = '" . $db->sql_escape($user->session_id) . "'
4c79b5
							AND confirm_type = " . CONFIRM_REG;
4c79b5
					$result = $db->sql_query($sql);
4c79b5
					$row = $db->sql_fetchrow($result);
4c79b5
					$db->sql_freeresult($result);
4c79b5
4c79b5
					if ($row)
4c79b5
					{
4c79b5
						if (strcasecmp($row['code'], $data['confirm_code']) === 0)
4c79b5
						{
4c79b5
							$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
4c79b5
								WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
4c79b5
									AND session_id = '" . $db->sql_escape($user->session_id) . "'
4c79b5
									AND confirm_type = " . CONFIRM_REG;
4c79b5
							$db->sql_query($sql);
4c79b5
						}
4c79b5
						else
4c79b5
						{
4c79b5
							$error[] = $user->lang['CONFIRM_CODE_WRONG'];
4c79b5
							$wrong_confirm = true;
4c79b5
						}
4c79b5
					}
4c79b5
					else
4c79b5
					{
4c79b5
						$error[] = $user->lang['CONFIRM_CODE_WRONG'];
4c79b5
						$wrong_confirm = true;
4c79b5
					}
4c79b5
				}
4c79b5
			}
4c79b5
4c79b5
			if (!sizeof($error))
4c79b5
			{
4c79b5
				if ($data['new_password'] != $data['password_confirm'])
4c79b5
				{
4c79b5
					$error[] = $user->lang['NEW_PASSWORD_ERROR'];
4c79b5
				}
4c79b5
4c79b5
				if ($data['email'] != $data['email_confirm'])
4c79b5
				{
4c79b5
					$error[] = $user->lang['NEW_EMAIL_ERROR'];
4c79b5
				}
4c79b5
			}
4c79b5
4c79b5
			if (!sizeof($error))
4c79b5
			{
4c79b5
				$server_url = generate_board_url();
4c79b5
4c79b5
				// Which group by default?
4c79b5
				$group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED';
4c79b5
4c79b5
				$sql = 'SELECT group_id
4c79b5
					FROM ' . GROUPS_TABLE . "
4c79b5
					WHERE group_name = '" . $db->sql_escape($group_name) . "'
4c79b5
						AND group_type = " . GROUP_SPECIAL;
4c79b5
				$result = $db->sql_query($sql);
4c79b5
				$row = $db->sql_fetchrow($result);
4c79b5
				$db->sql_freeresult($result);
4c79b5
4c79b5
				if (!$row)
4c79b5
				{
4c79b5
					trigger_error('NO_GROUP');
4c79b5
				}
4c79b5
4c79b5
				$group_id = $row['group_id'];
4c79b5
4c79b5
				if (($coppa ||
4c79b5
					$config['require_activation'] == USER_ACTIVATION_SELF ||
4c79b5
					$config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable'])
4c79b5
				{
4c79b5
					$user_actkey = gen_rand_string(10);
4c79b5
					$key_len = 54 - (strlen($server_url));
4c79b5
					$key_len = ($key_len < 6) ? 6 : $key_len;
4c79b5
					$user_actkey = substr($user_actkey, 0, $key_len);
4c79b5
4c79b5
					$user_type = USER_INACTIVE;
4c79b5
					$user_inactive_reason = INACTIVE_REGISTER;
4c79b5
					$user_inactive_time = time();
4c79b5
				}
4c79b5
				else
4c79b5
				{
4c79b5
					$user_type = USER_NORMAL;
4c79b5
					$user_actkey = '';
4c79b5
					$user_inactive_reason = 0;
4c79b5
					$user_inactive_time = 0;
4c79b5
				}
4c79b5
4c79b5
				$user_row = array(
4c79b5
					'username'				=> $data['username'],
4c79b5
					'user_password'			=> phpbb_hash($data['new_password']),
4c79b5
					'user_email'			=> $data['email'],
4c79b5
					'group_id'				=> (int) $group_id,
4c79b5
					'user_timezone'			=> (float) $data['tz'],
4c79b5
					'user_dst'				=> $is_dst,
4c79b5
					'user_lang'				=> $data['lang'],
4c79b5
					'user_type'				=> $user_type,
4c79b5
					'user_actkey'			=> $user_actkey,
4c79b5
					'user_ip'				=> $user->ip,
4c79b5
					'user_regdate'			=> time(),
4c79b5
					'user_inactive_reason'	=> $user_inactive_reason,
4c79b5
					'user_inactive_time'	=> $user_inactive_time,
4c79b5
				);
4c79b5
4c79b5
				// Register user...
4c79b5
				$user_id = user_add($user_row, $cp_data);
4c79b5
4c79b5
				// This should not happen, because the required variables are listed above...
4c79b5
				if ($user_id === false)
4c79b5
				{
4c79b5
					trigger_error('NO_USER', E_USER_ERROR);
4c79b5
				}
4c79b5
4c79b5
				if ($coppa && $config['email_enable'])
4c79b5
				{
4c79b5
					$message = $user->lang['ACCOUNT_COPPA'];
4c79b5
					$email_template = 'coppa_welcome_inactive';
4c79b5
				}
4c79b5
				else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable'])
4c79b5
				{
4c79b5
					$message = $user->lang['ACCOUNT_INACTIVE'];
4c79b5
					$email_template = 'user_welcome_inactive';
4c79b5
				}
4c79b5
				else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable'])
4c79b5
				{
4c79b5
					$message = $user->lang['ACCOUNT_INACTIVE_ADMIN'];
4c79b5
					$email_template = 'admin_welcome_inactive';
4c79b5
				}
4c79b5
				else
4c79b5
				{
4c79b5
					$message = $user->lang['ACCOUNT_ADDED'];
4c79b5
					$email_template = 'user_welcome';
4c79b5
				}
4c79b5
4c79b5
				if ($config['email_enable'])
4c79b5
				{
4c79b5
					include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
4c79b5
4c79b5
					$messenger = new messenger(false);
4c79b5
4c79b5
					$messenger->template($email_template, $data['lang']);
4c79b5
4c79b5
					$messenger->to($data['email'], $data['username']);
4c79b5
4c79b5
					$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
4c79b5
					$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
4c79b5
					$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
4c79b5
					$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
4c79b5
4c79b5
					$messenger->assign_vars(array(
4c79b5
						'WELCOME_MSG'	=> htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
4c79b5
						'USERNAME'		=> htmlspecialchars_decode($data['username']),
4c79b5
						'PASSWORD'		=> htmlspecialchars_decode($data['new_password']),
4c79b5
						'U_ACTIVATE'	=> "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
4c79b5
					);
4c79b5
4c79b5
					if ($coppa)
4c79b5
					{
4c79b5
						$messenger->assign_vars(array(
4c79b5
							'FAX_INFO'		=> $config['coppa_fax'],
4c79b5
							'MAIL_INFO'		=> $config['coppa_mail'],
4c79b5
							'EMAIL_ADDRESS'	=> $data['email'])
4c79b5
						);
4c79b5
					}
4c79b5
4c79b5
					$messenger->send(NOTIFY_EMAIL);
4c79b5
4c79b5
					if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
4c79b5
					{
4c79b5
						// Grab an array of user_id's with a_user permissions ... these users can activate a user
4c79b5
						$admin_ary = $auth->acl_get_list(false, 'a_user', false);
4c79b5
						$admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
4c79b5
4c79b5
						// Also include founders
4c79b5
						$where_sql = ' WHERE user_type = ' . USER_FOUNDER;
4c79b5
4c79b5
						if (sizeof($admin_ary))
4c79b5
						{
4c79b5
							$where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
4c79b5
						}
4c79b5
4c79b5
						$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
4c79b5
							FROM ' . USERS_TABLE . ' ' .
4c79b5
							$where_sql;
4c79b5
						$result = $db->sql_query($sql);
4c79b5
4c79b5
						while ($row = $db->sql_fetchrow($result))
4c79b5
						{
4c79b5
							$messenger->template('admin_activate', $row['user_lang']);
4c79b5
							$messenger->to($row['user_email'], $row['username']);
4c79b5
							$messenger->im($row['user_jabber'], $row['username']);
4c79b5
4c79b5
							$messenger->assign_vars(array(
4c79b5
								'USERNAME'			=> htmlspecialchars_decode($data['username']),
4c79b5
								'U_USER_DETAILS'	=> "$server_url/memberlist.$phpEx?mode=viewprofile&u=$user_id",
4c79b5
								'U_ACTIVATE'		=> "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
4c79b5
							);
4c79b5
4c79b5
							$messenger->send($row['user_notify_type']);
4c79b5
						}
4c79b5
						$db->sql_freeresult($result);
4c79b5
					}
4c79b5
				}
4c79b5
4c79b5
				$message = $message . '

' . sprintf($user->lang['RETURN_INDEX'], '', '');
4c79b5
				trigger_error($message);
4c79b5
			}
4c79b5
		}
4c79b5
4c79b5
		$s_hidden_fields = array(
4c79b5
			'agreed'		=> 'true',
4c79b5
			'change_lang'	=> 0,
4c79b5
		);
4c79b5
4c79b5
		if ($config['coppa_enable'])
4c79b5
		{
4c79b5
			$s_hidden_fields['coppa'] = $coppa;
4c79b5
		}
4c79b5
		$s_hidden_fields = build_hidden_fields($s_hidden_fields);
4c79b5
4c79b5
		$confirm_image = '';
4c79b5
4c79b5
		// Visual Confirmation - Show images
4c79b5
4c79b5
		if ($config['enable_confirm'])
4c79b5
		{
4c79b5
			if ($change_lang)
4c79b5
			{
4c79b5
				$str = '&change_lang=' . $change_lang;
4c79b5
				$sql = 'SELECT code
4c79b5
						FROM ' . CONFIRM_TABLE . "
4c79b5
						WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
4c79b5
							AND session_id = '" . $db->sql_escape($user->session_id) . "'
4c79b5
							AND confirm_type = " . CONFIRM_REG;
4c79b5
				$result = $db->sql_query($sql);
4c79b5
				if (!$row = $db->sql_fetchrow($result))
4c79b5
				{
4c79b5
					$confirm_id = '';
4c79b5
				}
4c79b5
				$db->sql_freeresult($result);
4c79b5
			}
4c79b5
			else
4c79b5
			{
4c79b5
				$str = '';
4c79b5
			}
4c79b5
			if (!$change_lang || !$confirm_id)
4c79b5
			{
4c79b5
				$user->confirm_gc(CONFIRM_REG);
4c79b5
4c79b5
				$sql = 'SELECT COUNT(session_id) AS attempts
4c79b5
					FROM ' . CONFIRM_TABLE . "
4c79b5
					WHERE session_id = '" . $db->sql_escape($user->session_id) . "'
4c79b5
						AND confirm_type = " . CONFIRM_REG;
4c79b5
				$result = $db->sql_query($sql);
4c79b5
				$attempts = (int) $db->sql_fetchfield('attempts');
4c79b5
				$db->sql_freeresult($result);
4c79b5
4c79b5
				if ($config['max_reg_attempts'] && $attempts > $config['max_reg_attempts'])
4c79b5
				{
4c79b5
					trigger_error('TOO_MANY_REGISTERS');
4c79b5
				}
4c79b5
4c79b5
				$code = gen_rand_string(mt_rand(5, 8));
4c79b5
				$confirm_id = md5(unique_id($user->ip));
4c79b5
				$seed = hexdec(substr(unique_id(), 4, 10));
4c79b5
4c79b5
				// compute $seed % 0x7fffffff
4c79b5
				$seed -= 0x7fffffff * floor($seed / 0x7fffffff);
4c79b5
4c79b5
				$sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
4c79b5
					'confirm_id'	=> (string) $confirm_id,
4c79b5
					'session_id'	=> (string) $user->session_id,
4c79b5
					'confirm_type'	=> (int) CONFIRM_REG,
4c79b5
					'code'			=> (string) $code,
4c79b5
					'seed'			=> (int) $seed)
4c79b5
				);
4c79b5
				$db->sql_query($sql);
4c79b5
			}
4c79b5
			$confirm_image = '';
4c79b5
			$s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';
4c79b5
		}
4c79b5
4c79b5
		//
4c79b5
		$l_reg_cond = '';
4c79b5
		switch ($config['require_activation'])
4c79b5
		{
4c79b5
			case USER_ACTIVATION_SELF:
4c79b5
				$l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE'];
4c79b5
			break;
4c79b5
4c79b5
			case USER_ACTIVATION_ADMIN:
4c79b5
				$l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE'];
4c79b5
			break;
4c79b5
		}
4c79b5
4c79b5
		$template->assign_vars(array(
4c79b5
			'ERROR'				=> (sizeof($error)) ? implode('
', $error) : '',
4c79b5
			'USERNAME'			=> $data['username'],
4c79b5
			'PASSWORD'			=> $data['new_password'],
4c79b5
			'PASSWORD_CONFIRM'	=> $data['password_confirm'],
4c79b5
			'EMAIL'				=> $data['email'],
4c79b5
			'EMAIL_CONFIRM'		=> $data['email_confirm'],
4c79b5
			'CONFIRM_IMG'		=> $confirm_image,
4c79b5
4c79b5
			'L_CONFIRM_EXPLAIN'			=> sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''),
4c79b5
			'L_REG_COND'				=> $l_reg_cond,
4c79b5
			'L_USERNAME_EXPLAIN'		=> sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),
4c79b5
			'L_PASSWORD_EXPLAIN'		=> sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),
4c79b5
4c79b5
			'S_LANG_OPTIONS'	=> language_select($data['lang']),
4c79b5
			'S_TZ_OPTIONS'		=> tz_select($data['tz']),
4c79b5
			'S_CONFIRM_CODE'	=> ($config['enable_confirm']) ? true : false,
4c79b5
			'S_COPPA'			=> $coppa,
4c79b5
			'S_HIDDEN_FIELDS'	=> $s_hidden_fields,
4c79b5
			'S_UCP_ACTION'		=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'),
4c79b5
			)
4c79b5
		);
4c79b5
4c79b5
		//
4c79b5
		$user->profile_fields = array();
4c79b5
4c79b5
		// Generate profile fields -> Template Block Variable profile_fields
4c79b5
		$cp->generate_profile_fields('register', $user->get_iso_lang_id());
4c79b5
4c79b5
		//
4c79b5
		$this->tpl_name = 'ucp_register';
4c79b5
		$this->page_title = 'UCP_REGISTRATION';
4c79b5
	}
4c79b5
}
4c79b5
4c79b5
?>