Пример #1
0
 function postContent()
 {
     $this->createGatekeeper();
     $new = false;
     if (!empty($this->arguments)) {
         $object = \IdnoPlugins\Review\Review::getByID($this->arguments[0]);
     }
     if (empty($object)) {
         $object = new \IdnoPlugins\Review\Review();
     }
     if ($object->saveDataFromInput($this)) {
         (new \Idno\Core\Autosave())->clearContext('review');
         $forward = $this->getInput('forward-to', $object->getDisplayURL());
         $this->forward($forward);
     }
 }
Пример #2
0
 function postContent()
 {
     $this->createGatekeeper();
     if (!empty($this->arguments)) {
         $object = \IdnoPlugins\Review\Review::getByID($this->arguments[0]);
     }
     if (empty($object)) {
         $this->forward();
     }
     if (!$object->canEdit()) {
         $this->setResponse(403);
         \Idno\Core\site()->session()->addErrorMessage("You don't have permission to perform this task.");
         $this->forward();
     }
     if ($object->delete()) {
         \Idno\Core\site()->session()->addMessage($object->getTitle() . ' was deleted.');
     } else {
         \Idno\Core\site()->session()->addErrorMessage("We couldn't delete " . $object->getTitle() . ".");
     }
     $this->forward($_SERVER['HTTP_REFERER']);
 }