function saveSettings()
{
static $settings = array('site' => array('name', 'broughtby', 'broughtbyurl',
- 'email', 'timezone', 'language'),
+ 'email', 'timezone', 'language',
+ 'ssl', 'sslserver', 'site', 'path',
+ 'textlimit', 'dupelimit'),
'snapshot' => array('run', 'reporturl', 'frequency'));
- static $booleans = array('site' => array('private'));
+ static $booleans = array('site' => array('private', 'inviteonly', 'closed', 'fancy'));
$values = array();
$this->clientError(_("Snapshot frequency must be a number."));
}
+ // Validate SSL setup
+
+ if (in_array($values['site']['ssl'], array('sometimes', 'always'))) {
+ if (empty($values['site']['sslserver'])) {
+ $this->clientError(_("You must set an SSL sever when enabling SSL."));
+ }
+ }
+
+ if (mb_strlen($values['site']['sslserver']) > 255) {
+ $this->clientError(_("Invalid SSL server. Max length is 255 characters."));
+ }
+
+ // Validate text limit
+
+ if (!Validate::number($values['site']['textlimit'], array('min' => 140))) {
+ $this->clientError(_("Minimum text limit is 140c."));
+ }
+
+ // Validate dupe limit
+
+ if (!Validate::number($values['site']['dupelimit'], array('min' => 1))) {
+ $this->clientError(_("Dupe limit must 1 or more seconds."));
+ }
+
}
}
false, $this->value('language'));
$this->unli();
+
+ $this->li();
+ $this->input('locale_path', _('Path to locales'), _('Directory path to locales'));
+ $this->unli();
+
+ $this->li();
+ $this->input('server', _('Server'), _('Site\'s server hostname.'));
+ $this->unli();
+
+ $this->li();
+ $this->input('path', _('Path'), _('Site path'));
+ $this->unli();
+
$this->li();
+ $this->out->checkbox('fancy', _('Fancy URLs'),
+ (bool) $this->value('fancy'),
+ _('Use fancy (more readable and memorable) URLs?'));
+ $this->unli();
+ $this->li();
$this->out->checkbox('private', _('Private'),
(bool) $this->value('private'),
_('Prohibit anonymous users (not logged in) from viewing site?'));
+ $this->unli();
+ $this->li();
+ $this->out->checkbox('inviteonly', _('Invite only'),
+ (bool) $this->value('inviteonly'),
+ _('Make registration invitation only.'));
+ $this->unli();
+
+ $this->li();
+ $this->out->checkbox('closed', _('Closed'),
+ (bool) $this->value('closed'),
+ _('Disable new registrations.'));
$this->unli();
$this->li();
$this->unli();
+ $this->li();
+
+ $ssl = array('never' => _('Never'),
+ 'sometimes' => _('Sometimes'),
+ 'always' => _('Always'));
+
+ $this->out->dropdown('ssl', _('Use SSL'),
+ $ssl, _('When to use SSL'),
+ false, $this->value('ssl', 'site'));
+
+ $this->unli();
+
+ $this->li();
+ $this->input('sslserver', _('SSL Server'),
+ _('Server to direct SSL requests to'));
+ $this->unli();
+
+ $this->li();
+ $this->input('textlimit', _('Text limit'), _('Maximum number of characters for notices.'));
+ $this->unli();
+
+ $this->li();
+ $this->input('dupelimit', _('Dupe limit'), _('How long users must wait (in seconds) to post the same thing again.'));
+ $this->unli();
+
$this->out->elementEnd('ul');
}