public function advDel() { $p = 1; if (isset($this->params['form']['p'])) { $p = $this->params['form']['p']; } if (!isset($this->params['form']['aid'])) { $this->redirect("/adv/{$this->_type}?p={$p}"); } $aid = $this->params['form']['aid']; $adv = new Adv(); $adv->type = $this->_type; $file = $adv->delete($aid); @unlink(WWW_ROOT . Configure::read('adv.path') . DS . $file); $this->redirect("/adv/{$this->_type}?p={$p}"); }