/** * Perform filesystem actions before the content is rendered. * * @param String $viewFile */ public function beforeRenderFile($viewFile) { parent::beforeRenderFile($viewFile); if ($this->Auth->user()) { if (isset($this->request->query['delete'])) { if (file_exists(WWW_ROOT . $this->request->query['delete'])) { unlink(WWW_ROOT . $this->request->query['delete']); } } } }