From 4a404f25f20f9449d7777a58fd5ba8effece99fd Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Fri, 20 Jun 2014 18:43:51 +0000 Subject: [PATCH] Expand then limit query string NULL mods to insert statements only. --- resources/functions.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/functions.php b/resources/functions.php index 0a4f99d22c..2cc6d60de6 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -62,8 +62,16 @@ if (!function_exists('check_sql')) { function check_sql($string) { - $string = str_replace("''", "null", $string); - return trim($string); //remove white space + // if insert statement + if (strpos(strtolower(trim($string)), "insert") == 0) { + $string = str_replace(" ''", " null", $string); + $string = str_replace(",''", ",null", $string); + $string = str_replace("'',", "null,", $string); + $string = str_replace("(''", "(null", $string); + $string = str_replace("'')", "null)", $string); + $string = str_replace("'' )", "null )", $string); + } + return trim($string); //remove white space ADD TRIM BACK IN! } }