From 5742e4c99f53f9dbbcc962e9f967a4c377c209b9 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Tue, 29 Jul 2014 02:46:41 -0400
Subject: [PATCH] Fixed: FS#3581 - Website unaccessible under some circumstances when using seo redirection *.domain to www.domain (only for apache2, nginx still to do)

---
 server/plugins-available/mysql_clientdb_plugin.inc.php |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/server/plugins-available/mysql_clientdb_plugin.inc.php b/server/plugins-available/mysql_clientdb_plugin.inc.php
index cba977c..6145db0 100644
--- a/server/plugins-available/mysql_clientdb_plugin.inc.php
+++ b/server/plugins-available/mysql_clientdb_plugin.inc.php
@@ -83,7 +83,14 @@
 		if(!is_array($host_list)) $host_list = explode(',', $host_list);
 
 		$success = true;
-
+		if(!preg_match('/\*[A-F0-9]{40}$/', $database_password)) {
+				$result = $link->query("SELECT PASSWORD('" . $link->escape_string($database_password) . "') as `crypted`");
+				if($result) {
+						$row = $result->fetch_assoc();
+						$database_password = $row['crypted'];
+						$result->free();
+				}
+		}
 		// loop through hostlist
 		foreach($host_list as $db_host) {
 			$db_host = trim($db_host);
@@ -270,7 +277,7 @@
 			$old_host_list .= 'localhost';
 
 			// Create the database user if database was disabled before
-			if($data['new']['active'] == 'y' && $data['old']['active'] == 'n') {
+			if($data['new']['active'] == 'y') {
 				if($db_user) {
 					if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
 					else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $host_list, $link);

--
Gitblit v1.9.1