Beispiel #1
0
 /**
  * 从数组中获取某个键的值
  * fetch() 方法调用
  * @access  private
  * @param   array
  * @param   string
  * @param   string
  * @param   bool
  * @return  string
  */
 private static function fetchFromArray(&$array, $index = '', $default = '', $xss_clean = FALSE)
 {
     if (!isset($array[$index])) {
         return $default;
     }
     if ($xss_clean === TRUE) {
         return Secure::xssClean($array[$index]);
     }
     return $array[$index];
 }
Beispiel #2
0
 /**
  * 处理输入的值
  * sanitizeGlobals() 方法调用
  * @access   private
  * @param    string
  * @return   string
  */
 private function cleanInputData($str)
 {
     if (is_array($str)) {
         $new_array = array();
         foreach ($str as $key => $val) {
             $new_array[$this->cleanInputKeys($key)] = $this->cleanInputData($val);
         }
         return $new_array;
     }
     if (!is_php_version('5.4') && get_magic_quotes_gpc()) {
         $str = stripslashes($str);
     }
     // 移除不可见字符
     $str = remove_invisible_characters($str);
     // 移除xss字符
     if ($this->enableXss === TRUE) {
         $str = Secure::xssClean($str);
     }
     // 替换换行符为当前系统换行符
     if ($this->standardizeNewlines == TRUE) {
         if (strpos($str, "\r") !== FALSE) {
             $str = str_replace(array("\r\n", "\r", "\r\n\n"), PHP_EOL, $str);
         }
     }
     return $str;
 }