Exemplo n.º 1
0
 public function delete()
 {
     $view = $this->getView();
     $request = $this->getPageRequest();
     // This is a POST-only page.
     if (!$request->isPost()) {
         return View::ERROR_BADREQUEST;
     }
     if (!$this->setAccess('p:/content/manage_all')) {
         return View::ERROR_ACCESSDENIED;
     }
     $m = new ContentModel($request->getParameter(0));
     $link = \Core\resolve_link($m->get('baseurl'));
     if (!$m->exists()) {
         return View::ERROR_NOTFOUND;
     }
     $m->delete();
     \Core\set_message('Removed ' . $m->get('nickname') . ' successfully!', 'success');
     $hist = $request->getReferrer();
     if ($hist == $link) {
         \Core\redirect('/admin/pages');
     } else {
         \Core\go_back();
     }
 }