From 2e1d4af13f48e0db06c93eff7d9d6f2ff7e17939 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 16 Dec 2008 11:49:46 -0500
Subject: [PATCH] Added a newline at the end of the master_cf_amavis.master file to prevent debian update problems.

---
 interface/web/sites/database_edit.php |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php
index 4c4afa5..05ef15b 100644
--- a/interface/web/sites/database_edit.php
+++ b/interface/web/sites/database_edit.php
@@ -251,8 +251,9 @@
 
 		if ($app->tform->errorMessage == ''){
 			/* restrict the names if there is no error */
-			$this->dataRecord['database_name'] = $dbname_prefix . $this->dataRecord['database_name'];
-			$this->dataRecord['database_user'] = $dbuser_prefix . $this->dataRecord['database_user'];
+            /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
+			$this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
+			$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
 		}
 
 		parent::onBeforeUpdate();
@@ -268,8 +269,9 @@
 		$dbuser_prefix = replacePrefix($global_config['dbuser_prefix'], $this->dataRecord);
 
 		/* restrict the names */
-		$this->dataRecord['database_name'] = $dbname_prefix . $this->dataRecord['database_name'];
-		$this->dataRecord['database_user'] = $dbuser_prefix . $this->dataRecord['database_user'];
+        /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
+		$this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
+		$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
 
 		parent::onBeforeInsert();
 	}

--
Gitblit v1.9.1