diff --git a/install/index.php b/install/index.php index 9855bac75..ba71bbdba 100644 --- a/install/index.php +++ b/install/index.php @@ -107,6 +107,36 @@ } } + function make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS, + $DB_PORT, $SELF_URL_PATH) { + + $data = explode("\n", file_get_contents("../config.php-dist")); + + $rv = ""; + + foreach ($data as $line) { + if (preg_match("/define\('DB_TYPE'/", $line)) { + $rv .= "\tdefine('DB_TYPE', '$DB_TYPE');\n"; + } else if (preg_match("/define\('DB_HOST'/", $line)) { + $rv .= "\tdefine('DB_HOST', '$DB_HOST');\n"; + } else if (preg_match("/define\('DB_USER'/", $line)) { + $rv .= "\tdefine('DB_USER', '$DB_USER');\n"; + } else if (preg_match("/define\('DB_NAME'/", $line)) { + $rv .= "\tdefine('DB_NAME', '$DB_NAME');\n"; + } else if (preg_match("/define\('DB_PASS'/", $line)) { + $rv .= "\tdefine('DB_PASS', '$DB_PASS');\n"; + } else if (preg_match("/define\('DB_PORT'/", $line)) { + $rv .= "\tdefine('DB_PORT', '$DB_PORT');\n"; + } else if (preg_match("/define\('SELF_URL_PATH'/", $line)) { + $rv .= "\tdefine('SELF_URL_PATH', '$SELF_URL_PATH');\n"; + } else { + $rv .= "$line\n"; + } + } + + return $rv; + } + function db_query($link, $query, $type, $die_on_error = true) { if ($type == "pgsql") { $result = pg_query($link, $query); @@ -149,7 +179,7 @@ require "../config.php"; if (!defined('_INSTALLER_IGNORE_CONFIG_CHECK')) { - print_error("Error: config.php already exists; aborting."); + print_error("Error: config.php already exists in tt-rss directory; aborting."); exit; } } @@ -344,34 +374,62 @@ print "
Copy following text and save as config.php in tt-rss main directory. It is suggested to read through the file to the end in case you need any options changed fom default values.
"; + print "Copy following text and save as config.php in tt-rss main directory. It is suggested to read through the file to the end in case you need any options changed fom default values.
We can also try saving the file automatically now.
+ + + + "; + print_notice("You can generate the file again by changing the form above."); - print "You can generate the file again by changing the form above.
"; + } else if ($op == "saveconfig") { + + print "