# Can we write config.php if (!is_writable(dirname(DC_RC_PATH))) { throw new Exception(sprintf(__('Cannot write %s file.'), DC_RC_PATH)); } # Creates config.php file $full_conf = file_get_contents($config_in); writeConfigValue('DC_DBDRIVER', $DBDRIVER, $full_conf); writeConfigValue('DC_DBHOST', $DBHOST, $full_conf); writeConfigValue('DC_DBUSER', $DBUSER, $full_conf); writeConfigValue('DC_DBPASSWORD', $DBPASSWORD, $full_conf); writeConfigValue('DC_DBNAME', $DBNAME, $full_conf); writeConfigValue('DC_DBPREFIX', $DBPREFIX, $full_conf); $admin_url = preg_replace('%install/wizard.php$%', '', $_SERVER['REQUEST_URI']); writeConfigValue('DC_ADMIN_URL', http::getHost() . $admin_url, $full_conf); writeConfigValue('DC_ADMIN_MAILFROM', 'dotclear@' . $_SERVER['HTTP_HOST'], $full_conf); writeConfigValue('DC_MASTER_KEY', md5(uniqid()), $full_conf); $fp = @fopen(DC_RC_PATH, 'wb'); if ($fp === false) { throw new Exception(sprintf(__('Cannot write %s file.'), DC_RC_PATH)); } fwrite($fp, $full_conf); fclose($fp); chmod(DC_RC_PATH, 0666); $con->close(); http::redirect('index.php?wiz=1'); } catch (Exception $e) { $err = $e->getMessage(); } } function writeConfigValue($name, $val, &$str) {
} # Can we write config.php if (!is_writable(dirname(BP_CONFIG_PATH))) { throw new Exception(sprintf(T_('Cannot write %s file.'), BP_CONFIG_PATH)); } # Creates config.php file $root_url = preg_replace('%/admin/install/wizard.php$%', '', $_SERVER['REQUEST_URI']); $planet_url = http::getHost() . $root_url; $full_conf = file_get_contents($config_in); writeConfigValue('BP_DBHOST', $DBHOST, $full_conf); writeConfigValue('BP_DBUSER', $DBUSER, $full_conf); writeConfigValue('BP_DBPASSWORD', $DBPASSWORD, $full_conf); writeConfigValue('BP_DBNAME', $DBNAME, $full_conf); writeConfigValue('BP_DBPREFIX', strtolower($DBPREFIX), $full_conf); writeConfigValue('BP_DBENCRYPTED_PASSWORD', '1', $full_conf); writeConfigValue('BP_PLANET_URL', $planet_url, $full_conf); $fp = @fopen(BP_CONFIG_PATH, 'wb'); if ($fp === false) { throw new Exception(sprintf(T_('Cannot write %s file.'), BP_CONFIG_PATH)); } fwrite($fp, $full_conf); fclose($fp); chmod(BP_CONFIG_PATH, 0775); #chmod(BP_CONFIG_PATH, 0666); # Check if bilboplanet is already installed $schema = dbSchema::init($con); if (in_array($DBPREFIX . 'feed', $schema->getTables())) { throw new Exception(sprintf(T_('The Bilboplanet is already installed. Please remove the tables in the database before. </br> If you want to keep the content of the database, you can also update the database by launching the updating script : %s'), '<a href="' . $planet_url . '/inc/upgrade_db.php">' . T_('Run script') . '</a>')); } $con->close();