From d0466da80bfd50df4bbfe470e4bb6eed6e73b3e8 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 7 Nov 2009 23:17:52 -0500 Subject: add site admin panel --- actions/siteadminpanel.php | 166 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 actions/siteadminpanel.php (limited to 'actions/siteadminpanel.php') diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php new file mode 100644 index 000000000..8a1545838 --- /dev/null +++ b/actions/siteadminpanel.php @@ -0,0 +1,166 @@ +. + * + * @category Settings + * @package StatusNet + * @author Evan Prodromou + * @author Zach Copley + * @author Sarven Capadisli + * @copyright 2008-2009 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/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Administer site settings + * + * @category Admin + * @package StatusNet + * @author Evan Prodromou + * @author Zach Copley + * @author Sarven Capadisli + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class SiteadminpanelAction extends AdminPanelAction +{ + /** + * Returns the page title + * + * @return string page title + */ + + function title() + { + return _('Site'); + } + + /** + * Instructions for using this form. + * + * @return string instructions + */ + + function getInstructions() + { + return _('Basic settings for this StatusNet site.'); + } + + /** + * Show the site admin panel form + * + * @return void + */ + + function showForm() + { + $form = new SiteAdminPanelForm($this); + $form->show(); + return; + } + + /** + * Save settings from the form + * + * @return void + */ + + function saveSettings() + { + $name = $this->trimmed('name'); + + $config = new Config(); + + $config->query('BEGIN'); + + Config::save('site', 'name', $name); + + $config->query('COMMIT'); + + return; + } +} + +class SiteAdminPanelForm extends Form +{ + /** + * ID of the form + * + * @return int ID of the form + */ + + function id() + { + return 'siteadminpanel'; + } + + /** + * class of the form + * + * @return string class of the form + */ + + function formClass() + { + return 'form_site_admin_panel'; + } + + /** + * Action of the form + * + * @return string URL of the action + */ + + function action() + { + return common_local_url('siteadminpanel'); + } + + /** + * Data elements of the form + * + * @return void + */ + + function formData() + { + $this->out->input('name', _('Site name'), + ($this->out->arg('name')) ? $this->out->arg('name') : + common_config('site', 'name'), + _('The name of your site, like "Yourcompany Microblog"')); + } + + /** + * Action elements + * + * @return void + */ + + function formActions() + { + $this->out->submit('submit', _('Save'), 'submit', null, _('Save site settings')); + } +} -- cgit v1.2.3-54-g00ecf From 2f770cecf9c44d465b2f88cb3ab9ed11e5626501 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 8 Nov 2009 15:48:05 -0500 Subject: add some more fields to site admin panel --- actions/siteadminpanel.php | 70 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 6 deletions(-) (limited to 'actions/siteadminpanel.php') diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index 8a1545838..2c7382e43 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -90,18 +90,52 @@ class SiteadminpanelAction extends AdminPanelAction function saveSettings() { - $name = $this->trimmed('name'); + static $settings = array('name', 'broughtby', 'broughtbyurl', 'email'); + + $values = array(); + + foreach ($settings as $setting) { + $values[$setting] = $this->trimmed($setting); + } + + // This throws an exception on validation errors + + $this->validate($values); + + // assert(all values are valid); $config = new Config(); $config->query('BEGIN'); - Config::save('site', 'name', $name); + foreach ($settings as $setting) { + Config::save('site', $setting, $values['setting']); + } $config->query('COMMIT'); return; } + + function validate(&$values) + { + // Validate site name + + if (empty($values['name'])) { + $this->clientError(_("Site name must have non-zero length.")); + } + + // Validate email + + $values['email'] = common_canonical_email($values['email']); + + if (empty($values['email'])) { + $this->clientError(_('You must have a valid contact email address')); + } + if (!Validate::email($values['email'], common_config('email', 'check_domain'))) { + $this->clientError(_('Not a valid email address')); + } + } } class SiteAdminPanelForm extends Form @@ -147,10 +181,34 @@ class SiteAdminPanelForm extends Form function formData() { - $this->out->input('name', _('Site name'), - ($this->out->arg('name')) ? $this->out->arg('name') : - common_config('site', 'name'), - _('The name of your site, like "Yourcompany Microblog"')); + $this->input('name', _('Site name'), + _('The name of your site, like "Yourcompany Microblog"')); + $this->input('broughtby', _('Brought by'), + _('Text used for credits link in footer of each page')); + $this->input('broughtbyurl', _('Brought by URL'), + _('URL used for credits link in footer of each page')); + $this->input('email', _('Email'), + _('contact email address for your site')); + } + + /** + * Utility to simplify some of the duplicated code around + * params and settings. + * + * @param string $setting Name of the setting + * @param string $title Title to use for the input + * @param string $instructions Instructions for this field + * + * @return void + */ + + function input($setting, $title, $instructions) + { + $value = $this->out->trimmed($setting); + if (empty($value)) { + $value = common_config('site', $setting); + } + $this->out->input($setting, $title, $value, $instructions); } /** -- cgit v1.2.3-54-g00ecf From 7ee9737ef67fded89fb51602b06c8f77fba97bb1 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 8 Nov 2009 16:27:19 -0500 Subject: incorrectly saving wrong values in siteadminpanel --- actions/siteadminpanel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actions/siteadminpanel.php') diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index 2c7382e43..460567c22 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -109,7 +109,7 @@ class SiteadminpanelAction extends AdminPanelAction $config->query('BEGIN'); foreach ($settings as $setting) { - Config::save('site', $setting, $values['setting']); + Config::save('site', $setting, $values[$setting]); } $config->query('COMMIT'); -- cgit v1.2.3-54-g00ecf From 977d5d6f8569437a8d8a7f9616f4de6afc0dc509 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 8 Nov 2009 22:03:34 -0500 Subject: add default timezone to site admin panel --- actions/siteadminpanel.php | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'actions/siteadminpanel.php') diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index 460567c22..f66aa855c 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -90,7 +90,7 @@ class SiteadminpanelAction extends AdminPanelAction function saveSettings() { - static $settings = array('name', 'broughtby', 'broughtbyurl', 'email'); + static $settings = array('name', 'broughtby', 'broughtbyurl', 'email', 'timezone'); $values = array(); @@ -135,6 +135,14 @@ class SiteadminpanelAction extends AdminPanelAction if (!Validate::email($values['email'], common_config('email', 'check_domain'))) { $this->clientError(_('Not a valid email address')); } + + // Validate timezone + + if (is_null($values['timezone']) || + !in_array($values['timezone'], DateTimeZone::listIdentifiers())) { + $this->clientError(_('Timezone not selected.')); + return; + } } } @@ -189,6 +197,18 @@ class SiteAdminPanelForm extends Form _('URL used for credits link in footer of each page')); $this->input('email', _('Email'), _('contact email address for your site')); + + $timezones = array(); + + foreach (DateTimeZone::listIdentifiers() as $k => $v) { + $timezones[$v] = $v; + } + + asort($timezones); + + $this->out->dropdown('timezone', _('Default timezone'), + $timezones, _('Default timezone for the site; usually UTC.'), + true, $this->value('timezone')); } /** @@ -203,12 +223,25 @@ class SiteAdminPanelForm extends Form */ function input($setting, $title, $instructions) + { + $this->out->input($setting, $title, $this->value($setting), $instructions); + } + + /** + * Utility to simplify getting the posted-or-stored setting value + * + * @param string $setting Name of the setting + * + * @return string param value if posted, or current config value + */ + + function value($setting) { $value = $this->out->trimmed($setting); if (empty($value)) { $value = common_config('site', $setting); } - $this->out->input($setting, $title, $value, $instructions); + return $value; } /** -- cgit v1.2.3-54-g00ecf From 33f931d5277e0d72f5c9082d176a1a574f033e87 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 8 Nov 2009 22:12:12 -0500 Subject: add default language to site admin panel --- actions/siteadminpanel.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'actions/siteadminpanel.php') diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index f66aa855c..2da26e4bd 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -90,7 +90,8 @@ class SiteadminpanelAction extends AdminPanelAction function saveSettings() { - static $settings = array('name', 'broughtby', 'broughtbyurl', 'email', 'timezone'); + static $settings = array('name', 'broughtby', 'broughtbyurl', + 'email', 'timezone', 'language'); $values = array(); @@ -143,6 +144,12 @@ class SiteadminpanelAction extends AdminPanelAction $this->clientError(_('Timezone not selected.')); return; } + + // Validate language + + if (!is_null($language) && !in_array($language, array_keys(get_nice_language_list()))) { + $this->clientError(sprintf(_('Unknown language "%s"'), $language)); + } } } @@ -209,6 +216,10 @@ class SiteAdminPanelForm extends Form $this->out->dropdown('timezone', _('Default timezone'), $timezones, _('Default timezone for the site; usually UTC.'), true, $this->value('timezone')); + + $this->out->dropdown('language', _('Language'), + get_nice_language_list(), _('Default site language'), + false, $this->value('language')); } /** -- cgit v1.2.3-54-g00ecf From badd8ccccadb4eb3697c8d68619e4ec931b947c5 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 8 Nov 2009 22:21:28 -0500 Subject: add registration restrictions and privacy to site admin panel --- actions/siteadminpanel.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'actions/siteadminpanel.php') diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index 2da26e4bd..358c0b15f 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -91,7 +91,8 @@ class SiteadminpanelAction extends AdminPanelAction function saveSettings() { static $settings = array('name', 'broughtby', 'broughtbyurl', - 'email', 'timezone', 'language'); + 'email', 'timezone', 'language', + 'closed', 'inviteonly', 'private'); $values = array(); @@ -220,6 +221,18 @@ class SiteAdminPanelForm extends Form $this->out->dropdown('language', _('Language'), get_nice_language_list(), _('Default site language'), false, $this->value('language')); + + $this->out->checkbox('closed', _('Closed'), + (bool) $this->value('closed'), + _('Is registration on this site prohibited?')); + + $this->out->checkbox('inviteonly', _('Invite-only'), + (bool) $this->value('inviteonly'), + _('Is registration on this site only open to invited users?')); + + $this->out->checkbox('private', _('Private'), + (bool) $this->value('private'), + _('Prohibit anonymous users (not logged in) from viewing site?')); } /** -- cgit v1.2.3-54-g00ecf From b2145a6e4c739578e03d3d1fda6b415f2a830462 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 11 Nov 2009 01:00:41 -0500 Subject: use
  • s in form data for site admin panel --- actions/siteadminpanel.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'actions/siteadminpanel.php') diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index 358c0b15f..6dae12e08 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -197,15 +197,25 @@ class SiteAdminPanelForm extends Form function formData() { + $this->out->elementStart('ul', 'form_data'); + $this->li(); $this->input('name', _('Site name'), _('The name of your site, like "Yourcompany Microblog"')); + $this->unli(); + $this->li(); $this->input('broughtby', _('Brought by'), _('Text used for credits link in footer of each page')); + $this->unli(); + $this->li(); $this->input('broughtbyurl', _('Brought by URL'), _('URL used for credits link in footer of each page')); + $this->unli(); + $this->li(); $this->input('email', _('Email'), _('contact email address for your site')); + $this->unli(); + $timezones = array(); foreach (DateTimeZone::listIdentifiers() as $k => $v) { @@ -214,25 +224,43 @@ class SiteAdminPanelForm extends Form asort($timezones); + $this->li(); + $this->out->dropdown('timezone', _('Default timezone'), $timezones, _('Default timezone for the site; usually UTC.'), true, $this->value('timezone')); + $this->unli(); + $this->li(); + $this->out->dropdown('language', _('Language'), get_nice_language_list(), _('Default site language'), false, $this->value('language')); + $this->unli(); + $this->li(); + $this->out->checkbox('closed', _('Closed'), (bool) $this->value('closed'), _('Is registration on this site prohibited?')); + $this->unli(); + $this->li(); + $this->out->checkbox('inviteonly', _('Invite-only'), (bool) $this->value('inviteonly'), _('Is registration on this site only open to invited users?')); + $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->out->elementEnd('ul'); } /** @@ -268,6 +296,16 @@ class SiteAdminPanelForm extends Form return $value; } + function li() + { + $this->out->elementStart('li'); + } + + function unli() + { + $this->out->elementEnd('li'); + } + /** * Action elements * -- cgit v1.2.3-54-g00ecf From 220f8771c6570849e2ffd510b14ea4b6197e2366 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 11 Nov 2009 01:43:34 -0500 Subject: store boolean values correctly in siteadminpanel --- actions/siteadminpanel.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'actions/siteadminpanel.php') diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index 6dae12e08..e4deea962 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]); } -- cgit v1.2.3-54-g00ecf From 9a1a83e8ebe5ad39838e6363f1537a1a5232b9cb Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 15 Nov 2009 14:37:47 +0100 Subject: Move some user-related stuff to useradminpanel from siteadminpanel --- actions/siteadminpanel.php | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'actions/siteadminpanel.php') diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index e4deea962..1cf70362d 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -92,7 +92,6 @@ class SiteadminpanelAction extends AdminPanelAction { static $settings = array('name', 'broughtby', 'broughtbyurl', 'email', 'timezone', 'language'); - static $booleans = array('closed', 'inviteonly', 'private'); $values = array(); @@ -244,20 +243,6 @@ class SiteAdminPanelForm extends Form $this->unli(); $this->li(); - $this->out->checkbox('closed', _('Closed'), - (bool) $this->value('closed'), - _('Is registration on this site prohibited?')); - - $this->unli(); - $this->li(); - - $this->out->checkbox('inviteonly', _('Invite-only'), - (bool) $this->value('inviteonly'), - _('Is registration on this site only open to invited users?')); - - $this->unli(); - $this->li(); - $this->out->checkbox('private', _('Private'), (bool) $this->value('private'), _('Prohibit anonymous users (not logged in) from viewing site?')); -- cgit v1.2.3-54-g00ecf From 42d6c696916d545047339c77d36df2192555662b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 17 Nov 2009 10:59:50 -0500 Subject: add private flag back into site admin panel --- actions/siteadminpanel.php | 1 + panels.txt | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'actions/siteadminpanel.php') diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index 1cf70362d..cd33d5adb 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -92,6 +92,7 @@ class SiteadminpanelAction extends AdminPanelAction { static $settings = array('name', 'broughtby', 'broughtbyurl', 'email', 'timezone', 'language'); + static $booleans = array('private'); $values = array(); diff --git a/panels.txt b/panels.txt index 3787eb190..030e3ddc7 100644 --- a/panels.txt +++ b/panels.txt @@ -52,10 +52,6 @@ emailadminpanel - popular dropoff - message contentlimit -locationadminpanel - -- location namespace - groupadminpanel - group desclimit -- cgit v1.2.3-54-g00ecf From cb4acd40bf6bedd32f8352e73654e0fbff730cf8 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 17 Nov 2009 14:51:17 -0500 Subject: more snapshot stuff in siteadminpanel --- actions/siteadminpanel.php | 106 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 85 insertions(+), 21 deletions(-) (limited to 'actions/siteadminpanel.php') diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index cd33d5adb..2623e48ed 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -90,18 +90,24 @@ class SiteadminpanelAction extends AdminPanelAction function saveSettings() { - static $settings = array('name', 'broughtby', 'broughtbyurl', - 'email', 'timezone', 'language'); - static $booleans = array('private'); + static $settings = array('site' => array('name', 'broughtby', 'broughtbyurl', + 'email', 'timezone', 'language'), + 'snapshot' => array('run', 'reporturl', 'frequency')); + + static $booleans = array('site' => array('private')); $values = array(); - foreach ($settings as $setting) { - $values[$setting] = $this->trimmed($setting); + foreach ($settings as $section => $parts) { + foreach ($parts as $setting) { + $values[$section][$setting] = $this->trimmed($setting); + } } - foreach ($booleans as $setting) { - $values[$setting] = ($this->boolean($setting)) ? 1 : 0; + foreach ($booleans as $section => $parts) { + foreach ($parts as $setting) { + $values[$section][$setting] = ($this->boolean($setting)) ? 1 : 0; + } } // This throws an exception on validation errors @@ -114,8 +120,16 @@ class SiteadminpanelAction extends AdminPanelAction $config->query('BEGIN'); - foreach (array_merge($settings, $booleans) as $setting) { - Config::save('site', $setting, $values[$setting]); + foreach ($settings as $section => $parts) { + foreach ($parts as $setting) { + Config::save($section, $setting, $values[$section][$setting]); + } + } + + foreach ($booleans as $section => $parts) { + foreach ($parts as $setting) { + Config::save($section, $setting, $values[$section][$setting]); + } } $config->query('COMMIT'); @@ -127,34 +141,55 @@ class SiteadminpanelAction extends AdminPanelAction { // Validate site name - if (empty($values['name'])) { + if (empty($values['site']['name'])) { $this->clientError(_("Site name must have non-zero length.")); } // Validate email - $values['email'] = common_canonical_email($values['email']); + $values['site']['email'] = common_canonical_email($values['site']['email']); - if (empty($values['email'])) { + if (empty($values['site']['email'])) { $this->clientError(_('You must have a valid contact email address')); } - if (!Validate::email($values['email'], common_config('email', 'check_domain'))) { + if (!Validate::email($values['site']['email'], common_config('email', 'check_domain'))) { $this->clientError(_('Not a valid email address')); } // Validate timezone - if (is_null($values['timezone']) || - !in_array($values['timezone'], DateTimeZone::listIdentifiers())) { + if (is_null($values['site']['timezone']) || + !in_array($values['site']['timezone'], DateTimeZone::listIdentifiers())) { $this->clientError(_('Timezone not selected.')); return; } // Validate language - if (!is_null($language) && !in_array($language, array_keys(get_nice_language_list()))) { - $this->clientError(sprintf(_('Unknown language "%s"'), $language)); + if (!is_null($values['site']['language']) && + !in_array($values['site']['language'], array_keys(get_nice_language_list()))) { + $this->clientError(sprintf(_('Unknown language "%s"'), $values['site']['language'])); + } + + // Validate report URL + + if (!is_null($values['snapshot']['reporturl']) && + !Validate::uri($values['snapshot']['reporturl'], array('allowed_schemes' => array('http', 'https')))) { + $this->clientError(_("Invalid snapshot report URL.")); + } + + // Validate snapshot run value + + if (!in_array($values['snapshot']['run'], array('web', 'cron', 'never'))) { + $this->clientError(_("Invalid snapshot run value.")); } + + // Validate snapshot run value + + if (!Validate::number($values['snapshot']['frequency'])) { + $this->clientError(_("Snapshot frequency must be a number.")); + } + } } @@ -250,6 +285,33 @@ class SiteAdminPanelForm extends Form $this->unli(); + $this->li(); + + $snapshot = array('web' => _('Randomly during Web hit'), + 'cron' => _('In a scheduled job'), + 'never' => _('Never')); + + $this->out->dropdown('run', _('Data snapshots'), + $snapshot, _('When to send statistical data to status.net servers'), + false, $this->value('run', 'snapshot')); + + $this->unli(); + $this->li(); + + $this->input('frequency', _('Frequency'), + _('Snapshots will be sent once every N Web hits'), + 'snapshot'); + + $this->unli(); + + $this->li(); + + $this->input('reporturl', _('Report URL'), + _('Snapshots will be sent to this URL'), + 'snapshot'); + + $this->unli(); + $this->out->elementEnd('ul'); } @@ -260,28 +322,30 @@ class SiteAdminPanelForm extends Form * @param string $setting Name of the setting * @param string $title Title to use for the input * @param string $instructions Instructions for this field + * @param string $section config section, default = 'site' * * @return void */ - function input($setting, $title, $instructions) + function input($setting, $title, $instructions, $section='site') { - $this->out->input($setting, $title, $this->value($setting), $instructions); + $this->out->input($setting, $title, $this->value($setting, $section), $instructions); } /** * Utility to simplify getting the posted-or-stored setting value * * @param string $setting Name of the setting + * @param string $main configuration section, default = 'site' * * @return string param value if posted, or current config value */ - function value($setting) + function value($setting, $main='site') { $value = $this->out->trimmed($setting); if (empty($value)) { - $value = common_config('site', $setting); + $value = common_config($main, $setting); } return $value; } -- cgit v1.2.3-54-g00ecf