summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-09-23 20:59:21 -0400
committerFrederic Guillot <fred@kanboard.net>2015-09-23 20:59:21 -0400
commit25b9e90ef3b6018f898047be025ad859fcbbd96a (patch)
treee2ad3195735200d7bf092733c8020a1249a22eac /app/Controller
parent2af45250c46b431823a9bfaa28e393c70fb931d8 (diff)
Do not check anymore data folder permissions
People who are using a remote database (Mysql/Postgresql) and a remote file storage (Aws S3 or similar) don't necessary needs to have a persistent local data folder or to change the permissions.
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/File.php62
1 files changed, 41 insertions, 21 deletions
diff --git a/app/Controller/File.php b/app/Controller/File.php
index 7b7c75ee..1431372f 100644
--- a/app/Controller/File.php
+++ b/app/Controller/File.php
@@ -2,6 +2,8 @@
namespace Controller;
+use Core\ObjectStorage\ObjectStorageException;
+
/**
* File controller
*
@@ -74,15 +76,21 @@ class File extends Base
*/
public function download()
{
- $task = $this->getTask();
- $file = $this->file->getById($this->request->getIntegerParam('file_id'));
+ try {
- if ($file['task_id'] != $task['id']) {
- $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
- }
+ $task = $this->getTask();
+ $file = $this->file->getById($this->request->getIntegerParam('file_id'));
+
+ if ($file['task_id'] != $task['id']) {
+ $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
+ }
- $this->response->forceDownload($file['name']);
- $this->objectStorage->passthru($file['path']);
+ $this->response->forceDownload($file['name']);
+ $this->objectStorage->passthru($file['path']);
+ }
+ catch (ObjectStorageException $e) {
+ $this->logger->error($e->getMessage());
+ }
}
/**
@@ -110,15 +118,21 @@ class File extends Base
*/
public function image()
{
- $task = $this->getTask();
- $file = $this->file->getById($this->request->getIntegerParam('file_id'));
+ try {
- if ($file['task_id'] != $task['id']) {
- $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
- }
+ $task = $this->getTask();
+ $file = $this->file->getById($this->request->getIntegerParam('file_id'));
- $this->response->contentType($this->file->getImageMimeType($file['name']));
- $this->objectStorage->passthru($file['path']);
+ if ($file['task_id'] != $task['id']) {
+ $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
+ }
+
+ $this->response->contentType($this->file->getImageMimeType($file['name']));
+ $this->objectStorage->passthru($file['path']);
+ }
+ catch (ObjectStorageException $e) {
+ $this->logger->error($e->getMessage());
+ }
}
/**
@@ -128,15 +142,21 @@ class File extends Base
*/
public function thumbnail()
{
- $task = $this->getTask();
- $file = $this->file->getById($this->request->getIntegerParam('file_id'));
+ try {
- if ($file['task_id'] != $task['id']) {
- $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
- }
+ $task = $this->getTask();
+ $file = $this->file->getById($this->request->getIntegerParam('file_id'));
+
+ if ($file['task_id'] != $task['id']) {
+ $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
+ }
- $this->response->contentType('image/jpeg');
- $this->objectStorage->passthru($this->file->getThumbnailPath($file['path']));
+ $this->response->contentType('image/jpeg');
+ $this->objectStorage->passthru($this->file->getThumbnailPath($file['path']));
+ }
+ catch (ObjectStorageException $e) {
+ $this->logger->error($e->getMessage());
+ }
}
/**