* Shows the user registration form.
*
* @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage form
/**
* @see \wcf\page\AbstractPage::$neededPermissions
*/
- public $neededPermissions = array();
+ public $neededPermissions = [];
/**
* holds a language variable with information about the registration process
* field names
* @var array
*/
- public $randomFieldNames = array();
+ public $randomFieldNames = [];
/**
* min number of seconds between form request and submit
if (isset($_POST[$this->randomFieldNames['password']])) $this->password = $_POST[$this->randomFieldNames['password']];
if (isset($_POST[$this->randomFieldNames['confirmPassword']])) $this->confirmPassword = $_POST[$this->randomFieldNames['confirmPassword']];
- $this->groupIDs = array();
+ $this->groupIDs = [];
if ($this->captchaObjectType) {
$this->captchaObjectType->getProcessor()->readFormParameters();
// validate registration time
if (!$this->isExternalAuthentication && (!WCF::getSession()->getVar('registrationStartTime') || (TIME_NOW - WCF::getSession()->getVar('registrationStartTime')) < self::$minRegistrationTime)) {
- throw new UserInputException('registrationStartTime', array());
+ throw new UserInputException('registrationStartTime', []);
}
}
if (WCF::getSession()->getVar('__username')) {
$this->username = WCF::getSession()->getVar('__username');
- WCF::getSession()->unregister('__username');
- }
+ WCF::getSession()->unregister('__username');
+ }
if (WCF::getSession()->getVar('__email')) {
$this->email = $this->confirmEmail = WCF::getSession()->getVar('__email');
WCF::getSession()->unregister('__email');
WCF::getSession()->register('registrationStartTime', TIME_NOW);
// generate random field names
- $this->randomFieldNames = array(
+ $this->randomFieldNames = [
'username' => UserRegistrationUtil::getRandomFieldName('username'),
'email' => UserRegistrationUtil::getRandomFieldName('email'),
'confirmEmail' => UserRegistrationUtil::getRandomFieldName('confirmEmail'),
'password' => UserRegistrationUtil::getRandomFieldName('password'),
'confirmPassword' => UserRegistrationUtil::getRandomFieldName('confirmPassword')
- );
+ ];
WCF::getSession()->register('registrationRandomFieldNames', $this->randomFieldNames);
}
public function assignVariables() {
parent::assignVariables();
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'captchaObjectType' => $this->captchaObjectType,
'isExternalAuthentication' => $this->isExternalAuthentication,
'randomFieldNames' => $this->randomFieldNames
- ));
+ ]);
}
/**
$activationCode = UserRegistrationUtil::getActivationCode();
$this->additionalFields['activationCode'] = $activationCode;
$addDefaultGroups = false;
- $this->groupIDs = UserGroup::getGroupIDsByType(array(UserGroup::EVERYONE, UserGroup::GUESTS));
+ $this->groupIDs = UserGroup::getGroupIDsByType([UserGroup::EVERYONE, UserGroup::GUESTS]);
}
// check gravatar support
}
// create user
- $data = array(
- 'data' => array_merge($this->additionalFields, array(
+ $data = [
+ 'data' => array_merge($this->additionalFields, [
'username' => $this->username,
'email' => $this->email,
'password' => $this->password,
- )),
+ ]),
'groups' => $this->groupIDs,
'languageIDs' => $this->visibleLanguages,
'options' => $saveOptions,
'addDefaultGroups' => $addDefaultGroups
- );
- $this->objectAction = new UserAction(array(), 'create', $data);
+ ];
+ $this->objectAction = new UserAction([], 'create', $data);
$result = $this->objectAction->executeAction();
$user = $result['returnValues'];
$userEditor = new UserEditor($user);
// set avatar if provided
if (!empty($avatarURL)) {
- $userAvatarAction = new UserAvatarAction(array(), 'fetchRemoteAvatar', array(
+ $userAvatarAction = new UserAvatarAction([], 'fetchRemoteAvatar', [
'url' => $avatarURL,
'userEditor' => $userEditor
- ));
+ ]);
$userAvatarAction->executeAction();
}
$this->message = 'wcf.user.register.success';
}
else {
- $mail = new Mail(array($this->username => $this->email),
+ $mail = new Mail([$this->username => $this->email],
WCF::getLanguage()->getDynamicVariable('wcf.user.register.needActivation.mail.subject'),
- WCF::getLanguage()->getDynamicVariable('wcf.user.register.needActivation.mail', array('user' => $user))
+ WCF::getLanguage()->getDynamicVariable('wcf.user.register.needActivation.mail', ['user' => $user])
);
$mail->send();
$this->message = 'wcf.user.register.needActivation';
// send mail
$mail = new Mail(MAIL_ADMIN_ADDRESS,
$language->getDynamicVariable('wcf.user.register.notification.mail.subject'),
- $language->getDynamicVariable('wcf.user.register.notification.mail', array('user' => $user))
+ $language->getDynamicVariable('wcf.user.register.notification.mail', ['user' => $user])
);
$mail->setLanguage($language);
$mail->send();
$this->saved();
// forward to index page
- HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink(), WCF::getLanguage()->getDynamicVariable($this->message, array('user' => $user)), 15);
+ HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink(), WCF::getLanguage()->getDynamicVariable($this->message, ['user' => $user]), 15);
exit;
}
}