diff options
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Base.php | 16 | ||||
-rw-r--r-- | app/Controller/Board.php | 2 | ||||
-rw-r--r-- | app/Controller/Comment.php | 18 | ||||
-rw-r--r-- | app/Controller/Task.php | 34 |
4 files changed, 51 insertions, 19 deletions
diff --git a/app/Controller/Base.php b/app/Controller/Base.php index f9059d1e..2d7b0c18 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -140,20 +140,28 @@ abstract class Base * Application not found page (404 error) * * @access public + * @param boolean $no_layout Display the layout or not */ - public function notfound() + public function notfound($no_layout = false) { - $this->response->html($this->template->layout('app_notfound', array('title' => t('Page not found')))); + $this->response->html($this->template->layout('app_notfound', array( + 'title' => t('Page not found'), + 'no_layout' => $no_layout, + ))); } /** * Application forbidden page * * @access public + * @param boolean $no_layout Display the layout or not */ - public function forbidden() + public function forbidden($no_layout = false) { - $this->response->html($this->template->layout('app_forbidden', array('title' => t('Access Forbidden')))); + $this->response->html($this->template->layout('app_forbidden', array( + 'title' => t('Access Forbidden'), + 'no_layout' => $no_layout, + ))); } /** diff --git a/app/Controller/Board.php b/app/Controller/Board.php index 4724cae5..71d94a29 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -167,7 +167,7 @@ class Board extends Base // Token verification if (! $project) { - $this->response->text('Not Authorized', 401); + $this->forbidden(true); } // Display the board with a specific layout diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php index a0a11fc8..a9032ed8 100644 --- a/app/Controller/Comment.php +++ b/app/Controller/Comment.php @@ -25,26 +25,16 @@ class Comment extends Base } if (! $this->acl->isAdminUser() && $comment['user_id'] != $this->acl->getUserId()) { - $this->forbidden(); + $this->response->html($this->template->layout('comment_forbidden', array( + 'menu' => 'tasks', + 'title' => t('Access Forbidden') + ))); } return $comment; } /** - * Forbidden page for comments - * - * @access public - */ - public function forbidden() - { - $this->response->html($this->template->layout('comment_forbidden', array( - 'menu' => 'tasks', - 'title' => t('Access Forbidden') - ))); - } - - /** * Add comment form * * @access public diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 7210be5f..97751947 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -47,6 +47,39 @@ class Task extends Base } /** + * Public access (display a task) + * + * @access public + */ + public function readonly() + { + $project = $this->project->getByToken($this->request->getStringParam('token')); + + // Token verification + if (! $project) { + $this->forbidden(true); + } + + $task = $this->task->getById($this->request->getIntegerParam('task_id'), true); + + if (! $task) { + $this->notfound(true); + } + + $this->response->html($this->template->layout('task_public', array( + 'project' => $project, + 'comments' => $this->comment->getAll($task['id']), + 'subtasks' => $this->subTask->getAll($task['id']), + 'task' => $task, + 'columns_list' => $this->board->getColumnsList($task['project_id']), + 'colors_list' => $this->task->getColors(), + 'title' => $task['title'], + 'no_layout' => true, + 'auto_refresh' => true, + ))); + } + + /** * Show a task * * @access public @@ -56,6 +89,7 @@ class Task extends Base $task = $this->getTask(); $this->response->html($this->taskLayout('task_show', array( + 'project' => $this->project->getById($task['project_id']), 'files' => $this->file->getAll($task['id']), 'comments' => $this->comment->getAll($task['id']), 'subtasks' => $this->subTask->getAll($task['id']), |