/** * 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 $row = new \Plugins\Hubzero\Comments\Models\Comment($comment['id']); // pass data to comment object if (!$row->bind($comment)) { App::redirect($this->url, $row->getError(), 'error'); return; } $row->set('uploadDir', $this->params->get('comments_uploadpath', '/site/comments')); $row->set('created', Date::toSql()); if ($row->exists() && !$this->params->get('access-edit-comment')) { App::redirect(Route::url('index.php?option=com_users&view=login&return=' . base64_encode($this->url)), Lang::txt('PLG_HUBZERO_COMMENTS_NOTAUTH'), 'warning'); return; } // Store new content if (!$row->store(true)) { $key = 'failed_comment'; $value = $row->content('raw'); User::setState($key, $value); App::redirect($this->url, $row->getError(), 'error'); return; } App::redirect($this->url, Lang::txt('PLG_HUBZERO_COMMENTS_SAVED'), 'message'); }
?> </time></span> <span class="comment-date-on"><?php echo Lang::txt('COM_ANSWERS_ON'); ?> </span> <span class="date"><time datetime="<?php echo $reply->created(); ?> "><?php echo $reply->created('date'); ?> </time></span> </p> <p><?php echo $reply->content('clean', 300); ?> </p> </blockquote> <?php } } ?> <label for="commentcontent"> <?php echo Lang::txt('PLG_HUBZERO_COMMENTS_YOUR_COMMENTS'); ?> : <?php if (!User::isGuest()) { echo $this->editor('comment[content]', $this->escape($comment->content('raw')), 35, 15, 'commentcontent', array('class' => 'minimal no-footer'));