diff --git a/core/model/fieldtypes/Boolean.php b/core/model/fieldtypes/Boolean.php index 56ee72e9f..b8ff85d3b 100644 --- a/core/model/fieldtypes/Boolean.php +++ b/core/model/fieldtypes/Boolean.php @@ -57,10 +57,14 @@ class Boolean extends DBField { * If necessary, this should include quotes. */ function prepValueForDB($value) { - if($value && strtolower($value) != 'f') { - return "'1'"; - } else { - return "'0'"; + if(strpos($value, '[')!==false) + return addslashes($value); + else { + if($value && strtolower($value) != 'f') { + return "'1'"; + } else { + return "'0'"; + } } } diff --git a/core/model/fieldtypes/Decimal.php b/core/model/fieldtypes/Decimal.php index 51123cad6..9c40edce2 100644 --- a/core/model/fieldtypes/Decimal.php +++ b/core/model/fieldtypes/Decimal.php @@ -55,7 +55,10 @@ class Decimal extends DBField { if($value === true) { return 1; } if(!$value || !is_numeric($value)) { - return "0"; + if(strpos($value, '[')===false) + return '0'; + else + return addslashes($value); } else { return addslashes($value); } diff --git a/core/model/fieldtypes/Float.php b/core/model/fieldtypes/Float.php index b2552ef58..c6035bd00 100644 --- a/core/model/fieldtypes/Float.php +++ b/core/model/fieldtypes/Float.php @@ -36,7 +36,10 @@ class Float extends DBField { if($value === true) { return 1; } if(!$value || !is_numeric($value)) { - return "0"; + if(strpos($value, '[')===false) + return '0'; + else + return addslashes($value); } else { return addslashes($value); } diff --git a/core/model/fieldtypes/Int.php b/core/model/fieldtypes/Int.php index d740c82b9..70c6ce19d 100644 --- a/core/model/fieldtypes/Int.php +++ b/core/model/fieldtypes/Int.php @@ -50,7 +50,10 @@ class Int extends DBField { if($value === true) { return 1; } if(!$value || !is_numeric($value)) { - return "0"; + if(strpos($value, '[')===false) + return '0'; + else + return addslashes($value); } else { return addslashes($value); }