fix for magic quote fixing inside array keys
darcs-hash:20070819211952-7ad00-a1a321178ef3c5a85b2e422a01eda8066eb10588.gz
This commit is contained in:
parent
1a9ae8e52e
commit
81c54349cd
19
inc/init.php
19
inc/init.php
|
@ -260,11 +260,20 @@ function init_creationmodes(){
|
|||
*/
|
||||
function remove_magic_quotes(&$array) {
|
||||
foreach (array_keys($array) as $key) {
|
||||
if (is_array($array[$key])) {
|
||||
remove_magic_quotes($array[$key]);
|
||||
}else {
|
||||
$array[$key] = stripslashes($array[$key]);
|
||||
}
|
||||
// handle magic quotes in keynames (breaks order)
|
||||
$sk = stripslashes($key);
|
||||
if($sk != $key){
|
||||
$array[$sk] = $array[$key];
|
||||
unset($array[$key]);
|
||||
$key = $sk;
|
||||
}
|
||||
|
||||
// do recursion if needed
|
||||
if (is_array($array[$key])) {
|
||||
remove_magic_quotes($array[$key]);
|
||||
}else {
|
||||
$array[$key] = stripslashes($array[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue