Revision 97
Added by stefan about 19 years ago
save.php | ||
---|---|---|
155 | 155 |
exit(); |
156 | 156 |
} |
157 | 157 |
|
158 |
// Get timezone offset |
|
159 |
$timezone_offset = $_POST['timezone']*60*60; |
|
160 |
// Work out what code to put in for error reporting |
|
161 |
if($_POST['er_level'] == '') { |
|
162 |
$er_level = ''; |
|
163 |
$er_level_code = ''; |
|
164 |
} else { |
|
165 |
$er_level = $_POST['er_level']; |
|
166 |
$er_level_code = "error_reporting('".$_POST['er_level']."');\n"; |
|
167 |
} |
|
168 |
// Work-out database type, and whether or not to use PEAR |
|
169 |
$database_type = $admin->get_post('database_type'); |
|
170 |
|
|
171 |
// Rewrite WB_PATH and ADMIN_PATH if on Windows |
|
172 |
if($_POST['operating_system']=='windows') { |
|
173 |
$WB_PATH = str_replace('/','\\', WB_PATH); |
|
174 |
$WB_PATH = str_replace('\\','\\\\', $WB_PATH); |
|
175 |
$ADMIN_PATH = str_replace('/','\\', ADMIN_PATH); |
|
176 |
$ADMIN_PATH = str_replace('\\','\\\\', $ADMIN_PATH); |
|
177 |
} else { |
|
178 |
$WB_PATH = WB_PATH; |
|
179 |
$ADMIN_PATH = ADMIN_PATH; |
|
180 |
} |
|
181 |
// Write the remaining settings to the config file |
|
182 |
$config_filename = $WB_PATH.'/config.php'; |
|
183 |
$config_content = "" . |
|
184 |
"<?php \n". |
|
185 |
"define('DB_TYPE', '".DB_TYPE."');\n". |
|
186 |
"define('DB_HOST', '".DB_HOST."');\n". |
|
187 |
"define('DB_USERNAME', '".DB_USERNAME."');\n". |
|
188 |
"define('DB_PASSWORD', '".DB_PASSWORD."');\n". |
|
189 |
"define('DB_NAME', '".DB_NAME."');\n". |
|
190 |
"define('TABLE_PREFIX', '".TABLE_PREFIX."');\n". |
|
191 |
"\n". |
|
192 |
"define('WB_PATH', '".$WB_PATH."');\n". |
|
193 |
"define('WB_URL', '".WB_URL."');\n". |
|
194 |
"define('ADMIN_PATH', '".$ADMIN_PATH."');\n". |
|
195 |
"define('ADMIN_URL', '".ADMIN_URL."');\n". |
|
196 |
"\n". |
|
197 |
"?>"; |
|
198 |
|
|
199 |
// Check if file is writable first |
|
200 |
if(!is_writable($config_filename)) { |
|
201 |
$admin->print_error($MESSAGE['SETTINGS']['UNABLE_WRITE_CONFIG'], ADMIN_URL.'/settings/index.php'.$advanced); |
|
202 |
} else { |
|
203 |
// Try and open the config file |
|
204 |
if (!$handle = fopen($config_filename, 'w')) { |
|
205 |
$admin->print_error($MESSAGE['SETTINGS']['UNABLE_OPEN_CONFIG'], ADMIN_URL.'/settings/index.php'.$advanced); |
|
206 |
} else { |
|
207 |
// Try and write to the config file |
|
208 |
if (fwrite($handle, $config_content) === FALSE) { |
|
209 |
$admin->print_error($MESSAGE['SETTINGS']['UNABLE_WRITE_CONFIG'], ADMIN_URL.'/settings/index.php'.$advanced); |
|
210 |
} else { |
|
211 |
$admin->print_success($MESSAGE['SETTINGS']['SAVED'], ADMIN_URL.'/settings/index.php'.$advanced); |
|
212 |
} |
|
213 |
} |
|
214 |
} |
|
215 |
|
|
216 | 158 |
$admin->print_footer(); |
217 | 159 |
|
218 | 160 |
?> |
Also available in: Unified diff
Cleaned up settings/save.php