From: Evan Prodromou Date: Wed, 11 Nov 2009 06:43:34 +0000 (-0500) Subject: store boolean values correctly in siteadminpanel X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=220f8771c6570849e2ffd510b14ea4b6197e2366;p=quix0rs-gnu-social.git store boolean values correctly in siteadminpanel --- diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index 6dae12e08c..e4deea9620 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -91,8 +91,8 @@ class SiteadminpanelAction extends AdminPanelAction function saveSettings() { static $settings = array('name', 'broughtby', 'broughtbyurl', - 'email', 'timezone', 'language', - 'closed', 'inviteonly', 'private'); + 'email', 'timezone', 'language'); + static $booleans = array('closed', 'inviteonly', 'private'); $values = array(); @@ -100,6 +100,10 @@ class SiteadminpanelAction extends AdminPanelAction $values[$setting] = $this->trimmed($setting); } + foreach ($booleans as $setting) { + $values[$setting] = ($this->boolean($setting)) ? 1 : 0; + } + // This throws an exception on validation errors $this->validate($values); @@ -110,7 +114,7 @@ class SiteadminpanelAction extends AdminPanelAction $config->query('BEGIN'); - foreach ($settings as $setting) { + foreach (array_merge($settings, $booleans) as $setting) { Config::save('site', $setting, $values[$setting]); }