Revision 1149
Added by aldus about 16 years ago
| save.php | ||
|---|---|---|
| 91 | 91 |
// Dummy class to allow modules' install scripts to call $admin->print_error |
| 92 | 92 |
class admin_dummy |
| 93 | 93 |
{
|
| 94 |
var $error=''; |
|
| 95 |
function print_error($message) |
|
| 94 |
public $error=''; |
|
| 95 |
|
|
| 96 |
public function print_error($message) |
|
| 96 | 97 |
{
|
| 97 | 98 |
$this->error=$message; |
| 98 | 99 |
} |
| ... | ... | |
| 317 | 318 |
|
| 318 | 319 |
$config_filename = '../config.php'; |
| 319 | 320 |
|
| 320 |
// Check if the file exists and is writable first. |
|
| 321 |
if(file_exists($config_filename) AND is_writable($config_filename)) {
|
|
| 322 |
if(!$handle = fopen($config_filename, 'w')) {
|
|
| 323 |
set_error("Cannot open the configuration file ($config_filename)");
|
|
| 321 |
/** |
|
| 322 |
* Looks a littel bit confuse, but in some circumstances |
|
| 323 |
* the config.php file could be corrupted - so the installer |
|
| 324 |
* is called even if the config.php file exists! |
|
| 325 |
*/ |
|
| 326 |
if (file_exists($config_filename)) unlink($config_filename); |
|
| 327 |
|
|
| 328 |
/** |
|
| 329 |
* Try to write the config file |
|
| 330 |
*/ |
|
| 331 |
$fp = fopen($config_filename, 'w'); |
|
| 332 |
if (!$fp ) {
|
|
| 333 |
set_error ("Can't create the config file.");
|
|
| 334 |
} else {
|
|
| 335 |
if (fwrite($fp, $config_content, strlen($config_content) ) === FALSE) {
|
|
| 336 |
/** |
|
| 337 |
* We have to close the file-pointer first, as |
|
| 338 |
* the following function "die's" and keep the |
|
| 339 |
* file-handle //open// |
|
| 340 |
*/ |
|
| 341 |
fclose( $fp ); |
|
| 342 |
set_error("Can't write to the configuration file [b]".$config_filename."[/b]!<br />Please check the permissions.");
|
|
| 343 |
|
|
| 324 | 344 |
} else {
|
| 325 |
if (fwrite($handle, $config_content) === FALSE) {
|
|
| 326 |
set_error("Cannot write to the configuration file ($config_filename)");
|
|
| 327 |
} |
|
| 328 |
// Close file |
|
| 329 |
fclose($handle); |
|
| 345 |
fclose($fp); |
|
| 330 | 346 |
} |
| 331 |
} else {
|
|
| 332 |
set_error("The configuration file $config_filename is not writable. Change its permissions so it is, then re-run step 4.");
|
|
| 333 | 347 |
} |
| 334 | 348 |
|
| 335 | 349 |
// Define configuration vars |
Also available in: Unified diff
Modifications inside class.database.
Remove the empty config.php
Update index.php and save.php