From 11b92539d6ccc497c9964352f2c548ed0cdc8376 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 16 Sep 2009 08:31:33 +0000 Subject: [PATCH] Fix: encrypt key don't exist in install mode --- htdocs/lib/databases/mysql.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/lib/databases/mysql.lib.php b/htdocs/lib/databases/mysql.lib.php index ba02df7d773..6ce0559ba92 100644 --- a/htdocs/lib/databases/mysql.lib.php +++ b/htdocs/lib/databases/mysql.lib.php @@ -688,17 +688,17 @@ class DoliDb */ function encrypt($fieldorvalue, $cryptType=0, $cryptKey='', $withQuotes=0) { - $return = $fieldorvalue; + $return = ($withQuotes?"'":"").addslashes($fieldorvalue).($withQuotes?"'":""); if ($cryptType && !empty($cryptKey)) { if ($cryptType == 2) { - $return = 'AES_ENCRYPT('.($withQuotes?"'":"").addslashes($fieldorvalue).($withQuotes?"'":"").',\''.$cryptKey.'\')'; + $return = 'AES_ENCRYPT('.$return.',\''.$cryptKey.'\')'; } else if ($cryptType == 1) { - $return = 'DES_ENCRYPT('.($withQuotes?"'":"").addslashes($fieldorvalue).($withQuotes?"'":"").',\''.$cryptKey.'\')'; + $return = 'DES_ENCRYPT('.$return.',\''.$cryptKey.'\')'; } }