Move ssl settings from site admin panel to paths admin panel
This commit is contained in:
parent
7160e11395
commit
7f9b07d8c9
@ -92,7 +92,7 @@ class PathsadminpanelAction extends AdminPanelAction
|
|||||||
function saveSettings()
|
function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array(
|
static $settings = array(
|
||||||
'site' => array('path', 'locale_path'),
|
'site' => array('path', 'locale_path', 'ssl', 'sslserver'),
|
||||||
'theme' => array('server', 'dir', 'path'),
|
'theme' => array('server', 'dir', 'path'),
|
||||||
'avatar' => array('server', 'dir', 'path'),
|
'avatar' => array('server', 'dir', 'path'),
|
||||||
'background' => array('server', 'dir', 'path')
|
'background' => array('server', 'dir', 'path')
|
||||||
@ -160,6 +160,14 @@ class PathsadminpanelAction extends AdminPanelAction
|
|||||||
$this->clientError(sprintf(_("Locales directory not readable: %s"), $values['site']['locale_path']));
|
$this->clientError(sprintf(_("Locales directory not readable: %s"), $values['site']['locale_path']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate SSL setup
|
||||||
|
|
||||||
|
if (in_array($values['site']['ssl'], array('sometimes', 'always'))) {
|
||||||
|
if (empty($values['site']['sslserver'])) {
|
||||||
|
$this->clientError(_("You must set an SSL server when enabling SSL."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -283,6 +291,29 @@ class PathsAdminPanelForm extends AdminForm
|
|||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
$this->out->elementEnd('fieldset');
|
$this->out->elementEnd('fieldset');
|
||||||
|
|
||||||
|
$this->out->elementStart('fieldset', array('id' => 'settings_admin_ssl'));
|
||||||
|
$this->out->element('legend', null, _('SSL'));
|
||||||
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
$this->li();
|
||||||
|
$ssl = array('never' => _('Never'),
|
||||||
|
'sometimes' => _('Sometimes'),
|
||||||
|
'always' => _('Always'));
|
||||||
|
|
||||||
|
common_debug("site ssl = " . $this->value('site', 'ssl'));
|
||||||
|
|
||||||
|
$this->out->dropdown('site-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'), 'site');
|
||||||
|
$this->unli();
|
||||||
|
$this->out->elementEnd('ul');
|
||||||
|
$this->out->elementEnd('fieldset');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -297,7 +328,6 @@ class PathsAdminPanelForm extends AdminForm
|
|||||||
'save', _('Save paths'));
|
'save', _('Save paths'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility to simplify some of the duplicated code around
|
* Utility to simplify some of the duplicated code around
|
||||||
* params and settings. Overriding the input() in the base class
|
* params and settings. Overriding the input() in the base class
|
||||||
|
@ -92,8 +92,7 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||||||
{
|
{
|
||||||
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',
|
'site', 'textlimit', 'dupelimit'),
|
||||||
'textlimit', 'dupelimit'),
|
|
||||||
'snapshot' => array('run', 'reporturl', 'frequency'));
|
'snapshot' => array('run', 'reporturl', 'frequency'));
|
||||||
|
|
||||||
static $booleans = array('site' => array('private', 'inviteonly', 'closed', 'fancy'));
|
static $booleans = array('site' => array('private', 'inviteonly', 'closed', 'fancy'));
|
||||||
@ -192,14 +191,6 @@ 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 server when enabling SSL."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mb_strlen($values['site']['sslserver']) > 255) {
|
if (mb_strlen($values['site']['sslserver']) > 255) {
|
||||||
$this->clientError(_("Invalid SSL server. The maximum length is 255 characters."));
|
$this->clientError(_("Invalid SSL server. The maximum length is 255 characters."));
|
||||||
}
|
}
|
||||||
@ -376,26 +367,6 @@ class SiteAdminPanelForm extends AdminForm
|
|||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
$this->out->elementEnd('fieldset');
|
$this->out->elementEnd('fieldset');
|
||||||
|
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_ssl'));
|
|
||||||
$this->out->element('legend', null, _('SSL'));
|
|
||||||
$this->out->elementStart('ul', 'form_data');
|
|
||||||
$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->out->elementEnd('ul');
|
|
||||||
$this->out->elementEnd('fieldset');
|
|
||||||
|
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_limits'));
|
$this->out->elementStart('fieldset', array('id' => 'settings_admin_limits'));
|
||||||
$this->out->element('legend', null, _('Limits'));
|
$this->out->element('legend', null, _('Limits'));
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
Loading…
Reference in New Issue
Block a user