Merged fix from beta branch in function_db.php

DB_RemoveBadChars function supports arrays now, this caused invisible notice errors.
This commit is contained in:
Andre Lorbach 2012-09-04 15:10:45 +02:00
parent 9c127f6752
commit d24dcda982

View File

@ -257,17 +257,41 @@ function DB_RemoveParserSpecialBadChars($myString)
return $returnstr; return $returnstr;
} }
function DB_RemoveBadChars($myString, $dbEngine = DB_MYSQL, $bForceStripSlahes = false) function DB_RemoveBadChars($myValue, $dbEngine = DB_MYSQL, $bForceStripSlahes = false)
{ {
if ( $dbEngine == DB_MSSQL ) // Check if Array
{ if ( is_array($myValue) )
// MSSQL needs special treatment -.- { // Array value
return str_replace("'","''",$myString); $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 else
{ { // Single value
// Replace with internal PHP Functions! if ( $dbEngine == DB_MSSQL )
return addslashes($myString); {
// MSSQL needs special treatment -.-
return str_replace("'","''",$myValue);
}
else
{
// Replace with internal PHP Functions!
return addslashes($myValue);
}
} }
} }