From 050c6cfd0e75249ae7b7dad3f8ec6eed6be50102 Mon Sep 17 00:00:00 2001 From: emkael Date: Mon, 25 Apr 2016 11:40:28 +0200 Subject: * separating safer file upload trait to its own file --- app/php/components/SafeFileUpload.php | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) (limited to 'app/php/components/SafeFileUpload.php') diff --git a/app/php/components/SafeFileUpload.php b/app/php/components/SafeFileUpload.php index ea65d22..dcc81a0 100644 --- a/app/php/components/SafeFileUpload.php +++ b/app/php/components/SafeFileUpload.php @@ -1,37 +1,10 @@ _isSecure; - } - - public function setIsSecure($bool) { - $this->_isSecure = $bool; - } - - public function getFileType() { - if ($this->getIsSecure()) { - $fileInfo = new finfo(FILEINFO_MIME_TYPE); - return $fileInfo->file($this->getLocalName()); - } - return parent::getFileType(); - } +class SafeFileUpload extends TFileUpload { - public function getFileSize() { - if ($this->getIsSecure()) { - return filesize($this->getLocalName()); - } - return parent::getFileSize(); - } + use SafeFileUploadMethods; } -- cgit v1.2.3