forked from GNUsocial/gnu-social
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.
This commit is contained in:
commit
3ec022307c
@ -91,10 +91,12 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||||||
function saveSettings()
|
function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array('site' => array('name', 'broughtby', 'broughtbyurl',
|
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'));
|
'snapshot' => array('run', 'reporturl', 'frequency'));
|
||||||
|
|
||||||
static $booleans = array('site' => array('private'));
|
static $booleans = array('site' => array('private', 'inviteonly', 'closed', 'fancy'));
|
||||||
|
|
||||||
$values = array();
|
$values = array();
|
||||||
|
|
||||||
@ -190,6 +192,38 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||||||
$this->clientError(_("Snapshot frequency must be a number."));
|
$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'));
|
false, $this->value('language'));
|
||||||
|
|
||||||
$this->unli();
|
$this->unli();
|
||||||
$this->li();
|
|
||||||
|
|
||||||
|
$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'),
|
$this->out->checkbox('private', _('Private'),
|
||||||
(bool) $this->value('private'),
|
(bool) $this->value('private'),
|
||||||
_('Prohibit anonymous users (not logged in) from viewing site?'));
|
_('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->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
@ -312,6 +375,31 @@ class SiteAdminPanelForm extends AdminForm
|
|||||||
|
|
||||||
$this->unli();
|
$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');
|
$this->out->elementEnd('ul');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user