diff --git a/src/content-controllers/text/text.controller.php b/src/content-controllers/text/text.controller.php index 22dd125..3feccea 100644 --- a/src/content-controllers/text/text.controller.php +++ b/src/content-controllers/text/text.controller.php @@ -3,6 +3,12 @@ class TextController implements ContentController { public const ctype = 'static'; + + public $mimes = [ + 'text/plain', + 'text/csv', + 'text/tab-separated-values', + ]; //returns all extensions registered by this type of content public function getRegisteredExtensions(){return array('txt','text','csv');} diff --git a/src/inc/api.class.php b/src/inc/api.class.php index f47a0a4..a85e0e4 100644 --- a/src/inc/api.class.php +++ b/src/inc/api.class.php @@ -75,7 +75,10 @@ class API //check naughty list (previously deleted files) if ($this->isFileInNaughtyList($sha1)) + { + addToLog(getUserIP()." tried to upload a file with the SHA1: ".$sha1." (".$type.", original name:".$_FILES['file']['name'].") but it was previously deleted and therefore on the naughty list"); return ['status' => 'err', 'reason' => 'File is in the naughty list']; + } $answer = false; foreach(loadAllContentControllers() as $cc) @@ -89,7 +92,10 @@ class API } if (!$answer) + { + addToLog(getUserIP()." tried to upload a file with the SHA1: ".$sha1." (".$type.", original name:".$_FILES['file']['name'].") but the file type is not supported"); return ['status' => 'err', 'reason' => 'Unsupported mime type: ' . $type]; + } else if($answer['hash'] && $answer['status']=='ok'){ $delcode = getRandomString(32); $meta = [ @@ -124,9 +130,16 @@ class API ]; } else + { + addToLog(getUserIP()." tried to upload a file with the SHA1: ".$sha1." (".$type.", original name:".$_FILES['file']['name'].") but the upload failed. Probably in the handleUpload method of the content controller ".get_class($cc)); return ['status' => 'err', 'reason' => 'Strange error during upload']; + } } else + { + addToLog(getUserIP()." tried to upload a file with the SHA1: ".$_FILES['file']['name']." (".$_FILES['file']['type'].") but the upload failed with error code: ".$_FILES['file']["error"]." (".$this->uploadErrorMessage($_FILES['file']["error"]).")"); return ['status' => 'err', 'reason' => 'Upload error: '.$this->uploadErrorMessage($_FILES['file']["error"])]; + } + } diff --git a/src/templates/video.html.php b/src/templates/video.html.php index f096c1f..c1971af 100644 --- a/src/templates/video.html.php +++ b/src/templates/video.html.php @@ -1,45 +1,45 @@
-