| 193 | | $prohibited_filepath_tokens = "/^[\.\/\\\]/"; |
| 194 | | if(preg_match($prohibited_filepath_tokens, $file) || |
| 195 | | preg_match($prohibited_filepath_tokens, $file_to_delete)) |
| 196 | | { |
| 197 | | $this->Redirect($this->Href(), T_("Sorry, files of this type are not allowed.")); |
| 198 | | } |
| | 194 | |
| | 195 | $fileregex = "/^.*?([^\.\/\\\]+\.[A-Za-z0-9]{2,4})$/"; |
| | 196 | if(isset($_GET['file'])) |
| | 197 | { |
| | 198 | $matches = ''; |
| | 199 | preg_match($fileregex, $file, $matches); |
| | 200 | if(isset($matches[1])) |
| | 201 | $file = $matches[1]; |
| | 202 | else |
| | 203 | $this->Redirect('', T_("Invalid filename")); |
| | 204 | } |
| | 205 | if(isset($_POST['file_to_delete'])) |
| | 206 | { |
| | 207 | $matches = ''; |
| | 208 | preg_match($fileregex, $file_to_delete, $matches); |
| | 209 | if(isset($matches[1])) |
| | 210 | $file_to_delete = $matches[1]; |
| | 211 | else |
| | 212 | $this->Redirect('', T_("Invalid filename")); |
| | 213 | } |
| | 214 | |