[ Index ]

PHP Cross Reference of phpBB-3.3.0-deutsch

title

Body

[close]

/includes/ucp/ -> ucp_register.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  /**
  15  * @ignore
  16  */
  17  if (!defined('IN_PHPBB'))
  18  {
  19      exit;
  20  }
  21  
  22  /**
  23  * ucp_register
  24  * Board registration
  25  */
  26  class ucp_register
  27  {
  28      var $u_action;
  29  
  30  	function main($id, $mode)
  31      {
  32          global $config, $db, $user, $template, $phpbb_root_path, $phpEx;
  33          global $request, $phpbb_container, $phpbb_dispatcher;
  34  
  35          //
  36          if ($config['require_activation'] == USER_ACTIVATION_DISABLE ||
  37              (in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN)) && !$config['email_enable']))
  38          {
  39              trigger_error('UCP_REGISTER_DISABLE');
  40          }
  41  
  42          $coppa            = $request->is_set('coppa_yes') ? 1 : ($request->is_set('coppa_no') ? 0 : false);
  43          $coppa            = $request->is_set('coppa') ? $request->variable('coppa', 0) : $coppa;
  44          $agreed            = $request->variable('agreed', false);
  45          $submit            = $request->is_set_post('submit');
  46          $change_lang    = $request->variable('change_lang', '');
  47          $user_lang        = $request->variable('lang', $user->lang_name);
  48  
  49          if ($agreed && !check_form_key('ucp_register'))
  50          {
  51              $agreed = false;
  52          }
  53  
  54          if ($coppa !== false && !check_form_key('ucp_register'))
  55          {
  56              $coppa = false;
  57          }
  58  
  59          /**
  60          * Add UCP register data before they are assigned to the template or submitted
  61          *
  62          * To assign data to the template, use $template->assign_vars()
  63          *
  64          * @event core.ucp_register_requests_after
  65          * @var    bool    coppa        Is set coppa
  66          * @var    bool    agreed        Did user agree to coppa?
  67          * @var    bool    submit        Is set post submit?
  68          * @var    string    change_lang    Change language request
  69          * @var    string    user_lang    User language request
  70          * @since 3.1.11-RC1
  71          */
  72          $vars = array(
  73              'coppa',
  74              'agreed',
  75              'submit',
  76              'change_lang',
  77              'user_lang',
  78          );
  79          extract($phpbb_dispatcher->trigger_event('core.ucp_register_requests_after', compact($vars)));
  80  
  81          add_form_key('ucp_register');
  82  
  83          if ($change_lang || $user_lang != $config['default_lang'])
  84          {
  85              $use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang);
  86  
  87              if (!validate_language_iso_name($use_lang))
  88              {
  89                  if ($change_lang)
  90                  {
  91                      $submit = false;
  92  
  93                      // Setting back agreed to let the user view the agreement in his/her language
  94                      $agreed = false;
  95                  }
  96  
  97                  $user_lang = $use_lang;
  98              }
  99              else
 100              {
 101                  $change_lang = '';
 102                  $user_lang = $user->lang_name;
 103              }
 104          }
 105  
 106          /* @var $cp \phpbb\profilefields\manager */
 107          $cp = $phpbb_container->get('profilefields.manager');
 108  
 109          $error = $cp_data = $cp_error = array();
 110          $s_hidden_fields = array();
 111  
 112          // Handle login_link data added to $_hidden_fields
 113          $login_link_data = $this->get_login_link_data_array();
 114  
 115          if (!empty($login_link_data))
 116          {
 117              // Confirm that we have all necessary data
 118              /* @var $provider_collection \phpbb\auth\provider_collection */
 119              $provider_collection = $phpbb_container->get('auth.provider_collection');
 120              $auth_provider = $provider_collection->get_provider($request->variable('auth_provider', ''));
 121  
 122              $result = $auth_provider->login_link_has_necessary_data($login_link_data);
 123              if ($result !== null)
 124              {
 125                  $error[] = $user->lang[$result];
 126              }
 127  
 128              $s_hidden_fields = array_merge($s_hidden_fields, $this->get_login_link_data_for_hidden_fields($login_link_data));
 129          }
 130  
 131          if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable']))
 132          {
 133              $add_coppa = ($coppa !== false) ? '&amp;coppa=' . $coppa : '';
 134  
 135              $s_hidden_fields = array_merge($s_hidden_fields, array(
 136                  'change_lang'    => '',
 137              ));
 138  
 139              // If we change the language, we want to pass on some more possible parameter.
 140              if ($change_lang)
 141              {
 142                  // We do not include the password
 143                  $s_hidden_fields = array_merge($s_hidden_fields, array(
 144                      'username'            => $request->variable('username', '', true),
 145                      'email'                => strtolower($request->variable('email', '')),
 146                      'lang'                => $user->lang_name,
 147                      'tz'                => $request->variable('tz', $config['board_timezone']),
 148                  ));
 149  
 150              }
 151  
 152              // Checking amount of available languages
 153              $sql = 'SELECT lang_id
 154                  FROM ' . LANG_TABLE;
 155              $result = $db->sql_query($sql);
 156  
 157              $lang_row = array();
 158              while ($row = $db->sql_fetchrow($result))
 159              {
 160                  $lang_row[] = $row;
 161              }
 162              $db->sql_freeresult($result);
 163  
 164              if ($coppa === false && $config['coppa_enable'])
 165              {
 166                  $now = getdate();
 167                  $coppa_birthday = $user->create_datetime()
 168                      ->setDate($now['year'] - 13, $now['mon'], $now['mday'] - 1)
 169                      ->setTime(0, 0, 0)
 170                      ->format($user->lang['DATE_FORMAT'], true);
 171                  unset($now);
 172  
 173                  $template_vars = array(
 174                      'S_LANG_OPTIONS'    => (count($lang_row) > 1) ? language_select($user_lang) : '',
 175                      'L_COPPA_NO'        => $user->lang('UCP_COPPA_BEFORE', $coppa_birthday),
 176                      'L_COPPA_YES'        => $user->lang('UCP_COPPA_ON_AFTER', $coppa_birthday),
 177  
 178                      'S_SHOW_COPPA'        => true,
 179                      'S_HIDDEN_FIELDS'    => build_hidden_fields($s_hidden_fields),
 180                      'S_UCP_ACTION'        => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'),
 181  
 182                      'COOKIE_NAME'        => $config['cookie_name'],
 183                      'COOKIE_PATH'        => $config['cookie_path'],
 184                  );
 185              }
 186              else
 187              {
 188                  $template_vars = array(
 189                      'S_LANG_OPTIONS'    => (count($lang_row) > 1) ? language_select($user_lang) : '',
 190                      'L_TERMS_OF_USE'    => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()),
 191  
 192                      'S_SHOW_COPPA'        => false,
 193                      'S_REGISTRATION'    => true,
 194                      'S_HIDDEN_FIELDS'    => build_hidden_fields($s_hidden_fields),
 195                      'S_UCP_ACTION'        => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_coppa),
 196  
 197                      'COOKIE_NAME'        => $config['cookie_name'],
 198                      'COOKIE_PATH'        => $config['cookie_path'],
 199                  );
 200              }
 201  
 202              $tpl_name = 'ucp_agreement';
 203  
 204              /**
 205              * Allows to modify the agreements.
 206              *
 207              * @event core.ucp_register_agreement_modify_template_data
 208              * @var    string    tpl_name            Template file
 209              * @var    array    template_vars        Array with data about to be assigned to the template
 210              * @var    array    s_hidden_fields        Array with hidden form elements
 211              * @var    array    lang_row            Array with available languages, read only
 212              * @since 3.2.2-RC1
 213              */
 214              $vars = array('tpl_name', 'template_vars', 's_hidden_fields', 'lang_row');
 215              extract($phpbb_dispatcher->trigger_event('core.ucp_register_agreement_modify_template_data', compact($vars)));
 216  
 217              unset($lang_row);
 218  
 219              $template_vars = array_merge($template_vars, array(
 220                  'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields),
 221              ));
 222  
 223              $template->assign_vars($template_vars);
 224  
 225              /**
 226              * Allows to modify the agreements.
 227              *
 228              * To assign data to the template, use $template->assign_vars()
 229              *
 230              * @event core.ucp_register_agreement
 231              * @since 3.1.6-RC1
 232              * @deprecated 3.2.2-RC1 Replaced by core.ucp_register_agreement_modify_template_data and to be removed in 3.3.0-RC1
 233              */
 234              $phpbb_dispatcher->dispatch('core.ucp_register_agreement');
 235  
 236              $this->tpl_name = $tpl_name;
 237              return;
 238          }
 239  
 240          // The CAPTCHA kicks in here. We can't help that the information gets lost on language change.
 241          if ($config['enable_confirm'])
 242          {
 243              $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
 244              $captcha->init(CONFIRM_REG);
 245          }
 246  
 247          $timezone = $config['board_timezone'];
 248  
 249          $data = array(
 250              'username'            => $request->variable('username', '', true),
 251              'new_password'        => $request->variable('new_password', '', true),
 252              'password_confirm'    => $request->variable('password_confirm', '', true),
 253              'email'                => strtolower($request->variable('email', '')),
 254              'lang'                => basename($request->variable('lang', $user->lang_name)),
 255              'tz'                => $request->variable('tz', $timezone),
 256          );
 257          /**
 258          * Add UCP register data before they are assigned to the template or submitted
 259          *
 260          * To assign data to the template, use $template->assign_vars()
 261          *
 262          * @event core.ucp_register_data_before
 263          * @var    bool    submit        Do we display the form only
 264          *                            or did the user press submit
 265          * @var    array    data        Array with current ucp registration data
 266          * @since 3.1.4-RC1
 267          */
 268          $vars = array('submit', 'data');
 269          extract($phpbb_dispatcher->trigger_event('core.ucp_register_data_before', compact($vars)));
 270  
 271          // Check and initialize some variables if needed
 272          if ($submit)
 273          {
 274              $error = validate_data($data, array(
 275                  'username'            => array(
 276                      array('string', false, $config['min_name_chars'], $config['max_name_chars']),
 277                      array('username', '')),
 278                  'new_password'        => array(
 279                      array('string', false, $config['min_pass_chars'], 0),
 280                      array('password')),
 281                  'password_confirm'    => array('string', false, $config['min_pass_chars'], 0),
 282                  'email'                => array(
 283                      array('string', false, 6, 60),
 284                      array('user_email')),
 285                  'tz'                => array('timezone'),
 286                  'lang'                => array('language_iso_name'),
 287              ));
 288  
 289              if (!check_form_key('ucp_register'))
 290              {
 291                  $error[] = $user->lang['FORM_INVALID'];
 292              }
 293  
 294              // Replace "error" strings with their real, localised form
 295              $error = array_map(array($user, 'lang'), $error);
 296  
 297              if ($config['enable_confirm'])
 298              {
 299                  $vc_response = $captcha->validate($data);
 300                  if ($vc_response !== false)
 301                  {
 302                      $error[] = $vc_response;
 303                  }
 304  
 305                  if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts'])
 306                  {
 307                      $error[] = $user->lang['TOO_MANY_REGISTERS'];
 308                  }
 309              }
 310  
 311              // DNSBL check
 312              if ($config['check_dnsbl'])
 313              {
 314                  if (($dnsbl = $user->check_dnsbl('register')) !== false)
 315                  {
 316                      $error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]);
 317                  }
 318              }
 319  
 320              // validate custom profile fields
 321              $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error);
 322  
 323              if (!count($error))
 324              {
 325                  if ($data['new_password'] != $data['password_confirm'])
 326                  {
 327                      $error[] = $user->lang['NEW_PASSWORD_ERROR'];
 328                  }
 329              }
 330              /**
 331              * Check UCP registration data after they are submitted
 332              *
 333              * @event core.ucp_register_data_after
 334              * @var    bool    submit        Do we display the form only
 335              *                            or did the user press submit
 336              * @var    array     data        Array with current ucp registration data
 337              * @var    array    cp_data        Array with custom profile fields data
 338              * @var    array     error        Array with list of errors
 339              * @since 3.1.4-RC1
 340              */
 341              $vars = array('submit', 'data', 'cp_data', 'error');
 342              extract($phpbb_dispatcher->trigger_event('core.ucp_register_data_after', compact($vars)));
 343  
 344              if (!count($error))
 345              {
 346                  $server_url = generate_board_url();
 347  
 348                  // Which group by default?
 349                  $group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED';
 350  
 351                  $sql = 'SELECT group_id
 352                      FROM ' . GROUPS_TABLE . "
 353                      WHERE group_name = '" . $db->sql_escape($group_name) . "'
 354                          AND group_type = " . GROUP_SPECIAL;
 355                  $result = $db->sql_query($sql);
 356                  $row = $db->sql_fetchrow($result);
 357                  $db->sql_freeresult($result);
 358  
 359                  if (!$row)
 360                  {
 361                      trigger_error('NO_GROUP');
 362                  }
 363  
 364                  $group_id = $row['group_id'];
 365  
 366                  if (($coppa ||
 367                      $config['require_activation'] == USER_ACTIVATION_SELF ||
 368                      $config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable'])
 369                  {
 370                      $user_actkey = gen_rand_string(mt_rand(6, 10));
 371                      $user_type = USER_INACTIVE;
 372                      $user_inactive_reason = INACTIVE_REGISTER;
 373                      $user_inactive_time = time();
 374                  }
 375                  else
 376                  {
 377                      $user_type = USER_NORMAL;
 378                      $user_actkey = '';
 379                      $user_inactive_reason = 0;
 380                      $user_inactive_time = 0;
 381                  }
 382  
 383                  // Instantiate passwords manager
 384                  /* @var $passwords_manager \phpbb\passwords\manager */
 385                  $passwords_manager = $phpbb_container->get('passwords.manager');
 386  
 387                  $user_row = array(
 388                      'username'                => $data['username'],
 389                      'user_password'            => $passwords_manager->hash($data['new_password']),
 390                      'user_email'            => $data['email'],
 391                      'group_id'                => (int) $group_id,
 392                      'user_timezone'            => $data['tz'],
 393                      'user_lang'                => $data['lang'],
 394                      'user_type'                => $user_type,
 395                      'user_actkey'            => $user_actkey,
 396                      'user_ip'                => $user->ip,
 397                      'user_regdate'            => time(),
 398                      'user_inactive_reason'    => $user_inactive_reason,
 399                      'user_inactive_time'    => $user_inactive_time,
 400                  );
 401  
 402                  if ($config['new_member_post_limit'])
 403                  {
 404                      $user_row['user_new'] = 1;
 405                  }
 406                  /**
 407                  * Add into $user_row before user_add
 408                  *
 409                  * user_add allows adding more data into the users table
 410                  *
 411                  * @event core.ucp_register_user_row_after
 412                  * @var    bool    submit        Do we display the form only
 413                  *                            or did the user press submit
 414                  * @var    array    cp_data        Array with custom profile fields data
 415                  * @var    array    user_row    Array with current ucp registration data
 416                  * @since 3.1.4-RC1
 417                  */
 418                  $vars = array('submit', 'cp_data', 'user_row');
 419                  extract($phpbb_dispatcher->trigger_event('core.ucp_register_user_row_after', compact($vars)));
 420  
 421                  // Register user...
 422                  $user_id = user_add($user_row, $cp_data);
 423  
 424                  // This should not happen, because the required variables are listed above...
 425                  if ($user_id === false)
 426                  {
 427                      trigger_error('NO_USER', E_USER_ERROR);
 428                  }
 429  
 430                  // Okay, captcha, your job is done.
 431                  if ($config['enable_confirm'] && isset($captcha))
 432                  {
 433                      $captcha->reset();
 434                  }
 435  
 436                  if ($coppa && $config['email_enable'])
 437                  {
 438                      $message = $user->lang['ACCOUNT_COPPA'];
 439                      $email_template = 'coppa_welcome_inactive';
 440                  }
 441                  else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable'])
 442                  {
 443                      $message = $user->lang['ACCOUNT_INACTIVE'];
 444                      $email_template = 'user_welcome_inactive';
 445                  }
 446                  else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable'])
 447                  {
 448                      $message = $user->lang['ACCOUNT_INACTIVE_ADMIN'];
 449                      $email_template = 'admin_welcome_inactive';
 450                  }
 451                  else
 452                  {
 453                      $message = $user->lang['ACCOUNT_ADDED'];
 454                      $email_template = 'user_welcome';
 455  
 456                      // Autologin after registration
 457                      $user->session_create($user_id, 0, false, 1);
 458                  }
 459  
 460                  if ($config['email_enable'])
 461                  {
 462                      include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
 463  
 464                      $messenger = new messenger(false);
 465  
 466                      $messenger->template($email_template, $data['lang']);
 467  
 468                      $messenger->to($data['email'], $data['username']);
 469  
 470                      $messenger->anti_abuse_headers($config, $user);
 471  
 472                      $messenger->assign_vars(array(
 473                          'WELCOME_MSG'    => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
 474                          'USERNAME'        => htmlspecialchars_decode($data['username']),
 475                          'PASSWORD'        => htmlspecialchars_decode($data['new_password']),
 476                          'U_ACTIVATE'    => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
 477                      );
 478  
 479                      if ($coppa)
 480                      {
 481                          $messenger->assign_vars(array(
 482                              'FAX_INFO'        => $config['coppa_fax'],
 483                              'MAIL_INFO'        => $config['coppa_mail'],
 484                              'EMAIL_ADDRESS'    => $data['email'])
 485                          );
 486                      }
 487  
 488                      /**
 489                      * Modify messenger data before welcome mail is sent
 490                      *
 491                      * @event core.ucp_register_welcome_email_before
 492                      * @var    array        user_row    Array with user registration data
 493                      * @var    array        cp_data        Array with custom profile fields data
 494                      * @var    array        data        Array with current ucp registration data
 495                      * @var    string        message        Message to be displayed to the user after registration
 496                      * @var    string        server_url    Server URL
 497                      * @var    int            user_id        New user ID
 498                      * @var    string        user_actkey    User activation key
 499                      * @var    messenger    messenger    phpBB Messenger
 500                      * @since 3.2.4-RC1
 501                      */
 502                      $vars = array(
 503                          'user_row',
 504                          'cp_data',
 505                          'data',
 506                          'message',
 507                          'server_url',
 508                          'user_id',
 509                          'user_actkey',
 510                          'messenger',
 511                      );
 512                      extract($phpbb_dispatcher->trigger_event('core.ucp_register_welcome_email_before', compact($vars)));
 513  
 514                      $messenger->send(NOTIFY_EMAIL);
 515                  }
 516  
 517                  if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
 518                  {
 519                      /* @var $phpbb_notifications \phpbb\notification\manager */
 520                      $phpbb_notifications = $phpbb_container->get('notification_manager');
 521                      $phpbb_notifications->add_notifications('notification.type.admin_activate_user', array(
 522                          'user_id'        => $user_id,
 523                          'user_actkey'    => $user_row['user_actkey'],
 524                          'user_regdate'    => $user_row['user_regdate'],
 525                      ));
 526                  }
 527  
 528                  // Perform account linking if necessary
 529                  if (!empty($login_link_data))
 530                  {
 531                      $login_link_data['user_id'] = $user_id;
 532  
 533                      $result = $auth_provider->link_account($login_link_data);
 534  
 535                      if ($result)
 536                      {
 537                          $message = $message . '<br /><br />' . $user->lang[$result];
 538                      }
 539                  }
 540  
 541                  /**
 542                  * Perform additional actions after user registration
 543                  *
 544                  * @event core.ucp_register_register_after
 545                  * @var    array        user_row    Array with user registration data
 546                  * @var    array        cp_data        Array with custom profile fields data
 547                  * @var    array        data        Array with current ucp registration data
 548                  * @var    string        message        Message to be displayed to the user after registration
 549                  * @var    string        server_url    Server URL
 550                  * @var    int            user_id        New user ID
 551                  * @var    string        user_actkey    User activation key
 552                  * @since 3.2.4-RC1
 553                  */
 554                  $vars = array(
 555                      'user_row',
 556                      'cp_data',
 557                      'data',
 558                      'message',
 559                      'server_url',
 560                      'user_id',
 561                      'user_actkey',
 562                  );
 563                  extract($phpbb_dispatcher->trigger_event('core.ucp_register_register_after', compact($vars)));
 564  
 565                  $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
 566                  trigger_error($message);
 567              }
 568          }
 569  
 570          $s_hidden_fields = array_merge($s_hidden_fields, array(
 571              'agreed'        => 'true',
 572              'change_lang'    => 0,
 573          ));
 574  
 575          if ($config['coppa_enable'])
 576          {
 577              $s_hidden_fields['coppa'] = $coppa;
 578          }
 579  
 580          if ($config['enable_confirm'])
 581          {
 582              $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields());
 583          }
 584  
 585          // Visual Confirmation - Show images
 586          if ($config['enable_confirm'])
 587          {
 588              $template->assign_vars(array(
 589                  'CAPTCHA_TEMPLATE'        => $captcha->get_template(),
 590              ));
 591          }
 592  
 593          //
 594          $l_reg_cond = '';
 595          switch ($config['require_activation'])
 596          {
 597              case USER_ACTIVATION_SELF:
 598                  $l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE'];
 599              break;
 600  
 601              case USER_ACTIVATION_ADMIN:
 602                  $l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE'];
 603              break;
 604          }
 605  
 606          /* @var $provider_collection \phpbb\auth\provider_collection */
 607          $provider_collection = $phpbb_container->get('auth.provider_collection');
 608          $auth_provider = $provider_collection->get_provider();
 609  
 610          $auth_provider_data = $auth_provider->get_login_data();
 611          if ($auth_provider_data)
 612          {
 613              if (isset($auth_provider_data['VARS']))
 614              {
 615                  $template->assign_vars($auth_provider_data['VARS']);
 616              }
 617  
 618              if (isset($auth_provider_data['BLOCK_VAR_NAME']))
 619              {
 620                  foreach ($auth_provider_data['BLOCK_VARS'] as $block_vars)
 621                  {
 622                      $template->assign_block_vars($auth_provider_data['BLOCK_VAR_NAME'], $block_vars);
 623                  }
 624              }
 625  
 626              $template->assign_vars(array(
 627                  'PROVIDER_TEMPLATE_FILE' => $auth_provider_data['TEMPLATE_FILE'],
 628              ));
 629          }
 630  
 631          // Assign template vars for timezone select
 632          phpbb_timezone_select($template, $user, $data['tz'], true);
 633  
 634          $template_vars = array(
 635              'USERNAME'            => $data['username'],
 636              'PASSWORD'            => $data['new_password'],
 637              'PASSWORD_CONFIRM'    => $data['password_confirm'],
 638              'EMAIL'                => $data['email'],
 639  
 640              'L_REG_COND'                => $l_reg_cond,
 641              'L_USERNAME_EXPLAIN'        => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])),
 642              'L_PASSWORD_EXPLAIN'        => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars'])),
 643  
 644              'S_LANG_OPTIONS'    => language_select($data['lang']),
 645              'S_TZ_PRESELECT'    => !$submit,
 646              'S_CONFIRM_REFRESH'    => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false,
 647              'S_REGISTRATION'    => true,
 648              'S_COPPA'            => $coppa,
 649              'S_UCP_ACTION'        => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'),
 650  
 651              'COOKIE_NAME'        => $config['cookie_name'],
 652              'COOKIE_PATH'        => $config['cookie_path'],
 653          );
 654  
 655          $tpl_name = 'ucp_register';
 656  
 657          /**
 658          * Modify template data on the registration page
 659          *
 660          * @event core.ucp_register_modify_template_data
 661          * @var    array    template_vars        Array with template data
 662          * @var    array    data                Array with user data, read only
 663          * @var    array    error                Array with errors
 664          * @var    array    s_hidden_fields        Array with hidden field elements
 665          * @var    string    tpl_name            Template name
 666          * @since 3.2.2-RC1
 667          */
 668          $vars = array(
 669              'template_vars',
 670              'data',
 671              'error',
 672              's_hidden_fields',
 673              'tpl_name',
 674          );
 675          extract($phpbb_dispatcher->trigger_event('core.ucp_register_modify_template_data', compact($vars)));
 676  
 677          $template_vars = array_merge($template_vars, array(
 678              'ERROR'                => (count($error)) ? implode('<br />', $error) : '',
 679              'S_HIDDEN_FIELDS'    => build_hidden_fields($s_hidden_fields),
 680          ));
 681  
 682          $template->assign_vars($template_vars);
 683  
 684          //
 685          $user->profile_fields = array();
 686  
 687          // Generate profile fields -> Template Block Variable profile_fields
 688          $cp->generate_profile_fields('register', $user->get_iso_lang_id());
 689  
 690          //
 691          $this->tpl_name = $tpl_name;
 692      }
 693  
 694      /**
 695      * Creates the login_link data array
 696      *
 697      * @return    array    Returns an array of all POST paramaters whose names
 698      *                    begin with 'login_link_'
 699      */
 700  	protected function get_login_link_data_array()
 701      {
 702          global $request;
 703  
 704          $var_names = $request->variable_names(\phpbb\request\request_interface::POST);
 705          $login_link_data = array();
 706          $string_start_length = strlen('login_link_');
 707  
 708          foreach ($var_names as $var_name)
 709          {
 710              if (strpos($var_name, 'login_link_') === 0)
 711              {
 712                  $key_name = substr($var_name, $string_start_length);
 713                  $login_link_data[$key_name] = $request->variable($var_name, '', false, \phpbb\request\request_interface::POST);
 714              }
 715          }
 716  
 717          return $login_link_data;
 718      }
 719  
 720      /**
 721      * Prepends they key names of an associative array with 'login_link_' for
 722      * inclusion on the page as hidden fields.
 723      *
 724      * @param    array    $data    The array to be modified
 725      * @return    array    The modified array
 726      */
 727  	protected function get_login_link_data_for_hidden_fields($data)
 728      {
 729          $new_data = array();
 730  
 731          foreach ($data as $key => $value)
 732          {
 733              $new_data['login_link_' . $key] = $value;
 734          }
 735  
 736          return $new_data;
 737      }
 738  }


Generated: Tue Apr 7 19:44:41 2020 Cross-referenced by PHPXref 0.7.1