Marius Cramer
2015-05-19 6f6aa983d80882d10038945c10d7dedf572e0641
install/install.php
@@ -171,8 +171,16 @@
//** Get the hostname
$tmp_out = array();
exec('hostname -f', $tmp_out);
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', @$tmp_out[0],'hostname');
$conf['hostname'] = @$tmp_out[0];
unset($tmp_out);
//** Prevent empty hostname
$check = false;
do {
   $conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', $conf['hostname'], 'hostname');
   $conf['hostname']=trim($conf['hostname']);
   $check = @($conf['hostname'] !== '')?true:false;
   if(!$check) swriteln('Hostname may not be empty.');
} while (!$check);
// Check if the mysql functions are loaded in PHP
if(!function_exists('mysql_connect')) die('No PHP MySQL functions available. Please ensure that the PHP MySQL module is loaded.');
@@ -181,6 +189,7 @@
$finished = false;
do {
   $tmp_mysql_server_host = $inst->free_query('MySQL server hostname', $conf['mysql']['host'],'mysql_hostname');    
   $tmp_mysql_server_port = $inst->free_query('MySQL server port', $conf['mysql']['port'],'mysql_port');
   $tmp_mysql_server_admin_user = $inst->free_query('MySQL root username', $conf['mysql']['admin_user'],'mysql_root_user');    
   $tmp_mysql_server_admin_password = $inst->free_query('MySQL root password', $conf['mysql']['admin_password'],'mysql_root_password');    
   $tmp_mysql_server_database = $inst->free_query('MySQL database to create', $conf['mysql']['database'],'mysql_database');    
@@ -194,8 +203,9 @@
   }
   //* Initialize the MySQL server connection
   if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
   if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, (int)$tmp_mysql_server_port)) {
      $conf['mysql']['host'] = $tmp_mysql_server_host;
      $conf['mysql']['port'] = $tmp_mysql_server_port;
      $conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user;
      $conf['mysql']['admin_password'] = $tmp_mysql_server_admin_password;
      $conf['mysql']['database'] = $tmp_mysql_server_database;
@@ -454,6 +464,17 @@
   //** Customize the port ISPConfig runs on
   $ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port');
   $conf['interface_password'] = $inst->free_query('Admin password', 'admin');
   if($conf['interface_password'] != 'admin') {
      $check = false;
      do {
         unset($temp_password);
         $temp_password = $inst->free_query('Re-enter admin password', '');
         $check = @($temp_password == $conf['interface_password'])?true:false;
         if(!$check) swriteln('Passwords do not match.');
      } while (!$check);
   }
   unset($check);
   unset($temp_password);
   if($conf['apache']['installed'] == true) $conf['apache']['vhost_port']  = $ispconfig_vhost_port;
   if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port']  = $ispconfig_vhost_port;
   unset($ispconfig_vhost_port);
@@ -516,13 +537,15 @@
      $finished = false;
      do {
         $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); 
         $tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port');
         $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user');    
         $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); 
         $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database');
         //* Initialize the MySQL server connection
         if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
         if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, (int)$tmp_mysql_server_port)) {
            $conf['mysql']['master_host'] = $tmp_mysql_server_host;
            $conf['mysql']['master_port'] = $tmp_mysql_server_port;
            $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
            $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password;
            $conf['mysql']['master_database'] = $tmp_mysql_server_database;
@@ -794,6 +817,17 @@
      //** Customise the port ISPConfig runs on
      $ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port');
      $conf['interface_password'] = $inst->free_query('Admin password', 'admin');
      if($conf['interface_password'] != 'admin') {
         $check = false;
         do {
            unset($temp_password);
            $temp_password = $inst->free_query('Re-enter admin password', '');
            $check = @($temp_password == $conf['interface_password'])?true:false;
            if(!$check) swriteln('Passwords do not match.');
         } while (!$check);
      }
      unset($check);
      unset($temp_password);
      if($conf['apache']['installed'] == true) $conf['apache']['vhost_port']  = $ispconfig_vhost_port;
      if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port']  = $ispconfig_vhost_port;
      unset($ispconfig_vhost_port);
@@ -839,4 +873,4 @@
echo "Installation completed.\n";
?>
?>