protected function tearDown() { $this->blog->delete(); $this->article->delete(); }
/** * Delete a blog article */ public function article_delete() { $view = $this->getView(); $request = $this->getPageRequest(); $article = new BlogArticleModel($request->getParameter(0)); if (!$article->exists()) { return View::ERROR_NOTFOUND; } $blog = $article->getLink('Blog'); if (!$blog->exists()) { return View::ERROR_NOTFOUND; } $manager = \Core\user()->checkAccess('p:/blog/manage_all'); $editor = \Core\user()->checkAccess($blog->get('manage_articles_permission ')) || $manager; if (!$editor) { return View::ERROR_ACCESSDENIED; } if (!$request->isPost()) { return View::ERROR_BADREQUEST; } $article->delete(); \Core\go_back(); }