Solved problem with magic_quotes_pgc and xajax request with depth greater 1

This commit is contained in:
Andreas Stöckel 2010-06-10 12:36:27 +00:00
parent aa6f617322
commit 522b9884c3
2 changed files with 23 additions and 11 deletions

View File

@ -14,6 +14,25 @@
* @version $Id$
*/
/**
* 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) ? array_stripslashes($val) : stripslashes($val);
}
return $var;
}
/**
* Return the number of bytes of a string, independent of mbstring.func_overload
* AND the availability of mbstring

View File

@ -83,17 +83,6 @@ function doXMLHTTP()
$argList = func_get_args();
$arg0 = array_shift($argList);
if(get_magic_quotes_gpc()) {
foreach($argList as $key => $value) {
if(is_array($value)) {
foreach($argList as $key1 => $value1) {
$argList[$key][$key1] = stripslashes($value1);
}
} else {
$argList[$key] = stripslashes($value);
}
}
}
//error_log("xajax_doXMLHTTP('$arg0',...)".print_r($argList,true));
if (strpos($arg0,'::') !== false && strpos($arg0,'.') === false) // static method name app_something::method
@ -119,6 +108,10 @@ function doXMLHTTP()
);
include('./header.inc.php');
if(get_magic_quotes_gpc()) {
$argList = array_stripslashes($argList);
}
// now the header is included, we can set the charset
$GLOBALS['xajax']->configure('characterEncoding',translation::charset());
define('XAJAX_DEFAULT_CHAR_ENCODING',translation::charset());