Exemple #1
0
/**
 * check php configuration for magic quotes and adjust mixed data by current setting
 *
 * @param mixed $mixed
 * @return mixed with adjusted data
 */
function stripMagicQuotes($mixed)
{
    if (is_array($mixed)) {
        foreach ($mixed as $key => $val) {
            $mixed[$key] = stripMagicQuotes($val);
        }
    } else {
        if (get_magic_quotes_gpc()) {
            $mixed = stripslashes($mixed);
        }
    }
    return $mixed;
}
Exemple #2
0
/**
 * Checking magic quotes settings and prepare GPRC data
 */
function checkMagicQuotes()
{
    if (get_magic_quotes_gpc()) {
        if (!empty($_GET)) {
            $_GET = stripMagicQuotes($_GET);
        }
        if (!empty($_POST)) {
            $_POST = stripMagicQuotes($_POST);
        }
        if (!empty($_REQUEST)) {
            $_REQUEST = stripMagicQuotes($_REQUEST);
        }
        if (!empty($_COOKIE)) {
            $_COOKIE = stripMagicQuotes($_COOKIE);
        }
    }
}
Exemple #3
0
 function stripMagicQuotes($arr)
 {
     if (is_array($arr)) {
         foreach ($arr as $k => $v) {
             $arr[$k] = is_array($v) ? stripMagicQuotes($v) : stripslashes($v);
         }
     }
     return $arr;
 }