root / tags / release_3_0_1 / phpBB / includes / ucp / ucp_register.php @ 8499
History | View | Annotate | Download (17 KB)
| 1 | <?php
|
|---|---|
| 2 | /**
|
| 3 | * |
| 4 | * @package ucp |
| 5 | * @version $Id: ucp_register.php 8479 2008-03-29 00:22:48Z naderman $ |
| 6 | * @copyright (c) 2005 phpBB Group |
| 7 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | /**
|
| 12 | * @ignore |
| 13 | */ |
| 14 | if (!defined('IN_PHPBB')) |
| 15 | {
|
| 16 | exit;
|
| 17 | } |
| 18 | |
| 19 | /**
|
| 20 | * ucp_register |
| 21 | * Board registration |
| 22 | * @package ucp |
| 23 | */ |
| 24 | class ucp_register
|
| 25 | {
|
| 26 | var $u_action;
|
| 27 | |
| 28 | function main($id, $mode)
|
| 29 | {
|
| 30 | global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
|
| 31 | |
| 32 | //
|
| 33 | if ($config['require_activation'] == USER_ACTIVATION_DISABLE) |
| 34 | {
|
| 35 | trigger_error('UCP_REGISTER_DISABLE');
|
| 36 | } |
| 37 | |
| 38 | include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); |
| 39 | |
| 40 | $confirm_id = request_var('confirm_id', ''); |
| 41 | $coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; |
| 42 | $agreed = (!empty($_POST['agreed'])) ? 1 : 0; |
| 43 | $submit = (isset($_POST['submit'])) ? true : false; |
| 44 | $change_lang = request_var('change_lang', ''); |
| 45 | $user_lang = request_var('lang', $user->lang_name);
|
| 46 | |
| 47 | if ($agreed)
|
| 48 | {
|
| 49 | add_form_key('ucp_register');
|
| 50 | } |
| 51 | else
|
| 52 | {
|
| 53 | add_form_key('ucp_register_terms');
|
| 54 | } |
| 55 | |
| 56 | |
| 57 | if ($change_lang || $user_lang != $config['default_lang']) |
| 58 | {
|
| 59 | $use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang); |
| 60 | |
| 61 | if (file_exists($phpbb_root_path . 'language/' . $use_lang . '/')) |
| 62 | {
|
| 63 | if ($change_lang)
|
| 64 | {
|
| 65 | $submit = false;
|
| 66 | |
| 67 | // Setting back agreed to let the user view the agreement in his/her language
|
| 68 | $agreed = (empty($_GET['change_lang'])) ? 0 : $agreed; |
| 69 | } |
| 70 | |
| 71 | $user->lang_name = $lang = $use_lang; |
| 72 | $user->lang_path = $phpbb_root_path . 'language/' . $lang . '/'; |
| 73 | $user->lang = array();
|
| 74 | $user->add_lang(array('common', 'ucp')); |
| 75 | } |
| 76 | else
|
| 77 | {
|
| 78 | $change_lang = '';
|
| 79 | $user_lang = $user->lang_name; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | $cp = new custom_profile();
|
| 84 | |
| 85 | $error = $cp_data = $cp_error = array();
|
| 86 | |
| 87 | |
| 88 | if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable'])) |
| 89 | {
|
| 90 | $add_lang = ($change_lang) ? '&change_lang=' . urlencode($change_lang) : ''; |
| 91 | $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : ''; |
| 92 | |
| 93 | $s_hidden_fields = ($confirm_id) ? array('confirm_id' => $confirm_id) : array(); |
| 94 | |
| 95 | // If we change the language, we want to pass on some more possible parameter.
|
| 96 | if ($change_lang)
|
| 97 | {
|
| 98 | // We do not include the password
|
| 99 | $s_hidden_fields = array_merge($s_hidden_fields, array(
|
| 100 | 'username' => utf8_normalize_nfc(request_var('username', '', true)), |
| 101 | 'email' => strtolower(request_var('email', '')), |
| 102 | 'email_confirm' => strtolower(request_var('email_confirm', '')), |
| 103 | 'confirm_code' => request_var('confirm_code', ''), |
| 104 | 'confirm_id' => request_var('confirm_id', ''), |
| 105 | 'lang' => $user->lang_name,
|
| 106 | 'tz' => request_var('tz', (float) $config['board_timezone']), |
| 107 | )); |
| 108 | } |
| 109 | |
| 110 | if ($coppa === false && $config['coppa_enable']) |
| 111 | {
|
| 112 | $now = getdate(); |
| 113 | $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']); |
| 114 | unset($now);
|
| 115 | |
| 116 | $template->assign_vars(array(
|
| 117 | 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), |
| 118 | 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), |
| 119 | |
| 120 | 'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0' . $add_lang), |
| 121 | 'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1' . $add_lang), |
| 122 | |
| 123 | 'S_SHOW_COPPA' => true, |
| 124 | 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields),
|
| 125 | 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang), |
| 126 | )); |
| 127 | } |
| 128 | else
|
| 129 | {
|
| 130 | $template->assign_vars(array(
|
| 131 | 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()), |
| 132 | |
| 133 | 'S_SHOW_COPPA' => false, |
| 134 | 'S_REGISTRATION' => true, |
| 135 | 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields),
|
| 136 | 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang . $add_coppa), |
| 137 | ) |
| 138 | ); |
| 139 | } |
| 140 | |
| 141 | $this->tpl_name = 'ucp_agreement'; |
| 142 | return;
|
| 143 | } |
| 144 | |
| 145 | |
| 146 | // Try to manually determine the timezone and adjust the dst if the server date/time complies with the default setting +/- 1
|
| 147 | $timezone = date('Z') / 3600; |
| 148 | $is_dst = date('I');
|
| 149 | |
| 150 | if ($config['board_timezone'] == $timezone || $config['board_timezone'] == ($timezone - 1)) |
| 151 | {
|
| 152 | $timezone = ($is_dst) ? $timezone - 1 : $timezone; |
| 153 | |
| 154 | if (!isset($user->lang['tz_zones'][(string) $timezone])) |
| 155 | {
|
| 156 | $timezone = $config['board_timezone']; |
| 157 | } |
| 158 | } |
| 159 | else |
| 160 | {
|
| 161 | $is_dst = $config['board_dst']; |
| 162 | $timezone = $config['board_timezone']; |
| 163 | } |
| 164 | |
| 165 | $data = array( |
| 166 | 'username' => utf8_normalize_nfc(request_var('username', '', true)),
|
| 167 | 'new_password' => request_var('new_password', '', true),
|
| 168 | 'password_confirm' => request_var('password_confirm', '', true),
|
| 169 | 'email' => strtolower(request_var('email', '')),
|
| 170 | 'email_confirm' => strtolower(request_var('email_confirm', '')),
|
| 171 | 'confirm_code' => request_var('confirm_code', ''),
|
| 172 | 'lang' => basename(request_var('lang', $user->lang_name)),
|
| 173 | 'tz' => request_var('tz', (float) $timezone),
|
| 174 | ); |
| 175 | |
| 176 | // Check and initialize some variables if needed |
| 177 | if ($submit) |
| 178 | {
|
| 179 | $error = validate_data($data, array( |
| 180 | 'username' => array( |
| 181 | array('string', false, $config['min_name_chars'], $config['max_name_chars']),
|
| 182 | array('username', '')),
|
| 183 | 'new_password' => array( |
| 184 | array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
|
| 185 | array('password')),
|
| 186 | 'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
|
| 187 | 'email' => array( |
| 188 | array('string', false, 6, 60),
|
| 189 | array('email')),
|
| 190 | 'email_confirm' => array('string', false, 6, 60),
|
| 191 | 'confirm_code' => array('string', !$config['enable_confirm'], 5, 8),
|
| 192 | 'tz' => array('num', false, -14, 14),
|
| 193 | 'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'),
|
| 194 | )); |
| 195 | if (!check_form_key('ucp_register'))
|
| 196 | {
|
| 197 | $error[] = $user->lang['FORM_INVALID']; |
| 198 | } |
| 199 | // Replace "error" strings with their real, localised form |
| 200 | $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
| 201 | |
| 202 | // DNSBL check |
| 203 | if ($config['check_dnsbl']) |
| 204 | {
|
| 205 | if (($dnsbl = $user->check_dnsbl('register')) !== false)
|
| 206 | {
|
| 207 | $error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | // validate custom profile fields |
| 212 | $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error);
|
| 213 | |
| 214 | // Visual Confirmation handling |
| 215 | $wrong_confirm = false; |
| 216 | if ($config['enable_confirm']) |
| 217 | {
|
| 218 | if (!$confirm_id) |
| 219 | {
|
| 220 | $error[] = $user->lang['CONFIRM_CODE_WRONG']; |
| 221 | $wrong_confirm = true; |
| 222 | } |
| 223 | else |
| 224 | {
|
| 225 | $sql = 'SELECT code |
| 226 | FROM ' . CONFIRM_TABLE . " |
| 227 | WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' |
| 228 | AND session_id = '" . $db->sql_escape($user->session_id) . "' |
| 229 | AND confirm_type = " . CONFIRM_REG; |
| 230 | $result = $db->sql_query($sql); |
| 231 | $row = $db->sql_fetchrow($result); |
| 232 | $db->sql_freeresult($result); |
| 233 | |
| 234 | if ($row) |
| 235 | {
|
| 236 | if (strcasecmp($row['code'], $data['confirm_code']) === 0) |
| 237 | {
|
| 238 | $sql = 'DELETE FROM ' . CONFIRM_TABLE . " |
| 239 | WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' |
| 240 | AND session_id = '" . $db->sql_escape($user->session_id) . "' |
| 241 | AND confirm_type = " . CONFIRM_REG; |
| 242 | $db->sql_query($sql); |
| 243 | } |
| 244 | else |
| 245 | {
|
| 246 | $error[] = $user->lang['CONFIRM_CODE_WRONG']; |
| 247 | $wrong_confirm = true; |
| 248 | } |
| 249 | } |
| 250 | else |
| 251 | {
|
| 252 | $error[] = $user->lang['CONFIRM_CODE_WRONG']; |
| 253 | $wrong_confirm = true; |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | if (!sizeof($error)) |
| 259 | {
|
| 260 | if ($data['new_password'] != $data['password_confirm']) |
| 261 | {
|
| 262 | $error[] = $user->lang['NEW_PASSWORD_ERROR']; |
| 263 | } |
| 264 | |
| 265 | if ($data['email'] != $data['email_confirm']) |
| 266 | {
|
| 267 | $error[] = $user->lang['NEW_EMAIL_ERROR']; |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | if (!sizeof($error)) |
| 272 | {
|
| 273 | $server_url = generate_board_url(); |
| 274 | |
| 275 | // Which group by default? |
| 276 | $group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED'; |
| 277 | |
| 278 | $sql = 'SELECT group_id |
| 279 | FROM ' . GROUPS_TABLE . " |
| 280 | WHERE group_name = '" . $db->sql_escape($group_name) . "' |
| 281 | AND group_type = " . GROUP_SPECIAL; |
| 282 | $result = $db->sql_query($sql); |
| 283 | $row = $db->sql_fetchrow($result); |
| 284 | $db->sql_freeresult($result); |
| 285 | |
| 286 | if (!$row) |
| 287 | {
|
| 288 | trigger_error('NO_GROUP');
|
| 289 | } |
| 290 | |
| 291 | $group_id = $row['group_id']; |
| 292 | |
| 293 | if (($coppa || |
| 294 | $config['require_activation'] == USER_ACTIVATION_SELF || |
| 295 | $config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable']) |
| 296 | {
|
| 297 | $user_actkey = gen_rand_string(10); |
| 298 | $key_len = 54 - (strlen($server_url)); |
| 299 | $key_len = ($key_len < 6) ? 6 : $key_len; |
| 300 | $user_actkey = substr($user_actkey, 0, $key_len); |
| 301 | |
| 302 | $user_type = USER_INACTIVE; |
| 303 | $user_inactive_reason = INACTIVE_REGISTER; |
| 304 | $user_inactive_time = time(); |
| 305 | } |
| 306 | else |
| 307 | {
|
| 308 | $user_type = USER_NORMAL; |
| 309 | $user_actkey = ''; |
| 310 | $user_inactive_reason = 0; |
| 311 | $user_inactive_time = 0; |
| 312 | } |
| 313 | |
| 314 | $user_row = array( |
| 315 | 'username' => $data['username'], |
| 316 | 'user_password' => phpbb_hash($data['new_password']), |
| 317 | 'user_email' => $data['email'], |
| 318 | 'group_id' => (int) $group_id, |
| 319 | 'user_timezone' => (float) $data['tz'], |
| 320 | 'user_dst' => $is_dst, |
| 321 | 'user_lang' => $data['lang'], |
| 322 | 'user_type' => $user_type, |
| 323 | 'user_actkey' => $user_actkey, |
| 324 | 'user_ip' => $user->ip, |
| 325 | 'user_regdate' => time(), |
| 326 | 'user_inactive_reason' => $user_inactive_reason, |
| 327 | 'user_inactive_time' => $user_inactive_time, |
| 328 | ); |
| 329 | |
| 330 | // Register user... |
| 331 | $user_id = user_add($user_row, $cp_data); |
| 332 | |
| 333 | // This should not happen, because the required variables are listed above... |
| 334 | if ($user_id === false) |
| 335 | {
|
| 336 | trigger_error('NO_USER', E_USER_ERROR);
|
| 337 | } |
| 338 | |
| 339 | if ($coppa && $config['email_enable']) |
| 340 | {
|
| 341 | $message = $user->lang['ACCOUNT_COPPA']; |
| 342 | $email_template = 'coppa_welcome_inactive'; |
| 343 | } |
| 344 | else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) |
| 345 | {
|
| 346 | $message = $user->lang['ACCOUNT_INACTIVE']; |
| 347 | $email_template = 'user_welcome_inactive'; |
| 348 | } |
| 349 | else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable']) |
| 350 | {
|
| 351 | $message = $user->lang['ACCOUNT_INACTIVE_ADMIN']; |
| 352 | $email_template = 'admin_welcome_inactive'; |
| 353 | } |
| 354 | else |
| 355 | {
|
| 356 | $message = $user->lang['ACCOUNT_ADDED']; |
| 357 | $email_template = 'user_welcome'; |
| 358 | } |
| 359 | |
| 360 | if ($config['email_enable']) |
| 361 | {
|
| 362 | include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); |
| 363 | |
| 364 | $messenger = new messenger(false); |
| 365 | |
| 366 | $messenger->template($email_template, $data['lang']); |
| 367 | |
| 368 | $messenger->to($data['email'], $data['username']); |
| 369 | |
| 370 | $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); |
| 371 | $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); |
| 372 | $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); |
| 373 | $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); |
| 374 | |
| 375 | $messenger->assign_vars(array( |
| 376 | 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), |
| 377 | 'USERNAME' => htmlspecialchars_decode($data['username']), |
| 378 | 'PASSWORD' => htmlspecialchars_decode($data['new_password']), |
| 379 | 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey") |
| 380 | ); |
| 381 | |
| 382 | if ($coppa) |
| 383 | {
|
| 384 | $messenger->assign_vars(array( |
| 385 | 'FAX_INFO' => $config['coppa_fax'], |
| 386 | 'MAIL_INFO' => $config['coppa_mail'], |
| 387 | 'EMAIL_ADDRESS' => $data['email']) |
| 388 | ); |
| 389 | } |
| 390 | |
| 391 | $messenger->send(NOTIFY_EMAIL); |
| 392 | |
| 393 | if ($config['require_activation'] == USER_ACTIVATION_ADMIN) |
| 394 | {
|
| 395 | // Grab an array of user_id's with a_user permissions ... these users can activate a user
|
| 396 | $admin_ary = $auth->acl_get_list(false, 'a_user', false); |
| 397 | $admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array(); |
| 398 | |
| 399 | // Also include founders
|
| 400 | $where_sql = ' WHERE user_type = ' . USER_FOUNDER;
|
| 401 | |
| 402 | if (sizeof($admin_ary))
|
| 403 | {
|
| 404 | $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary); |
| 405 | } |
| 406 | |
| 407 | $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
|
| 408 | FROM ' . USERS_TABLE . ' ' . |
| 409 | $where_sql; |
| 410 | $result = $db->sql_query($sql); |
| 411 | |
| 412 | while ($row = $db->sql_fetchrow($result))
|
| 413 | {
|
| 414 | $messenger->template('admin_activate', $row['user_lang']); |
| 415 | $messenger->to($row['user_email'], $row['username']); |
| 416 | $messenger->im($row['user_jabber'], $row['username']); |
| 417 | |
| 418 | $messenger->assign_vars(array(
|
| 419 | 'USERNAME' => htmlspecialchars_decode($data['username']), |
| 420 | 'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u=$user_id", |
| 421 | 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey") |
| 422 | ); |
| 423 | |
| 424 | $messenger->send($row['user_notify_type']);
|
| 425 | } |
| 426 | $db->sql_freeresult($result); |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'); |
| 431 | trigger_error($message); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | $s_hidden_fields = array(
|
| 436 | 'agreed' => 'true', |
| 437 | 'change_lang' => 0, |
| 438 | ); |
| 439 | |
| 440 | if ($config['coppa_enable']) |
| 441 | {
|
| 442 | $s_hidden_fields['coppa'] = $coppa;
|
| 443 | } |
| 444 | $s_hidden_fields = build_hidden_fields($s_hidden_fields); |
| 445 | |
| 446 | $confirm_image = '';
|
| 447 | |
| 448 | // Visual Confirmation - Show images
|
| 449 | |
| 450 | if ($config['enable_confirm']) |
| 451 | {
|
| 452 | if ($change_lang)
|
| 453 | {
|
| 454 | $str = '&change_lang=' . $change_lang;
|
| 455 | $sql = 'SELECT code
|
| 456 | FROM ' . CONFIRM_TABLE . " |
| 457 | WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' |
| 458 | AND session_id = '" . $db->sql_escape($user->session_id) . "' |
| 459 | AND confirm_type = " . CONFIRM_REG;
|
| 460 | $result = $db->sql_query($sql); |
| 461 | if (!$row = $db->sql_fetchrow($result))
|
| 462 | {
|
| 463 | $confirm_id = '';
|
| 464 | } |
| 465 | $db->sql_freeresult($result); |
| 466 | } |
| 467 | else
|
| 468 | {
|
| 469 | $str = '';
|
| 470 | } |
| 471 | if (!$change_lang || !$confirm_id)
|
| 472 | {
|
| 473 | $user->confirm_gc(CONFIRM_REG); |
| 474 | |
| 475 | $sql = 'SELECT COUNT(session_id) AS attempts
|
| 476 | FROM ' . CONFIRM_TABLE . " |
| 477 | WHERE session_id = '" . $db->sql_escape($user->session_id) . "' |
| 478 | AND confirm_type = " . CONFIRM_REG;
|
| 479 | $result = $db->sql_query($sql); |
| 480 | $attempts = (int) $db->sql_fetchfield('attempts');
|
| 481 | $db->sql_freeresult($result); |
| 482 | |
| 483 | if ($config['max_reg_attempts'] && $attempts > $config['max_reg_attempts']) |
| 484 | {
|
| 485 | trigger_error('TOO_MANY_REGISTERS');
|
| 486 | } |
| 487 | |
| 488 | $code = gen_rand_string(mt_rand(5, 8)); |
| 489 | $confirm_id = md5(unique_id($user->ip)); |
| 490 | $seed = hexdec(substr(unique_id(), 4, 10)); |
| 491 | |
| 492 | // compute $seed % 0x7fffffff
|
| 493 | $seed -= 0x7fffffff * floor($seed / 0x7fffffff); |
| 494 | |
| 495 | $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( |
| 496 | 'confirm_id' => (string) $confirm_id,
|
| 497 | 'session_id' => (string) $user->session_id,
|
| 498 | 'confirm_type' => (int) CONFIRM_REG,
|
| 499 | 'code' => (string) $code,
|
| 500 | 'seed' => (int) $seed)
|
| 501 | ); |
| 502 | $db->sql_query($sql); |
| 503 | } |
| 504 | $confirm_image = '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_REG . $str) . '" alt="" title="" />'; |
| 505 | $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />'; |
| 506 | } |
| 507 | |
| 508 | //
|
| 509 | $l_reg_cond = '';
|
| 510 | switch ($config['require_activation']) |
| 511 | {
|
| 512 | case USER_ACTIVATION_SELF:
|
| 513 | $l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE'];
|
| 514 | break;
|
| 515 | |
| 516 | case USER_ACTIVATION_ADMIN:
|
| 517 | $l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE'];
|
| 518 | break;
|
| 519 | } |
| 520 | |
| 521 | $template->assign_vars(array(
|
| 522 | 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', |
| 523 | 'USERNAME' => $data['username'], |
| 524 | 'PASSWORD' => $data['new_password'], |
| 525 | 'PASSWORD_CONFIRM' => $data['password_confirm'], |
| 526 | 'EMAIL' => $data['email'], |
| 527 | 'EMAIL_CONFIRM' => $data['email_confirm'], |
| 528 | 'CONFIRM_IMG' => $confirm_image,
|
| 529 | |
| 530 | 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'), |
| 531 | 'L_REG_COND' => $l_reg_cond,
|
| 532 | 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), |
| 533 | 'L_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), |
| 534 | |
| 535 | 'S_LANG_OPTIONS' => language_select($data['lang']), |
| 536 | 'S_TZ_OPTIONS' => tz_select($data['tz']), |
| 537 | 'S_CONFIRM_CODE' => ($config['enable_confirm']) ? true : false, |
| 538 | 'S_COPPA' => $coppa,
|
| 539 | 'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
| 540 | 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), |
| 541 | ) |
| 542 | ); |
| 543 | |
| 544 | //
|
| 545 | $user->profile_fields = array();
|
| 546 | |
| 547 | // Generate profile fields -> Template Block Variable profile_fields
|
| 548 | $cp->generate_profile_fields('register', $user->get_iso_lang_id());
|
| 549 | |
| 550 | //
|
| 551 | $this->tpl_name = 'ucp_register'; |
| 552 | $this->page_title = 'UCP_REGISTRATION'; |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | ?> |