| @@ 186-197 (lines=12) @@ | ||
| 183 | return $file; |
|
| 184 | } |
|
| 185 | ||
| 186 | public function get() |
|
| 187 | { |
|
| 188 | $file_name = isset($_REQUEST['file']) ? basename(stripslashes($_REQUEST['file'])) : null; |
|
| 189 | if (null !== $file_name) { |
|
| 190 | $info = $this->get_file_object($file_name); |
|
| 191 | } else { |
|
| 192 | $info = array_values(array_filter(array_map([$this, 'get_file_object'], scandir($this->upload_dir, SCANDIR_SORT_NONE)))); |
|
| 193 | } |
|
| 194 | header('Cache-Control: no-cache, must-revalidate'); |
|
| 195 | header('Content-type: application/json'); |
|
| 196 | echo json_encode($info); |
|
| 197 | } |
|
| 198 | ||
| 199 | public function post() |
|
| 200 | { |
|
| @@ 176-187 (lines=12) @@ | ||
| 173 | return $file; |
|
| 174 | } |
|
| 175 | ||
| 176 | public function get() |
|
| 177 | { |
|
| 178 | $file_name = isset($_REQUEST['file']) ? basename(stripslashes($_REQUEST['file'])) : null; |
|
| 179 | if ($file_name) { |
|
| 180 | $info = $this->get_file_object($file_name); |
|
| 181 | } else { |
|
| 182 | $info = array_values(array_filter(array_map([$this, 'get_file_object'], scandir($this->upload_dir, SCANDIR_SORT_NONE)))); |
|
| 183 | } |
|
| 184 | header('Cache-Control: no-cache, must-revalidate'); |
|
| 185 | header('Content-type: application/json'); |
|
| 186 | echo json_encode($info); |
|
| 187 | } |
|
| 188 | ||
| 189 | public function post() |
|
| 190 | { |
|