summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2009-11-19 01:59:50 -0800
committerZach Copley <zach@status.net>2009-11-19 01:59:50 -0800
commit3ec022307cedfe4b41a4d177b1749b617798bfb1 (patch)
treea840a46113ce9e721e38b7c6e34b6bf45c42e482 /actions
parent4d589e4c2d5c815fb798a6642f4d676b9fda8f7b (diff)
parent409ce3556d07f66e5a65e035f9d52b8421441911 (diff)
Merge branch 'admin-sections/3' into 0.9.x
* admin-sections/3: Added locales_path to site admin panel Site admin panel mostly done. Still need to add CC license chooser.
Diffstat (limited to 'actions')
-rw-r--r--actions/siteadminpanel.php92
1 files changed, 90 insertions, 2 deletions
diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php
index 965afb685..ce6d3f544 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', 'locale_path'),
'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,38 @@ 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."));
+ }
+
+ // Validate locales path
+
+ // XXX: What else do we need to validate for lacales path here? --Z
+
+ if (!empty($values['site']['locale_path']) && !is_readable($values['site']['locale_path'])) {
+ $this->clientError(sprintf(_("Locales directory not readable: %s"), $values['site']['locale_path']));
+ }
+
}
}
@@ -277,12 +311,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 +375,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');
}