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 (strlen($db_host) == 0 && strlen($db_port) == 0) {
|
||||||
//if both host and port are empty use the unix socket
|
//if both host and port are empty use the unix socket
|
||||||
if (strlen($db_create_username) == 0) {
|
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 {
|
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 {
|
else {
|
||||||
if (strlen($db_port) == 0) {
|
if (strlen($db_port) == 0) {
|
||||||
//leave out port if it is empty
|
//leave out port if it is empty
|
||||||
if (strlen($db_create_username) == 0) {
|
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 {
|
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 {
|
else {
|
||||||
if (strlen($db_create_username) == 0) {
|
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 {
|
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
|
//database connection
|
||||||
try {
|
try {
|
||||||
//required for mysql_real_escape_string
|
//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 = @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_connection = mysqli_connect($db_host, $db_username, $db_password,$db_name) or die("Error " . mysqli_error($link));
|
||||||
}
|
}
|
||||||
//mysql pdo connection
|
//mysql pdo connection
|
||||||
if (strlen($db_host) == 0 && strlen($db_port) == 0) {
|
if (strlen($db_host) == 0 && strlen($db_port) == 0) {
|
||||||
//if both host and port are empty use the unix socket
|
//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 {
|
else {
|
||||||
if (strlen($db_port) == 0) {
|
if (strlen($db_port) == 0) {
|
||||||
//leave out port if it is empty
|
//leave out port if it is empty
|
||||||
$db = new PDO("mysql:host=$db_host;dbname=$db_name;", $db_username, $db_password, array(
|
$db = new PDO("mysql:host=$db_host;dbname=$db_name;charset=utf8;", $db_username, $db_password, array(
|
||||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
|
||||||
PDO::ATTR_ERRMODE,
|
PDO::ATTR_ERRMODE,
|
||||||
PDO::ERRMODE_EXCEPTION
|
PDO::ERRMODE_EXCEPTION
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$db = new PDO("mysql:host=$db_host;port=$db_port;dbname=$db_name;", $db_username, $db_password, array(
|
$db = new PDO("mysql:host=$db_host;port=$db_port;dbname=$db_name;charset=utf8;", $db_username, $db_password, array(
|
||||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
|
||||||
PDO::ATTR_ERRMODE,
|
PDO::ATTR_ERRMODE,
|
||||||
PDO::ERRMODE_EXCEPTION
|
PDO::ERRMODE_EXCEPTION
|
||||||
));
|
));
|
||||||
|
|
@ -233,7 +231,7 @@ if ($db_type == "pgsql") {
|
||||||
} //end if db_type pgsql
|
} //end if db_type pgsql
|
||||||
|
|
||||||
//domain list
|
//domain list
|
||||||
if (strlen($_SESSION["domain_uuid"]) == 0) {
|
if ( ( !isset($_SESSION["domain_uuid"])) or (strlen($_SESSION["domain_uuid"]) == 0)) {
|
||||||
//get the domain
|
//get the domain
|
||||||
$domain_array = explode(":", $_SERVER["HTTP_HOST"]);
|
$domain_array = explode(":", $_SERVER["HTTP_HOST"]);
|
||||||
//get the domains from the database
|
//get the domains from the database
|
||||||
|
|
@ -303,7 +301,7 @@ if ($db_type == "pgsql") {
|
||||||
}
|
}
|
||||||
|
|
||||||
//check the domain cidr range
|
//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;
|
$found = false;
|
||||||
foreach($_SESSION['domain']["cidr"] as $cidr) {
|
foreach($_SESSION['domain']["cidr"] as $cidr) {
|
||||||
if (check_cidr($cidr, $_SERVER['REMOTE_ADDR'])) {
|
if (check_cidr($cidr, $_SERVER['REMOTE_ADDR'])) {
|
||||||
|
|
@ -318,7 +316,7 @@ if ($db_type == "pgsql") {
|
||||||
}
|
}
|
||||||
|
|
||||||
//check the api cidr range
|
//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;
|
$found = false;
|
||||||
foreach($_SESSION['api']["cidr"] as $cidr) {
|
foreach($_SESSION['api']["cidr"] as $cidr) {
|
||||||
if (check_cidr($cidr, $_SERVER['REMOTE_ADDR'])) {
|
if (check_cidr($cidr, $_SERVER['REMOTE_ADDR'])) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue