/** * Save an entry * * @return void */ protected function _save() { // Ensure the user is logged in if (User::isGuest()) { return $this->_login(); } // Check for request forgeries Request::checkToken(); // Incoming $comment = Request::getVar('comment', array(), 'post', 'none', 2); // Instantiate a new comment object and pass it the data $row = new \Hubzero\Item\Comment($this->database); if (!$row->bind($comment)) { App::redirect($this->url, $row->getError(), 'error'); return; } $row->setUploadDir($this->params->get('comments_uploadpath', '/site/comments')); if ($row->id && !$this->params->get('access-edit-comment')) { App::redirect($this->url, Lang::txt('PLG_COURSES_REVIEWS_NOTAUTH'), 'warning'); return; } // Check content if (!$row->check()) { App::redirect($this->url, $row->getError(), 'error'); return; } // Store new content if (!$row->store()) { App::redirect($this->url, $row->getError(), 'error'); return; } App::redirect($this->url, Lang::txt('PLG_COURSES_REVIEWS_SAVED'), 'message'); }