From: Zach Copley Date: Thu, 19 Nov 2009 09:46:14 +0000 (-0800) Subject: Site admin panel mostly done. Still need to add CC license chooser. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=08165c8f037d9530995a9b312999fa6cc0f0cc97;p=quix0rs-gnu-social.git Site admin panel mostly done. Still need to add CC license chooser. --- diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index 965afb685c..b48be19a07 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'); }