示例#1
0
 /**
  * Removes slashes in superglobal gpc data arrays if 'magic quotes gpc' is enabled.
  */
 protected function initMagicQuotes()
 {
     if (function_exists('get_magic_quotes_gpc')) {
         if (@get_magic_quotes_gpc()) {
             if (!empty($_REQUEST)) {
                 $_REQUEST = ArrayUtil::stripslashes($_REQUEST);
             }
             if (!empty($_POST)) {
                 $_POST = ArrayUtil::stripslashes($_POST);
             }
             if (!empty($_GET)) {
                 $_GET = ArrayUtil::stripslashes($_GET);
             }
             if (!empty($_COOKIE)) {
                 $_COOKIE = ArrayUtil::stripslashes($_COOKIE);
             }
             if (!empty($_FILES)) {
                 foreach ($_FILES as $name => $attributes) {
                     foreach ($attributes as $key => $value) {
                         if ($key != 'tmp_name') {
                             $_FILES[$name][$key] = ArrayUtil::stripslashes($value);
                         }
                     }
                 }
             }
         }
     }
     if (function_exists('set_magic_quotes_runtime')) {
         @set_magic_quotes_runtime(0);
     }
 }