Changeset 418 in svn


Ignore:
Timestamp:
2007-06-20T02:24:41Z (8 years ago)
Author:
Xuefer
Message:

fixed #104, magic quotes compatibility

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/common.php

    r182 r418  
    7575}
    7676
     77function stripaddslashes_array($value, $mqs = false)
     78{
     79    if (is_array($value)) {
     80        foreach($value as $k => $v) {
     81            $value[$k] = stripaddslashes_array($v, $mqs);
     82        }
     83    }
     84    else if(is_string($value)) {
     85        $value = $mqs ? str_replace('\'\'', '\'', $value) : stripslashes($value);
     86    }
     87    return $value;
     88}
     89
    7790error_reporting(E_ALL);
    7891ini_set('display_errors', 'On');
    7992define('REQUEST_TIME', time());
     93
     94if (get_magic_quotes_gpc()) {
     95    $mqs = (bool) ini_get('magic_quotes_sybase');
     96    $_GET = stripaddslashes_array($_GET, $mqs);
     97    $_POST = stripaddslashes_array($_POST, $mqs);
     98    $_REQUEST = stripaddslashes_array($_REQUEST, $mqs);
     99}
     100ini_set('magic_quotes_runtime', '0');
    80101
    81102$charset = "UTF-8";
  • trunk/coverager/common.php

    r393 r418  
    7575}
    7676
     77function stripaddslashes_array($value, $mqs = false)
     78{
     79    if (is_array($value)) {
     80        foreach($value as $k => $v) {
     81            $value[$k] = stripaddslashes_array($v, $mqs);
     82        }
     83    }
     84    else if(is_string($value)) {
     85        $value = $mqs ? str_replace('\'\'', '\'', $value) : stripslashes($value);
     86    }
     87    return $value;
     88}
     89
    7790error_reporting(E_ALL);
    7891ini_set('display_errors', 'On');
    7992define('REQUEST_TIME', time());
     93
     94if (get_magic_quotes_gpc()) {
     95    $mqs = (bool) ini_get('magic_quotes_sybase');
     96    $_GET = stripaddslashes_array($_GET, $mqs);
     97    $_POST = stripaddslashes_array($_POST, $mqs);
     98    $_REQUEST = stripaddslashes_array($_REQUEST, $mqs);
     99}
     100ini_set('magic_quotes_runtime', '0');
    80101
    81102$charset = "UTF-8";
Note: See TracChangeset for help on using the changeset viewer.