diff --git a/install/install.php b/install/install.php index cab7069d39807e1c017f63f8743dbc8f36608b38..c023e8fe7c219996dfbb338d7e74097ad2d0de50 100644 --- a/install/install.php +++ b/install/install.php @@ -188,7 +188,7 @@ do { } 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.'); +if(!function_exists('mysqli_connect')) die('No PHP MySQLi functions available. Please ensure that the PHP MySQL module is loaded.'); //** Get MySQL root credentials $finished = false; @@ -208,7 +208,7 @@ do { } //* Initialize the MySQL server connection - if(@mysql_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { + if(@mysqli_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { $conf['mysql']['host'] = $tmp_mysql_server_host; $conf['mysql']['port'] = $tmp_mysql_server_port; $conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user; @@ -217,7 +217,7 @@ do { $conf['mysql']['charset'] = $tmp_mysql_server_charset; $finished = true; } else { - swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysql_error()); + swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysqli_error()); } } while ($finished == false); unset($finished); @@ -553,7 +553,7 @@ if($install_mode == 'standard') { $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 . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { + if(@mysqli_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { $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; @@ -561,7 +561,7 @@ if($install_mode == 'standard') { $conf['mysql']['master_database'] = $tmp_mysql_server_database; $finished = true; } else { - swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); + swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_error()); } } while ($finished == false); unset($finished); diff --git a/install/lib/mysql.lib.php b/install/lib/mysql.lib.php index 11fd2ec37db8851abe47835b8072c18bb61ba680..7cf06ee044a24aa279bed471210b5224fad490f6 100644 --- a/install/lib/mysql.lib.php +++ b/install/lib/mysql.lib.php @@ -776,7 +776,7 @@ class db_result { * * @access private */ - public function db_result($iResId, $iConnection) { + public function __construct($iResId, $iConnection) { $this->_iResId = $iResId; $this->_iConnection = $iConnection; } @@ -902,7 +902,7 @@ class fakedb_result { * * @access private */ - public function fakedb_result($aData) { + public function __construct($aData) { $this->aResultData = $aData; $this->aLimitedData = $aData; reset($this->aLimitedData); diff --git a/install/uninstall-fedora.php b/install/uninstall-fedora.php index b1d7e47752869511688b72016dc443439dcbd177..8aa5fcf68e2f0f46642eeaa3ba961f5c835b5766 100644 --- a/install/uninstall-fedora.php +++ b/install/uninstall-fedora.php @@ -65,16 +65,16 @@ if($do_uninstall == 'yes') { //exec("/etc/init.d/mysqld stop"); //exec("rm -rf /var/lib/mysql/".$conf["db_database"]); //exec("/etc/init.d/mysqld start"); - $link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password); + $link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password); if (!$link) { echo "Unable to connect to the database'.mysql_error($link)"; } else { - $result=mysql_query("DROP DATABASE ".$conf['db_database']."';", $link); - if (!$result) echo "Unable to remove the ispconfig-database ".$conf['db_database']." ".mysql_error($link)."\n"; - $result=mysql_query("DROP USER '".$conf['db_user'] ."';"); - if (!$result) echo "Unable to remove the ispconfig-database-user ".$conf['db_user']." ".mysql_error($link)."\n"; + $result=mysqli_query($link,"DROP DATABASE ".$conf['db_database']."';"); + if (!$result) echo "Unable to remove the ispconfig-database ".$conf['db_database']." ".mysqli_error($link)."\n"; + $result=mysqli_query($link, "DROP USER '".$conf['db_user'] ."';"); + if (!$result) echo "Unable to remove the ispconfig-database-user ".$conf['db_user']." ".mysqli_error($link)."\n"; } - mysql_close($link); + mysqli_close($link); // Deleting the symlink in /var/www // Apache diff --git a/install/uninstall.php b/install/uninstall.php index 111f57466311f6c70f017a4654c192603fc3305c..198a145a5ad7ef2e0fd1f89226f5591f73485398 100644 --- a/install/uninstall.php +++ b/install/uninstall.php @@ -60,16 +60,16 @@ if($do_uninstall == 'yes') { echo "\n\n>> Uninstalling ISPConfig 3... \n\n"; - $link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password); + $link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password); if (!$link) { echo "Unable to connect to the database'.mysql_error($link)"; } else { - $result=mysql_query("DROP DATABASE ".$conf['db_database']."';", $link); - if (!$result) echo "Unable to remove the ispconfig-database ".$conf['db_database']." ".mysql_error($link)."\n"; - $result=mysql_query("DROP USER '".$conf['db_user'] ."';"); - if (!$result) echo "Unable to remove the ispconfig-database-user ".$conf['db_user']." ".mysql_error($link)."\n"; + $result=mysqli_query($link,"DROP DATABASE ".$conf['db_database']."';"); + if (!$result) echo "Unable to remove the ispconfig-database ".$conf['db_database']." ".mysqli_error($link)."\n"; + $result=mysqli_query($link,"DROP USER '".$conf['db_user'] ."';"); + if (!$result) echo "Unable to remove the ispconfig-database-user ".$conf['db_user']." ".mysqli_error($link)."\n"; } - mysql_close($link); + mysqli_close($link); // Deleting the symlink in /var/www // Apache diff --git a/install/update.php b/install/update.php index 504a63713eab2f85cc62ccb4e23cda0ea866e1ae..6422e54fef0cdef381cff57452dc8c4df0e14cd2 100644 --- a/install/update.php +++ b/install/update.php @@ -226,10 +226,10 @@ $clientdb_password = ''; //** Test mysql root connection $finished = false; do { - if(@mysql_connect($conf["mysql"]["host"], $conf["mysql"]["admin_user"], $conf["mysql"]["admin_password"])) { + if(@mysqli_connect($conf["mysql"]["host"], $conf["mysql"]["admin_user"], $conf["mysql"]["admin_password"])) { $finished = true; } else { - swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); + swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_error()); $conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password'],'mysql_root_password'); } } while ($finished == false); @@ -255,7 +255,7 @@ if($conf['mysql']['master_slave_setup'] == 'y') { $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 . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { + if(@mysqli_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { $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; @@ -263,7 +263,7 @@ if($conf['mysql']['master_slave_setup'] == 'y') { $conf['mysql']['master_database'] = $tmp_mysql_server_database; $finished = true; } else { - swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); + swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_error()); } } while ($finished == false); unset($finished); diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php index 52a5e50aa0de7ecbe3d0f0aa74ed21e81a6b3523..e3d0c69721eb771e739f03e9b486b5a44f6fee13 100644 --- a/server/lib/classes/db_mysql.inc.php +++ b/server/lib/classes/db_mysql.inc.php @@ -556,19 +556,19 @@ class db extends mysqli global $app; include 'lib/mysql_clientdb.conf'; /* Connect to the database */ - $link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password); + $link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password); if (!$link) { - $app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_DEBUG); + $app->log('Unable to connect to the database'.mysqli_error($link), LOGLEVEL_DEBUG); return; } /* Get database-size from information_schema */ - $result=mysql_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysql_real_escape_string($database_name)."';", $link); + $result=mysqli_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysqli_real_escape_string($database_name)."';", $link); $this->close; if (!$result) { - $app->log('Unable to get the database-size'.mysql_error($link), LOGLEVEL_DEBUG); + $app->log('Unable to get the database-size'.mysqli_error($link), LOGLEVEL_DEBUG); return; } - $database_size = mysql_fetch_row($result); + $database_size = mysqli_fetch_row($result); return $database_size[0]; } diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php index 739e8220e13cf43fdca96e63d731798e0f503c8c..2c36c3844290879f22c766b864f497dbc6f0e716 100644 --- a/server/lib/classes/system.inc.php +++ b/server/lib/classes/system.inc.php @@ -44,7 +44,7 @@ class system{ */ - public function system(){ + public function __construct(){ //global $go_info; //$this->server_id = $go_info['isp']['server_id']; //$this->server_conf = $go_info['isp']['server_conf']; diff --git a/server/plugins-available/software_update_plugin.inc.php b/server/plugins-available/software_update_plugin.inc.php index ae6b79cfc4ac42bb6d68355290112f60e6bd53e2..bd8159e1ab98be57393917bfee8d81bae744ea1a 100644 --- a/server/plugins-available/software_update_plugin.inc.php +++ b/server/plugins-available/software_update_plugin.inc.php @@ -246,29 +246,29 @@ class software_update_plugin { } //* Connect to the database - $link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password); + $link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password); if (!$link) { - $app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_ERROR); + $app->log('Unable to connect to the database'.mysqli_error($link), LOGLEVEL_ERROR); return; } $query_charset_table = ''; //* Create the new database - if (mysql_query('CREATE DATABASE '.mysql_real_escape_string($db_config['database_name']).$query_charset_table, $link)) { + if (mysqli_query($link,'CREATE DATABASE '.mysqli_real_escape_string($link, $db_config['database_name']).$query_charset_table, $link)) { $app->log('Created MySQL database: '.$db_config['database_name'], LOGLEVEL_DEBUG); } else { - $app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_ERROR); + $app->log('Unable to connect to the database'.mysqli_error($link), LOGLEVEL_ERROR); } - if(mysql_query("GRANT ALL ON ".mysql_real_escape_string($db_config['database_name'], $link).".* TO '".mysql_real_escape_string($db_config['database_user'], $link)."'@'".$db_config['database_host']."' IDENTIFIED BY '".mysql_real_escape_string($db_config['database_password'], $link)."';", $link)) { + if(mysqli_query("GRANT ALL ON ".mysqli_real_escape_string($link, $db_config['database_name']).".* TO '".mysqli_real_escape_string($link, $db_config['database_user'])."'@'".$db_config['database_host']."' IDENTIFIED BY '".mysqli_real_escape_string($link, $db_config['database_password'])."';", $link)) { $app->log('Created MySQL user: '.$db_config['database_user'], LOGLEVEL_DEBUG); } else { - $app->log('Unable to create database user'.$db_config['database_user'].' '.mysql_error($link), LOGLEVEL_ERROR); + $app->log('Unable to create database user'.$db_config['database_user'].' '.mysqli_error($link), LOGLEVEL_ERROR); } - mysql_query("FLUSH PRIVILEGES;", $link); - mysql_close($link); + mysqli_query($link, "FLUSH PRIVILEGES;"); + mysqli_close($link); }