last fixes needed to support mariadb 10.1
This commit is contained in:
parent
cc553a70c5
commit
2a070aff4f
|
|
@ -207,27 +207,27 @@ else {
|
|||
if (strlen($db_host) == 0 && strlen($db_port) == 0) {
|
||||
//if both host and port are empty use the unix socket
|
||||
if (strlen($db_create_username) == 0) {
|
||||
$db_dest = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $db_username, $db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
|
||||
$db_dest = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;charset=utf8;", $db_username, $db_password);
|
||||
}
|
||||
else {
|
||||
$db_dest = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $db_create_username, $db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); }
|
||||
$db_dest = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;charset=utf8;", $db_create_username, $db_create_password); }
|
||||
}
|
||||
else {
|
||||
if (strlen($db_port) == 0) {
|
||||
//leave out port if it is empty
|
||||
if (strlen($db_create_username) == 0) {
|
||||
$db_dest = new PDO("mysql:host=$db_host;", $db_username, $db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
|
||||
$db_dest = new PDO("mysql:host=$db_host;charset=utf8;", $db_username, $db_password);
|
||||
}
|
||||
else {
|
||||
$db_dest = new PDO("mysql:host=$db_host;", $db_create_username, $db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
|
||||
$db_dest = new PDO("mysql:host=$db_host;charset=utf8;", $db_create_username, $db_create_password);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strlen($db_create_username) == 0) {
|
||||
$db_dest = new PDO("mysql:host=$db_host;port=$db_port;", $db_username, $db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
|
||||
$db_dest = new PDO("mysql:host=$db_host;port=$db_port;charset=utf8;", $db_username, $db_password);
|
||||
}
|
||||
else {
|
||||
$db_dest = new PDO("mysql:host=$db_host;port=$db_port;", $db_create_username, $db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
|
||||
$db_dest = new PDO("mysql:host=$db_host;port=$db_port;charset=utf8;", $db_create_username, $db_create_password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,27 +182,25 @@ if ($db_type == "mysql") {
|
|||
//database connection
|
||||
try {
|
||||
//required for mysql_real_escape_string
|
||||
if (function_exists(mysql_connect)) {
|
||||
if (function_exists('mysql_connect')) {
|
||||
$mysql_connection = @mysql_connect($db_host, $db_username, $db_password);
|
||||
//$mysql_connection = mysqli_connect($db_host, $db_username, $db_password,$db_name) or die("Error " . mysqli_error($link));
|
||||
}
|
||||
//mysql pdo connection
|
||||
if (strlen($db_host) == 0 && strlen($db_port) == 0) {
|
||||
//if both host and port are empty use the unix socket
|
||||
$db = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;dbname=$db_name", $db_username, $db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
|
||||
$db = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;dbname=$db_name;charset=utf8;", $db_username, $db_password);
|
||||
}
|
||||
else {
|
||||
if (strlen($db_port) == 0) {
|
||||
//leave out port if it is empty
|
||||
$db = new PDO("mysql:host=$db_host;dbname=$db_name;", $db_username, $db_password, array(
|
||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
||||
$db = new PDO("mysql:host=$db_host;dbname=$db_name;charset=utf8;", $db_username, $db_password, array(
|
||||
PDO::ATTR_ERRMODE,
|
||||
PDO::ERRMODE_EXCEPTION
|
||||
));
|
||||
}
|
||||
else {
|
||||
$db = new PDO("mysql:host=$db_host;port=$db_port;dbname=$db_name;", $db_username, $db_password, array(
|
||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
||||
$db = new PDO("mysql:host=$db_host;port=$db_port;dbname=$db_name;charset=utf8;", $db_username, $db_password, array(
|
||||
PDO::ATTR_ERRMODE,
|
||||
PDO::ERRMODE_EXCEPTION
|
||||
));
|
||||
|
|
@ -233,7 +231,7 @@ if ($db_type == "pgsql") {
|
|||
} //end if db_type pgsql
|
||||
|
||||
//domain list
|
||||
if (strlen($_SESSION["domain_uuid"]) == 0) {
|
||||
if ( ( !isset($_SESSION["domain_uuid"])) or (strlen($_SESSION["domain_uuid"]) == 0)) {
|
||||
//get the domain
|
||||
$domain_array = explode(":", $_SERVER["HTTP_HOST"]);
|
||||
//get the domains from the database
|
||||
|
|
@ -303,7 +301,7 @@ if ($db_type == "pgsql") {
|
|||
}
|
||||
|
||||
//check the domain cidr range
|
||||
if (is_array($_SESSION['domain']["cidr"])) {
|
||||
if (array_key_exists('cidr',$_SESSION['domain']) and is_array($_SESSION['domain']["cidr"])) {
|
||||
$found = false;
|
||||
foreach($_SESSION['domain']["cidr"] as $cidr) {
|
||||
if (check_cidr($cidr, $_SERVER['REMOTE_ADDR'])) {
|
||||
|
|
@ -318,7 +316,7 @@ if ($db_type == "pgsql") {
|
|||
}
|
||||
|
||||
//check the api cidr range
|
||||
if (is_array($_SESSION['api']["cidr"])) {
|
||||
if (array_key_exists('api',$_SESSION) and is_array($_SESSION['api']["cidr"])) {
|
||||
$found = false;
|
||||
foreach($_SESSION['api']["cidr"] as $cidr) {
|
||||
if (check_cidr($cidr, $_SERVER['REMOTE_ADDR'])) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue