Ejemplo n.º 1
0
 /**
  * Mark a comment as deleted
  * NOTE: Does not actually delete data. Simply marks record.
  *
  * @return    void
  */
 protected function _delete()
 {
     // Ensure the user is logged in
     if (User::isGuest()) {
         return $this->_login();
     }
     // Incoming
     $id = Request::getInt('comment', 0);
     if (!$id) {
         return $this->_redirect();
     }
     // Initiate a blog comment object
     $comment = new \Plugins\Hubzero\Comments\Models\Comment($id);
     if (User::get('id') != $comment->get('created_by') && !$this->params->get('access-delete-comment')) {
         App::redirect($this->url);
         return;
     }
     $comment->set('state', 2);
     // Delete the entry itself
     if (!$comment->store()) {
         $this->setError($comment->getError());
     }
     App::redirect($this->url, Lang::txt('PLG_HUBZERO_COMMENTS_REMOVED'), 'message');
 }
Ejemplo n.º 2
0
						<p class="comment-member-photo">
							<?php 
        $edit = 0;
        // Make sure editing capaibilites are available before even accepting an ID to edit
        if ($this->params->get('access-edit-comment') || $this->params->get('access-manage-comment')) {
            $edit = Request::getInt('commentedit', 0);
        }
        // Load the comment
        $comment = new \Plugins\Hubzero\Comments\Models\Comment($edit);
        // If the comment exists and the editor is NOT the creator and the editor is NOT a manager...
        if ($comment->exists() && $comment->get('created_by') != User::get('id') && !$this->params->get('access-manage-comment')) {
            // Disallow editing
            $comment = new \Plugins\Hubzero\Comments\Models\Comment(0);
        }
        if (!$comment->exists()) {
            $comment->set('parent', Request::getInt('commentreply', 0));
            $comment->set('created_by', !User::isGuest() ? User::get('id') : 0);
            $comment->set('anonymous', !User::isGuest() ? 0 : 1);
        }
        ?>
							<img src="<?php 
        echo $comment->creator()->getPicture($comment->get('anonymous'));
        ?>
" alt="" />
						</p>
						<fieldset>
							<?php 
        if (!User::isGuest()) {
            if ($replyto = Request::getInt('commentreply', 0)) {
                $reply = new \Plugins\Hubzero\Comments\Models\Comment($replyto);
                $name = Lang::txt('COM_KB_ANONYMOUS');