X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fpathsadminpanel.php;h=0c83aa29ecec5a537dd72ee5280df13d1792d8ba;hb=1652ded48c9c62c40157a5142e5231adbc574ddb;hp=3779fcfaaaeb94c90bd4dc47c4d47be23386524f;hpb=02a6006bafd663443b512c5c283b64c7dacfbbb1;p=quix0rs-gnu-social.git diff --git a/actions/pathsadminpanel.php b/actions/pathsadminpanel.php index 3779fcfaaa..0c83aa29ec 100644 --- a/actions/pathsadminpanel.php +++ b/actions/pathsadminpanel.php @@ -24,7 +24,7 @@ * @author Evan Prodromou * @author Zach Copley * @author Sarven Capadisli - * @copyright 2008-2009 StatusNet, Inc. + * @copyright 2008-2010 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -67,7 +67,7 @@ class PathsadminpanelAction extends AdminPanelAction function getInstructions() { - return _('Path and server settings for this StatusNet site.'); + return _('Path and server settings for this StatusNet site'); } /** @@ -98,6 +98,11 @@ class PathsadminpanelAction extends AdminPanelAction 'background' => array('server', 'dir', 'path') ); + // XXX: If we're only going to have one boolean on thi page we + // can remove some of the boolean processing code --Z + + static $booleans = array('site' => array('fancy')); + $values = array(); foreach ($settings as $section => $parts) { @@ -106,6 +111,12 @@ class PathsadminpanelAction extends AdminPanelAction } } + foreach ($booleans as $section => $parts) { + foreach ($parts as $setting) { + $values[$section][$setting] = ($this->boolean($setting)) ? 1 : 0; + } + } + $this->validate($values); // assert(all values are valid); @@ -120,7 +131,13 @@ class PathsadminpanelAction extends AdminPanelAction } } - $config->query('COMMIT'); + foreach ($booleans as $section => $parts) { + foreach ($parts as $setting) { + Config::save($section, $setting, $values[$section][$setting]); + } + } + + $config->query('COMMIT'); return; } @@ -137,19 +154,19 @@ class PathsadminpanelAction extends AdminPanelAction // Validate theme dir if (!empty($values['theme']['dir']) && !is_readable($values['theme']['dir'])) { - $this->clientError(sprintf(_("Theme directory not readable: %s"), $values['theme']['dir'])); + $this->clientError(sprintf(_("Theme directory not readable: %s."), $values['theme']['dir'])); } // Validate avatar dir if (empty($values['avatar']['dir']) || !is_writable($values['avatar']['dir'])) { - $this->clientError(sprintf(_("Avatar directory not writable: %s"), $values['avatar']['dir'])); + $this->clientError(sprintf(_("Avatar directory not writable: %s."), $values['avatar']['dir'])); } // Validate background dir if (empty($values['background']['dir']) || !is_writable($values['background']['dir'])) { - $this->clientError(sprintf(_("Background directory not writable: %s"), $values['background']['dir'])); + $this->clientError(sprintf(_("Background directory not writable: %s."), $values['background']['dir'])); } // Validate locales dir @@ -157,13 +174,13 @@ class PathsadminpanelAction extends AdminPanelAction // 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'])); + $this->clientError(sprintf(_("Locales directory not readable: %s."), $values['site']['locale_path'])); } // Validate SSL setup 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.')); } } @@ -213,10 +230,14 @@ class PathsAdminPanelForm extends AdminForm function formData() { - $this->out->elementStart('fieldset', array('id' => 'settings_paths_locale')); + $this->out->elementStart('fieldset', array('id' => 'settings_paths_locale')); $this->out->element('legend', null, _('Site'), 'site'); $this->out->elementStart('ul', 'form_data'); + $this->li(); + $this->input('server', _('Server'), _('Site\'s server hostname.')); + $this->unli(); + $this->li(); $this->input('path', _('Path'), _('Site path')); $this->unli(); @@ -225,6 +246,12 @@ class PathsAdminPanelForm extends AdminForm $this->input('locale_path', _('Path to locales'), _('Directory path to locales'), 'site'); $this->unli(); + $this->li(); + $this->out->checkbox('fancy', _('Fancy URLs'), + (bool) $this->value('fancy'), + _('Use fancy (more readable and memorable) URLs?')); + $this->unli(); + $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset');