mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-02-13 03:23:34 +00:00
Fix the SetConnection() method.
This commit is contained in:
parent
1467801345
commit
356fbb03ea
@ -238,15 +238,15 @@ class AwlQuery
|
||||
* @param resource $new_connection The database connection to use.
|
||||
*/
|
||||
function SetConnection( $new_connection, $options = null ) {
|
||||
if ( is_string($new_connection) ) {
|
||||
if ( is_string($new_connection) || is_array($new_connection) ) {
|
||||
$dbuser = null;
|
||||
$dbpass = null;
|
||||
if ( is_array($v) ) {
|
||||
$dsn = $v['dsn'];
|
||||
if ( isset($v['dbuser']) ) $dbuser = $v['dbuser'];
|
||||
if ( isset($v['dbpass']) ) $dbpass = $v['dbpass'];
|
||||
if ( is_array($new_connection) ) {
|
||||
$dsn = $new_connection['dsn'];
|
||||
if ( isset($new_connection['dbuser']) ) $dbuser = $new_connection['dbuser'];
|
||||
if ( isset($new_connection['dbpass']) ) $dbpass = $new_connection['dbpass'];
|
||||
}
|
||||
elseif ( preg_match( '/^(\S+:)?(.*)( user=(\S+))?( password=(\S+))?$/', $v, $matches ) ) {
|
||||
elseif ( preg_match( '/^(\S+:)?(.*)( user=(\S+))?( password=(\S+))?$/', $new_connection, $matches ) ) {
|
||||
$dsn = $matches[2];
|
||||
if ( isset($matches[1]) && $matches[1] != '' ) {
|
||||
$dsn = $matches[1] . $dsn;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user