/** * Rebuild Files array. * Output structure is FILES[string pool][int][name,type,tmp_name,error,size]. * * @param array $file_post * @return array */ private static function rebuildFiles(&$files) { $r = array(); $reChars = '/^[' . self::CHARS . ']*+\\z/u'; for ($i = 0; $i < count($files["name"]); $i++) { if (empty($files["name"][$i])) { continue; } $name = $files["name"][$i]; if (get_magic_quotes_gpc()) { $name = Strings::stripslashes($name); } if (!self::$binary && is_string($name) && (!preg_match($reChars, $name) || preg_last_error())) { $name = "renamed"; } $r[$i]["name"] = $name; $r[$i]["type"] = $files["type"][$i]; $r[$i]["tmp_name"] = $files["tmp_name"][$i]; $r[$i]["error"] = $files["error"][$i]; $r[$i]["size"] = $files["size"][$i]; } return $r; }
/** * Parses query string. * * @param string $s * @return array */ public static function parseQuery($s) { parse_str($s, $res); if (get_magic_quotes_gpc()) { // for PHP 5.3 $res = Strings::stripSlashes($res); } return $res; }