DB_RemoveBadChars function supports arrays now, this caused invisible notice errors.

This commit is contained in:
Andre Lorbach 2012-08-21 16:35:23 +02:00
parent 866c3ab7f4
commit a77add0976

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);
}
} }
} }