summaryrefslogtreecommitdiff
path: root/app/php/components/SafeFileUpload.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-04-25 11:40:28 +0200
committeremkael <emkael@tlen.pl>2016-04-25 11:40:28 +0200
commit050c6cfd0e75249ae7b7dad3f8ec6eed6be50102 (patch)
treedb6076f9edeccf9c2a867e87a42ff6f756f1603c /app/php/components/SafeFileUpload.php
parentdd5aaa4db1e8758652586aa82f21bf631ce20bcc (diff)
* separating safer file upload trait to its own file
Diffstat (limited to 'app/php/components/SafeFileUpload.php')
-rw-r--r--app/php/components/SafeFileUpload.php33
1 files changed, 3 insertions, 30 deletions
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 @@
<?php
-class SafeFileUpload extends TFileUpload {
-
- use MimeTypeCheckForFileUpload;
-
-}
-
-trait MimeTypeCheckForFileUpload {
+Prado::using('Application.components.SafeFileUploadMethods');
- protected $_isSecure = TRUE;
-
- public function getIsSecure() {
- return $this->_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;
}