Modernized the "timezone hack", made the config option a dropdown, and moved all timezone-related code into a new TimeZoneConfig class
3 /* Reminder: always indent with 4 spaces (no tabs). */
4 // +---------------------------------------------------------------------------+
6 // +---------------------------------------------------------------------------+
7 // | configuration.php |
9 // | Loads the administration UI and sends input to config.class |
10 // +---------------------------------------------------------------------------+
11 // | Copyright (C) 2007-2009 by the following authors: |
13 // | Authors: Aaron Blankstein - kantai AT gmail DOT com |
14 // +---------------------------------------------------------------------------+
16 // | This program is free software; you can redistribute it and/or |
17 // | modify it under the terms of the GNU General Public License |
18 // | as published by the Free Software Foundation; either version 2 |
19 // | of the License, or (at your option) any later version. |
21 // | This program is distributed in the hope that it will be useful, |
22 // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
24 // | GNU General Public License for more details. |
26 // | You should have received a copy of the GNU General Public License |
27 // | along with this program; if not, write to the Free Software Foundation, |
28 // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
30 // +---------------------------------------------------------------------------+
33 * Geeklog common function library
35 require_once '../lib-common.php';
36 require_once 'auth.inc.php';
39 * Helper function: Provide language dropdown
41 * NOTE: Note that key/value are being swapped!
43 * @return array Array of (filename, displayname) pairs
46 function configmanager_select_language_helper()
50 return array_flip(MBYTE_languageList($_CONF['default_charset']));
54 * Helper function: Provide themes dropdown
56 * NOTE: Beautifying code duplicated from usersettings.php
58 * @return array Array of (filename, displayname) pairs
61 function configmanager_select_theme_helper()
65 $themeFiles = COM_getThemes(true);
67 create_function('$a,$b', 'return strcasecmp($a,$b);'));
69 foreach ($themeFiles as $theme) {
70 $words = explode ('_', $theme);
72 foreach ($words as $th) {
73 if ((strtolower ($th{0}) == $th{0}) &&
74 (strtolower ($th{1}) == $th{1})) {
75 $bwords[] = strtoupper ($th{0}) . substr ($th, 1);
81 $themes[implode(' ', $bwords)] = $theme;
88 * Helper function: Provide timezone dropdown
90 * @return array Array of (timezone-long-name, timezone-short-name) pairs
93 function configmanager_select_timezone_helper()
97 require_once $_CONF['path_system'] . 'classes/timezoneconfig.class.php';
99 return array_flip(TimeZoneConfig::listAvailableTimeZones());
106 $conf_group = array_key_exists('conf_group', $_POST)
107 ? $_POST['conf_group'] : 'Core';
108 $config =& config::get_instance();
109 $tokenstate = SEC_checkToken();
111 if (array_key_exists('set_action', $_POST) && $tokenstate){
112 if (SEC_inGroup('Root')) {
113 if ($_POST['set_action'] == 'restore') {
114 $config->restore_param($_POST['name'], $conf_group);
115 } elseif ($_POST['set_action'] == 'unset') {
116 $config->unset_param($_POST['name'], $conf_group);
121 if (array_key_exists('form_submit', $_POST) && $tokenstate) {
123 if (! array_key_exists('form_reset', $_POST)) {
124 $result = $config->updateConfig($_POST, $conf_group);
127 if (is_array($result) && (count($result) > 0)) {
128 PLG_configChange($conf_group, array_keys($result));
131 $display = $config->get_ui($conf_group, $_POST['sub_group'], $result);
133 $display = $config->get_ui($conf_group, array_key_exists('subgroup', $_POST)
134 ? $_POST['subgroup'] : null);
137 COM_output($display);