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;
}
function DB_RemoveBadChars($myString, $dbEngine = DB_MYSQL, $bForceStripSlahes = false)
function DB_RemoveBadChars($myValue, $dbEngine = DB_MYSQL, $bForceStripSlahes = false)
{
// Check if Array
if ( is_array($myValue) )
{ // Array value
$retArray = array();
foreach( $myValue as $mykey => $myString )
{
if ( $dbEngine == DB_MSSQL )
{
// MSSQL needs special treatment -.-
return str_replace("'","''",$myString);
$retArray[$mykey] = str_replace("'","''",$myString);
}
else
{
// Replace with internal PHP Functions!
return addslashes($myString);
$retArray[$mykey] = addslashes($myString);
}
}
// Return fixed array!
return $retArray;
}
else
{ // Single value
if ( $dbEngine == DB_MSSQL )
{
// MSSQL needs special treatment -.-
return str_replace("'","''",$myValue);
}
else
{
// Replace with internal PHP Functions!
return addslashes($myValue);
}
}
}