global DSN -> define()'d DSN

This commit is contained in:
Shish 2012-02-13 21:09:34 +00:00
parent 519e46578d
commit 92701045ac

View File

@ -185,13 +185,13 @@ function eok($name, $value) {
// }}}
function do_install() { // {{{
if(isset($_POST['database_type']) && isset($_POST['database_host']) && isset($_POST['database_user']) && isset($_POST['database_name'])) {
global $database_dsn;
$database_dsn = "{$_POST['database_type']}:user={$_POST['database_user']};password={$_POST['database_password']};host={$_POST['database_host']};dbname={$_POST['database_name']}";
define('DATABASE_DSN', $database_dsn);
install_process();
}
else if(file_exists("auto_install.conf")) {
install_process(trim(file_get_contents("auto_install.conf")));
define('DATABASE_DSN', trim(file_get_contents("auto_install.conf")));
install_process();
unlink("auto_install.conf");
}
else {
@ -390,10 +390,8 @@ function build_dirs() { // {{{
}
} // }}}
function write_config() { // {{{
global $database_dsn;
$file_content = '<' . '?php' . "\n" .
"define('DATABASE_DSN', '$database_dsn');\n" .
"define('DATABASE_DSN', '".DATABASE_DSN."');\n" .
'?' . '>';
if(is_writable("./") && file_put_contents("config.php", $file_content)) {