Ok that does help a bit.
Try this for size:
/**
* Clean up GET request vars
* as well as multidimensional arrays
*/
function scrubster( $nodes ) {
if ( is_array( $nodes ) ) {
foreach( $nodes as $key=>$value ) {
if ( is_array( $value ) ) {
scrubster( $value );
} else {
$nodes = getCleaner( $nodes, TRUE );
$nodes = preg_replace("/[^ a-zA-Z0-9?,=@%:{}\/_.-]/i", "", urldecode( $nodes ) );
$nodes = getCleaner( $nodes, FALSE );
}
}
} else {
$nodes = getCleaner( $nodes, TRUE );
$nodes = preg_replace("/[^ a-zA-Z0-9?,=@%:{}\/_.-]/i", "", urldecode( $nodes ) );
$nodes = getCleaner( $nodes, FALSE );
}
return $nodes;
}
/**
* Called above, this will clean up
* values but not interfere with umlauts
*/
function getCleaner($string, $conv=1) {
$x = md5( $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] .
$_SERVER["HTTP_HOST"] . $_SERVER["DOCUMENT_ROOT"] .
$_SERVER["SERVER_SOFTWARE"] . $_SERVER["PATH"] );
$tolist = explode(",", "ä,ö,ü,Ä,Ö,Ü,€,ß,ä,ä,ü,Ä,Ö,Ü,€,&szlig,ä,ö,ü,Ä,Ö,Ü,€,ß");
$fromlist = explode(",", "ae,oe,ue,Ae,Oe,Ue,euro,szlig,ae,oe,ue,Ae,Oe,Ue,euro,szlig,axe,oxe,uxe,Axe,Oxe,Uxe,euxro,szlxig");
$finlist = explode(",", "ä,ö,ü,Ä,Ö,Ü,€,ß,ä,ö,ü,Ä,Ö,Ü,€,ß,ä,ö,ü,Ä,Ö,Ü,€,ß");
for($wr=0;$wr<=count($tolist);$wr++) {
if ( $conv > 0 ) {
$string = str_replace($tolist[$wr], $x.$fromlist[$wr], $string);
} else {
$string = str_replace($x.$fromlist[$wr], $finlist[$wr], $string);
}
}
return $string;
}
Hopefully this might work. It should work where umlauts are html coded and are in actual form. Where it probably will not work is where you want to display the html encoded umlaut. But that would be rare in osCommerce one would think.
Edited by Taipo, 22 May 2011 - 08:14 AM.