diff options
author | Zach Copley <zach@status.net> | 2009-11-19 01:46:14 -0800 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2009-11-19 01:46:14 -0800 |
commit | 08165c8f037d9530995a9b312999fa6cc0f0cc97 (patch) | |
tree | 6c11cf6ec162a914430bed5d36771b3422dc1199 /actions | |
parent | 6165c9601d8f4def5a31f075fdab73eb4086c07b (diff) |
Site admin panel mostly done. Still need to add CC license chooser.
Diffstat (limited to 'actions')
-rw-r--r-- | actions/siteadminpanel.php | 84 |
1 files changed, 82 insertions, 2 deletions
diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index 965afb685..b48be19a0 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -91,10 +91,12 @@ class SiteadminpanelAction extends AdminPanelAction 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(); @@ -190,6 +192,30 @@ class SiteadminpanelAction extends AdminPanelAction $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.")); + } + } } @@ -277,12 +303,41 @@ class SiteAdminPanelForm extends AdminForm 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(); @@ -312,6 +367,31 @@ class SiteAdminPanelForm extends AdminForm $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'); } |