From c84a6d596f48e03a9b258027cc2d7eea0049d12a Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 12 Sep 2011 09:56:08 -0400
Subject: [PATCH] Added: FS#1691 - Add support for mysql flags like MYSQL_CLIENT_SSL in ISPConfig mysql library

---
 install/tpl/config.inc.php.master      |    4 ++++
 interface/lib/config.inc.php           |    4 ++++
 server/lib/classes/db_mysql.inc.php    |    6 +++++-
 interface/lib/classes/db_mysql.inc.php |    6 +++++-
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/install/tpl/config.inc.php.master b/install/tpl/config.inc.php.master
index 8370270..7d2e8fc 100644
--- a/install/tpl/config.inc.php.master
+++ b/install/tpl/config.inc.php.master
@@ -67,6 +67,8 @@
 $conf['db_user'] = '{mysql_server_ispconfig_user}';
 $conf['db_password'] = '{mysql_server_ispconfig_password}';
 $conf['db_charset'] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL: "utf-8" --> "utf8", "iso-8859-1" --> "latin1")
+$conf['db_new_link'] = false;
+$conf['db_client_flags'] = 0;
 
 define('DB_TYPE',$conf['db_type']);
 define('DB_HOST',$conf['db_host']);
@@ -82,6 +84,8 @@
 $conf['dbmaster_database']		= '{mysql_master_server_database}';
 $conf['dbmaster_user']			= '{mysql_master_server_ispconfig_user}';
 $conf['dbmaster_password']		= '{mysql_master_server_ispconfig_password}';
+$conf['dbmaster_new_link'] 		= false;
+$conf['dbmaster_client_flags'] 	= 0;
 
 
 //** Paths
diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php
index 5e38e3b..fc7b8b3 100644
--- a/interface/lib/classes/db_mysql.inc.php
+++ b/interface/lib/classes/db_mysql.inc.php
@@ -33,6 +33,8 @@
 	private $dbUser = '';		   // database authorized user
 	private $dbPass = '';		   // user's password
 	private $dbCharset = '';	   // what charset comes and goes to mysql: utf8 / latin1
+	private $dbNewLink = false;    // Return a new linkID when connect is called again
+	private $dbClientFlags = 0;    // MySQL Client falgs
 	private $linkId = 0;		   // last result of mysql_connect()
 	private $queryId = 0;		   // last result of mysql_query()
 	private $record	= array();	   // last record fetched
@@ -51,6 +53,8 @@
 		$this->dbUser = $conf['db_user'];
 		$this->dbPass = $conf['db_password'];
 		$this->dbCharset = $conf['db_charset'];
+		$this->dbNewLink = $conf['db_new_link'];
+		$this->dbClientFlags = $conf['db_client_flags'];
 		//$this->connect();
 	}
 
@@ -69,7 +73,7 @@
 	public function connect()
 	{
 		if($this->linkId == 0){
-			$this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass);
+			$this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbNewLink, $this->dbClientFlags);
 			if(!$this->linkId){
 				$this->updateError('DB::connect()<br />mysql_connect');
 				return false;
diff --git a/interface/lib/config.inc.php b/interface/lib/config.inc.php
index 0aa84a4..fc94da8 100644
--- a/interface/lib/config.inc.php
+++ b/interface/lib/config.inc.php
@@ -54,6 +54,8 @@
 $conf['db_user'] = 'root';
 $conf['db_password'] = '';
 $conf['db_charset'] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL: "utf-8" --> "utf8", "iso-8859-1" --> "latin1")
+$conf['db_new_link'] = false;
+$conf['db_client_flags'] = 0;
 
 define('DB_TYPE',$conf['db_type']);
 define('DB_HOST',$conf['db_host']);
@@ -69,6 +71,8 @@
 $conf['dbmaster_database']		= '{mysql_master_server_database}';
 $conf['dbmaster_user']			= '{mysql_master_server_ispconfig_user}';
 $conf['dbmaster_password']		= '{mysql_master_server_ispconfig_password}';
+$conf['dbmaster_new_link'] 		= false;
+$conf['dbmaster_client_flags']  = 0;
 
 
 //** Paths
diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index 7e0c561..3060bab 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -34,6 +34,8 @@
 		var $dbUser = '';		// database authorized user
 		var $dbPass = '';		// user's password
 		var $dbCharset = 'utf8';// Database charset
+		var $dbNewLink = false; // Return a new linkID when connect is called again
+		var $dbClientFlags = 0; // MySQL Client falgs
 		var $linkId = 0;		// last result of mysql_connect()
 		var $queryId = 0;		// last result of mysql_query()
 		var $record	= array();	// last record fetched
@@ -53,6 +55,8 @@
 			$this->dbUser = $conf['db_user'];
 			$this->dbPass = $conf['db_password'];
 			$this->dbCharset = $conf['db_charset'];
+			$this->dbNewLink = $conf['db_new_link'];
+			$this->dbClientFlags = $conf['db_client_flags'];
 			//$this->connect();
 		}
 		
@@ -79,7 +83,7 @@
 		{
 			if($this->linkId == 0)
 			{
-				$this->linkId = @mysql_connect($this->dbHost, $this->dbUser, $this->dbPass);
+				$this->linkId = @mysql_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbNewLink, $this->dbClientFlags);
 				if(!$this->linkId)
 				{
 					$this->updateError('DB::connect()-> mysql_connect');

--
Gitblit v1.9.1