fix for bug #221: config (admin.uiconfig) is not saved properly, if magic_quotes_gpc is on

This commit is contained in:
Ralf Becker 2006-12-29 07:08:47 +00:00
parent 4c1b672b72
commit 6a0f1b67d3

View File

@ -45,7 +45,7 @@
if(get_magic_quotes_gpc() && is_array($_POST['newsettings']))
{
$_POST['newsettings'] = array_map("stripslashes", $_POST['newsettings']);
$_POST['newsettings'] = $this->array_stripslashes($_POST['newsettings']);
}
switch($_GET['appname'])
@ -250,5 +250,24 @@
$t->set_var('lang_cancel', lang('Cancel'));
$t->pfp('out','footer');
}
/**
* applies stripslashes recursivly on each element of an array
*
* @param array &$var
* @return array
*/
function array_stripslashes($var)
{
if (!is_array($var))
{
return stripslashes($var);
}
foreach($var as $key => $val)
{
$var[$key] = is_array($val) ? $this->array_stripslashes($val) : stripslashes($val);
}
return $var;
}
}
?>