/** * Method that permits to create a new comment * * @access private */ private function create() { if (VPost::submit() == 'Submit Reply') { $comment = new Comment(); $comment->_name = $this->_user['user_username']; $comment->_email = $this->_user['user_email']; $comment->_content = VPost::comment_content(); $comment->_rel_id = VPost::id(); $comment->_rel_type = VPost::type(); $comment->_status = 'approved'; try { $comment->create(); $this->_action_msg = ActionMessages::reply_comment(true); } catch (Exception $e) { $this->_action_msg = ActionMessages::reply_comment($e->getMessage()); } } }
/** * Create a comment * * @access private */ private function create() { if ($this->check_data()) { try { $class = '\\Library\\Models\\' . ucfirst($this->_data['type']); $el = new $class(); $el->_id = $this->_data['id']; $el->read('_allow_comment'); if ($el->_allow_comment == 'closed') { throw new Exception('Comments are closed!'); } $comment = new MComment(); $comment->_name = $this->_data['name']; $comment->_email = $this->_data['email']; $comment->_content = $this->_data['content']; $comment->_rel_id = $this->_data['id']; $comment->_rel_type = $this->_data['type']; $comment->_status = 'pending'; $comment->create(); $this->_return_msg = array('message' => true); } catch (Exception $e) { $this->_return_msg = array('message' => $e->getMessage()); } } }