This commit is contained in:
Simon Sessingø
2016-11-28 04:20:34 +01:00
parent 74351e0330
commit d9b97ccf42
10 changed files with 74 additions and 132 deletions
+7 -7
View File
@@ -51,18 +51,17 @@ class Input
}
/* Parse get requests */
$this->file = $this->parseFiles();
if (count($_FILES) > 0) {
$this->file = $this->parseFiles();
}
}
public function parseFiles()
{
if (count($_FILES) === 0) {
return [];
}
$files = $_FILES;
$list = [];
foreach ($_FILES as $key => $value) {
foreach ($files as $key => $value) {
// Handle array input
if (is_array($value['name']) === false) {
@@ -95,7 +94,8 @@ class Input
$path = $original[$property];
foreach (array_values($index) as $i) {
$tmp = array_values($index);
foreach ($tmp as $i) {
$path = $path[$i];
}
+2 -3
View File
@@ -42,14 +42,13 @@ class InputFile implements IInputItem
'error' => null,
], $values);
$input = new static($values['index']);
$input->setError($values['error'])
return (new static($values['index']))
->setError($values['error'])
->setSize($values['size'])
->setType($values['type'])
->setTmpName($values['tmp_name'])
->setFilename($values['name']);
return $input;
}
/**
@@ -58,7 +58,7 @@ class BaseCsrfVerifier implements IMiddleware
public function handle(Request $request, ILoadableRoute &$route = null)
{
if ($this->skip($request) === false && in_array($request->getMethod(), ['post', 'put', 'delete']) === true) {
if ($this->skip($request) === false && in_array($request->getMethod(), ['post', 'put', 'delete'], false) === true) {
$token = $request->getInput()->get(static::POST_KEY, null, 'post');
+1 -1
View File
@@ -215,7 +215,7 @@ class Request
public function __isset($name)
{
return $this->data[$name] ?? null;
return array_key_exists($name, $this->data);
}
public function __set($name, $value = null)