2
0
forked from Wavyzz/dolibarr

Fix: addslashes for data with quotes

This commit is contained in:
Regis Houssin
2009-09-15 20:56:35 +00:00
parent c825413f87
commit 6f35dd1b17
2 changed files with 5 additions and 5 deletions

View File

@@ -694,15 +694,15 @@ class DoliDb
{ {
if ($cryptType == 2) if ($cryptType == 2)
{ {
$return = 'AES_ENCRYPT('.($withQuotes?"'":"").$fieldorvalue.($withQuotes?"'":"").',\''.$cryptKey.'\')'; $return = 'AES_ENCRYPT('.($withQuotes?"'":"").addslashes($fieldorvalue).($withQuotes?"'":"").',\''.$cryptKey.'\')';
} }
else if ($cryptType == 1) else if ($cryptType == 1)
{ {
$return = 'DES_ENCRYPT('.($withQuotes?"'":"").$fieldorvalue.($withQuotes?"'":"").',\''.$cryptKey.'\')'; $return = 'DES_ENCRYPT('.($withQuotes?"'":"").addslashes($fieldorvalue).($withQuotes?"'":"").',\''.$cryptKey.'\')';
} }
} }
return ($withQuotes?"'":"").$return.($withQuotes?"'":""); return $return;
} }
/** /**

View File

@@ -704,11 +704,11 @@ class DoliDb
{ {
if ($cryptType == 2) if ($cryptType == 2)
{ {
$return = 'AES_ENCRYPT('.($withQuotes?"'":"").$fieldorvalue.($withQuotes?"'":"").',\''.$cryptKey.'\')'; $return = 'AES_ENCRYPT('.($withQuotes?"'":"").addslashes($fieldorvalue).($withQuotes?"'":"").',\''.$cryptKey.'\')';
} }
else if ($cryptType == 1) else if ($cryptType == 1)
{ {
$return = 'DES_ENCRYPT('.($withQuotes?"'":"").$fieldorvalue.($withQuotes?"'":"").',\''.$cryptKey.'\')'; $return = 'DES_ENCRYPT('.($withQuotes?"'":"").addslashes($fieldorvalue).($withQuotes?"'":"").',\''.$cryptKey.'\')';
} }
} }