From d24dcda982d7fb37c8371fa227f4dbb1868f707d Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 4 Sep 2012 15:10:45 +0200 Subject: [PATCH] Merged fix from beta branch in function_db.php DB_RemoveBadChars function supports arrays now, this caused invisible notice errors. --- src/include/functions_db.php | 40 ++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/include/functions_db.php b/src/include/functions_db.php index 5c48363..75de56e 100644 --- a/src/include/functions_db.php +++ b/src/include/functions_db.php @@ -257,17 +257,41 @@ function DB_RemoveParserSpecialBadChars($myString) return $returnstr; } -function DB_RemoveBadChars($myString, $dbEngine = DB_MYSQL, $bForceStripSlahes = false) +function DB_RemoveBadChars($myValue, $dbEngine = DB_MYSQL, $bForceStripSlahes = false) { - if ( $dbEngine == DB_MSSQL ) - { - // MSSQL needs special treatment -.- - return str_replace("'","''",$myString); + // Check if Array + if ( is_array($myValue) ) + { // Array value + $retArray = array(); + foreach( $myValue as $mykey => $myString ) + { + if ( $dbEngine == DB_MSSQL ) + { + // MSSQL needs special treatment -.- + $retArray[$mykey] = str_replace("'","''",$myString); + } + else + { + // Replace with internal PHP Functions! + $retArray[$mykey] = addslashes($myString); + } + } + + // Return fixed array! + return $retArray; } else - { - // Replace with internal PHP Functions! - return addslashes($myString); + { // Single value + if ( $dbEngine == DB_MSSQL ) + { + // MSSQL needs special treatment -.- + return str_replace("'","''",$myValue); + } + else + { + // Replace with internal PHP Functions! + return addslashes($myValue); + } } }