Skip to content

Commit 239ce82

Browse files
committed
1 parent ce95440 commit 239ce82

File tree

5 files changed

+31
-18
lines changed

5 files changed

+31
-18
lines changed

install/install.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454

5555

56-
swriteln($inst->lng("This application will install ISPConfig 3 on your server.");
56+
swriteln($inst->lng("This application will install ISPConfig 3 on your server."));
5757

5858
// Select the language
5959
$conf["language"] = $inst->simple_query('Select language',array('en','de'),'en');
@@ -70,20 +70,27 @@
7070

7171

7272
// Get MySQL root password
73-
include_once('lib/mysql.lib.php');
7473
$finished = false;
7574
do {
76-
$conf["mysql_server_admin_password"] = $inst->free_query('MySQL root password','');
75+
$tmp_mysql_server_host = $inst->free_query('MySQL server hostname',$conf["mysql_server_host"]);
76+
$tmp_mysql_server_admin_user = $inst->free_query('MySQL root username',$conf["mysql_server_admin_user"]);
77+
$tmp_mysql_server_admin_password = $inst->free_query('MySQL root password',$conf["mysql_server_admin_password"]);
78+
7779
// Initialize the MySQL server connection
78-
$inst->db = new db();
79-
if($inst->db->connect() == false) {
80-
swriteln($inst->db->errorMessage);
81-
} else {
80+
if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
81+
$conf["mysql_server_host"] = $tmp_mysql_server_host;
82+
$conf["mysql_server_admin_user"] = $tmp_mysql_server_admin_user;
83+
$conf["mysql_server_admin_password"] = $tmp_mysql_server_admin_password;
8284
$finished = true;
85+
} else {
86+
swriteln($inst->lng("Unable to connect to mysql server").' '.mysql_error());
8387
}
8488
} while ($finished == false);
89+
unset($finished);
8590

86-
91+
// initializing database connection
92+
include_once('lib/mysql.lib.php');
93+
$inst->db = new db();
8794

8895
// Begin with standard or expert installation
8996
if($install_mode == 'Standard') {

install/lib/install.lib.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ function sread() {
4949
return rtrim($input);
5050
}
5151

52-
function swrite($text) {
52+
function swrite($text = '') {
5353
echo $text;
5454
}
5555

56-
function swriteln($text) {
56+
function swriteln($text = '') {
5757
echo $text."\n";
5858
}
5959

install/lib/installer_base.lib.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ function simple_query($query,$answers,$default) {
5252
$finished = false;
5353
do {
5454
$answers_str = implode(",",$answers);
55-
swriteln($this->lng($query).' ('.$answers_str.') ['.$default.']:');
55+
swrite($this->lng($query).' ('.$answers_str.') ['.$default.']: ');
5656
$input = sread();
5757

5858
// Stop the installation
5959
if($input == 'quit') {
60-
die($this->lng('Installation interrupted.'));
60+
swriteln($this->lng('Installation interrupted.'));
61+
die();
6162
}
6263

6364
// Select the default
@@ -72,26 +73,30 @@ function simple_query($query,$answers,$default) {
7273
}
7374

7475
} while ($finished == false);
76+
swriteln();
7577
return $answer;
7678
}
7779

7880
function free_query($query,$default) {
7981
global $conf;
8082

81-
$answers_str = implode(",",$answers);
82-
swriteln($this->lng($query).' ['.$default.']:');
83+
swrite($this->lng($query).' ['.$default.']: ');
8384
$input = sread();
8485

8586
// Stop the installation
8687
if($input == 'quit') {
87-
die($this->lng('Installation interrupted.'));
88+
swriteln($this->lng('Installation interrupted.'));
89+
die();
8890
}
8991

9092
// Select the default
9193
if($input == '') {
9294
$answer = $default;
95+
} else {
96+
$answer = $input;
9397
}
94-
98+
swriteln();
99+
95100
return $answer;
96101
}
97102

@@ -534,7 +539,7 @@ function configure_mydns() {
534539
$content = str_replace('{mysql_server_ispconfig_user}',$conf["mysql_server_ispconfig_user"],$content);
535540
$content = str_replace('{mysql_server_ispconfig_password}',$conf["mysql_server_ispconfig_password"],$content);
536541
$content = str_replace('{mysql_server_database}',$conf["mysql_server_database"],$content);
537-
$content = str_replace('{mysql_server_ip}',$conf["mysql_server_ip"],$content);
542+
$content = str_replace('{mysql_server_host}',$conf["mysql_server_host"],$content);
538543
$content = str_replace('{server_id}',$conf["server_id"],$content);
539544
wf($conf["dist_mydns_config_dir"].'/'.$configfile,$content);
540545
exec('chmod 600 '.$conf["dist_mydns_config_dir"].'/'.$configfile);

install/lib/mysql.lib.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ function connect()
7373
if($this->linkId == 0)
7474
{
7575
$this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass);
76+
7677
if(!$this->linkId)
7778
{
7879
$this->updateError('DB::connect()<br />mysql_connect');

install/tpl/mydns.conf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# DATABASE INFORMATION
1616

17-
db-host = {mysql_server_ip} # SQL server hostname
17+
db-host = {mysql_server_host} # SQL server hostname
1818
db-user = {mysql_server_ispconfig_user} # SQL server username
1919
db-password = {mysql_server_ispconfig_password} # SQL server password
2020
database = {mysql_server_database} # MyDNS database name

0 commit comments

Comments
 (0)