Commit 239ce82f authored by tbrehm's avatar tbrehm
Browse files

No commit message

No commit message
parent ce95440a
......@@ -53,7 +53,7 @@ $inst = new installer();
swriteln($inst->lng("This application will install ISPConfig 3 on your server.");
swriteln($inst->lng("This application will install ISPConfig 3 on your server."));
// Select the language
$conf["language"] = $inst->simple_query('Select language',array('en','de'),'en');
......@@ -70,20 +70,27 @@ unset($tmp_out);
// Get MySQL root password
include_once('lib/mysql.lib.php');
$finished = false;
do {
$conf["mysql_server_admin_password"] = $inst->free_query('MySQL root password','');
$tmp_mysql_server_host = $inst->free_query('MySQL server hostname',$conf["mysql_server_host"]);
$tmp_mysql_server_admin_user = $inst->free_query('MySQL root username',$conf["mysql_server_admin_user"]);
$tmp_mysql_server_admin_password = $inst->free_query('MySQL root password',$conf["mysql_server_admin_password"]);
// Initialize the MySQL server connection
$inst->db = new db();
if($inst->db->connect() == false) {
swriteln($inst->db->errorMessage);
} else {
if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
$conf["mysql_server_host"] = $tmp_mysql_server_host;
$conf["mysql_server_admin_user"] = $tmp_mysql_server_admin_user;
$conf["mysql_server_admin_password"] = $tmp_mysql_server_admin_password;
$finished = true;
} else {
swriteln($inst->lng("Unable to connect to mysql server").' '.mysql_error());
}
} while ($finished == false);
unset($finished);
// initializing database connection
include_once('lib/mysql.lib.php');
$inst->db = new db();
// Begin with standard or expert installation
if($install_mode == 'Standard') {
......
......@@ -49,11 +49,11 @@ function sread() {
return rtrim($input);
}
function swrite($text) {
function swrite($text = '') {
echo $text;
}
function swriteln($text) {
function swriteln($text = '') {
echo $text."\n";
}
......
......@@ -52,12 +52,13 @@ class installer_base {
$finished = false;
do {
$answers_str = implode(",",$answers);
swriteln($this->lng($query).' ('.$answers_str.') ['.$default.']:');
swrite($this->lng($query).' ('.$answers_str.') ['.$default.']: ');
$input = sread();
// Stop the installation
if($input == 'quit') {
die($this->lng('Installation interrupted.'));
swriteln($this->lng('Installation interrupted.'));
die();
}
// Select the default
......@@ -72,26 +73,30 @@ class installer_base {
}
} while ($finished == false);
swriteln();
return $answer;
}
function free_query($query,$default) {
global $conf;
$answers_str = implode(",",$answers);
swriteln($this->lng($query).' ['.$default.']:');
swrite($this->lng($query).' ['.$default.']: ');
$input = sread();
// Stop the installation
if($input == 'quit') {
die($this->lng('Installation interrupted.'));
swriteln($this->lng('Installation interrupted.'));
die();
}
// Select the default
if($input == '') {
$answer = $default;
} else {
$answer = $input;
}
swriteln();
return $answer;
}
......@@ -534,7 +539,7 @@ maildrop unix - n n - - pipe
$content = str_replace('{mysql_server_ispconfig_user}',$conf["mysql_server_ispconfig_user"],$content);
$content = str_replace('{mysql_server_ispconfig_password}',$conf["mysql_server_ispconfig_password"],$content);
$content = str_replace('{mysql_server_database}',$conf["mysql_server_database"],$content);
$content = str_replace('{mysql_server_ip}',$conf["mysql_server_ip"],$content);
$content = str_replace('{mysql_server_host}',$conf["mysql_server_host"],$content);
$content = str_replace('{server_id}',$conf["server_id"],$content);
wf($conf["dist_mydns_config_dir"].'/'.$configfile,$content);
exec('chmod 600 '.$conf["dist_mydns_config_dir"].'/'.$configfile);
......
......@@ -73,6 +73,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if($this->linkId == 0)
{
$this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass);
if(!$this->linkId)
{
$this->updateError('DB::connect()<br />mysql_connect');
......
......@@ -14,7 +14,7 @@
# DATABASE INFORMATION
db-host = {mysql_server_ip} # SQL server hostname
db-host = {mysql_server_host} # SQL server hostname
db-user = {mysql_server_ispconfig_user} # SQL server username
db-password = {mysql_server_ispconfig_password} # SQL server password
database = {mysql_server_database} # MyDNS database name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment