X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fregister.php;h=dcbbbdb6a6de9afb238715b7ff1cac3d78f40b7d;hb=9f079764aa945e9e126ffa41cece17bc8951fb78;hp=4ac7c349d770abcb18ae4d72200ee3be07176e2d;hpb=0e6da4f1be4384155a38b2702e2ec39c96f5c359;p=quix0rs-gnu-social.git diff --git a/actions/register.php b/actions/register.php index 4ac7c349d7..dcbbbdb6a6 100644 --- a/actions/register.php +++ b/actions/register.php @@ -63,13 +63,14 @@ class RegisterAction extends Action * @return string title */ - function prepare() + function prepare($args) { + parent::prepare($args); $this->code = $this->trimmed('code'); if (empty($this->code)) { common_ensure_session(); - if (!empty($_SESSION['invitecode'])) { + if (array_key_exists('invitecode', $_SESSION)) { $this->code = $_SESSION['invitecode']; } } @@ -80,7 +81,7 @@ class RegisterAction extends Action } if (!empty($this->code)) { - $this->invite = Invitation::staticGet($code); + $this->invite = Invitation::staticGet('code', $this->code); if (empty($this->invite)) { $this->clientError(_('Sorry, invalid invitation code.')); return false; @@ -381,6 +382,19 @@ class RegisterAction extends Action function showFormContent() { + $code = $this->trimmed('code'); + + $invite = null; + + if ($code) { + $invite = Invitation::staticGet($code); + } + + if (common_config('site', 'inviteonly') && !($code && $invite)) { + $this->clientError(_('Sorry, only invited people can register.')); + return; + } + $this->elementStart('form', array('method' => 'post', 'id' => 'form_register', 'class' => 'form_settings',