parent::prepare($args);
$this->code = $this->trimmed('code');
+ // @todo this check should really be in index.php for all sensitive actions
+ $ssl = common_config('site', 'ssl');
+ if (empty($_SERVER['HTTPS']) && ($ssl == 'always' || $ssl == 'sometimes')) {
+ common_redirect(common_local_url('register'));
+ // exit
+ }
+
if (empty($this->code)) {
common_ensure_session();
if (array_key_exists('invitecode', $_SESSION)) {
}
if (common_config('site', 'inviteonly') && empty($this->code)) {
- $this->clientError(_('Sorry. Only those invited can register.'));
+ $this->clientError(_('Sorry, only invited people can register.'));
return false;
}
if (!empty($this->code)) {
$this->invite = Invitation::staticGet('code', $this->code);
if (empty($this->invite)) {
- $this->clientError(_('Sorry. This is an invalid invitation code.'));
+ $this->clientError(_('Sorry, invalid invitation code.'));
return false;
}
// Store this in case we need it
$bio = $this->trimmed('bio');
$location = $this->trimmed('location');
- // We do not trim these... whitespace is OK in a password!
+ // We don't trim these... whitespace is OK in a password!
$password = $this->arg('password');
$confirm = $this->arg('confirm');
}
if (common_config('site', 'inviteonly') && !($code && $invite)) {
- $this->clientError(_('Sorry. Only those invited can register.'));
+ $this->clientError(_('Sorry, only invited people can register.'));
return;
}
$this->showForm(_('Homepage is not a valid URL.'));
return;
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
- $this->showForm(_('Full name is too long (max 255 chars).'));
+ $this->showForm(_('Full name is too long (maximum 255 characters).'));
return;
} else if (Profile::bioTooLong($bio)) {
- $this->showForm(sprintf(_('Bio is too long (max %d chars).'),
+ $this->showForm(sprintf(_m('Bio is too long (maximum %d character).',
+ 'Bio is too long (maximum %d characters).',
+ Profile::maxBio()),
Profile::maxBio()));
return;
} else if (!is_null($location) && mb_strlen($location) > 255) {
- $this->showForm(_('Location is too long (max 255 chars).'));
+ $this->showForm(_('Location is too long (maximum 255 characters).'));
return;
} else if (strlen($password) < 6) {
$this->showForm(_('Password must be 6 or more characters.'));
// Re-init language env in case it changed (not yet, but soon)
common_init_language();
+
$this->showSuccess();
} else {
$this->showForm(_('Invalid username or password.'));
function nicknameExists($nickname)
{
$user = User::staticGet('nickname', $nickname);
- return ($user !== false);
+ return is_object($user);
}
/**
return false;
}
$user = User::staticGet('email', $email);
- return ($user !== false);
+ return is_object($user);
}
// overrrided to add entry-title class
} else {
$instr =
common_markup_to_html(_('With this form you can create '.
- ' a new account. ' .
+ 'a new account. ' .
'You can then post notices and '.
'link up to friends and colleagues. '));
}
if (common_config('site', 'inviteonly') && !($code && $invite)) {
- $this->clientError(_('Sorry. Only those invited can register.'));
+ $this->clientError(_('Sorry, only invited people can register.'));
return;
}
$this->elementStart('li');
$maxBio = Profile::maxBio();
if ($maxBio > 0) {
- $bioInstr = sprintf(_('Describe yourself and your interests in %d chars'),
+ // TRANS: Tooltip for field label in form for profile settings. Plural
+ // TRANS: is decided by the number of characters available for the
+ // TRANS: biography (%d).
+ $bioInstr = sprintf(_m('Describe yourself and your interests in %d character',
+ 'Describe yourself and your interests in %d characters',
+ $maxBio),
$maxBio);
} else {
$bioInstr = _('Describe yourself and your interests');
$this->elementStart('li');
$this->element('input', $attrs);
$this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
- $this->text(_('My text and files are available under '));
- $this->element('a', array('href' => common_config('license', 'url')),
- common_config('license', 'title'), _("Creative Commons Attribution 3.0"));
- $this->text(_(' except this private data: password, '.
- 'email address, IM address, and phone number.'));
+ $this->raw($this->licenseCheckbox());
$this->elementEnd('label');
$this->elementEnd('li');
}
$this->elementEnd('form');
}
+ function licenseCheckbox()
+ {
+ $out = '';
+ switch (common_config('license', 'type')) {
+ case 'private':
+ // TRANS: Copyright checkbox label in registration dialog, for private sites.
+ $out .= htmlspecialchars(sprintf(
+ _('I understand that content and data of %1$s are private and confidential.'),
+ common_config('site', 'name')));
+ // fall through
+ case 'allrightsreserved':
+ if ($out != '') {
+ $out .= ' ';
+ }
+ if (common_config('license', 'owner')) {
+ // TRANS: Copyright checkbox label in registration dialog, for all rights reserved with a specified copyright owner.
+ $out .= htmlspecialchars(sprintf(
+ _('My text and files are copyright by %1$s.'),
+ common_config('license', 'owner')));
+ } else {
+ // TRANS: Copyright checkbox label in registration dialog, for all rights reserved with ownership left to contributors.
+ $out .= htmlspecialchars(_('My text and files remain under my own copyright.'));
+ }
+ // TRANS: Copyright checkbox label in registration dialog, for all rights reserved.
+ $out .= ' ' . _('All rights reserved.');
+ break;
+ case 'cc': // fall through
+ default:
+ // TRANS: Copyright checkbox label in registration dialog, for Creative Commons-style licenses.
+ $message = _('My text and files are available under %s ' .
+ 'except this private data: password, ' .
+ 'email address, IM address, and phone number.');
+ $link = '<a href="' .
+ htmlspecialchars(common_config('license', 'url')) .
+ '">' .
+ htmlspecialchars(common_config('license', 'title')) .
+ '</a>';
+ $out .= sprintf(htmlspecialchars($message), $link);
+ }
+ return $out;
+ }
+
/**
* Show some information about registering for the site
*
array('nickname' => $nickname));
$this->elementStart('div', 'success');
- $instr = sprintf(_('Congratulations, %s! And welcome to %%%%site.name%%%%. '.
+ $instr = sprintf(_('Congratulations, %1$s! And welcome to %%%%site.name%%%%. '.
'From here, you may want to...'. "\n\n" .
- '* Go to [your profile](%s) '.
+ '* Go to [your profile](%2$s) '.
'and post your first message.' . "\n" .
'* Add a [Jabber/GTalk address]'.
'(%%%%action.imsettings%%%%) '.
'so you can send notices '.
'through instant messages.' . "\n" .
- '* [Search for users](%%%%action.peoplesearch%%%%) '.
+ '* [Search for people](%%%%action.peoplesearch%%%%) '.
'that you may know or '.
'that share your interests. ' . "\n" .
'* Update your [profile settings]'.