コード例 #1
0
ファイル: ticket_reply.php プロジェクト: ryzom/ryzomcore
 /**
  * creates a new reply on a ticket.
  * Creates a ticket_content entry and links it with a new created ticket_reply, a log entry will be written about this.
  * In case the ticket creator replies on a ticket, he will set the status by default to 'waiting on support'.
  * @param $content the content of the reply
  * @param $author the id of the reply creator.
  * @param $ticket_id the id of the ticket of which we want the replies.
  * @param $hidden should be 0 or 1
  * @param $ticket_creator the ticket's starter his id.
  */
 public static function createReply($content, $author, $ticket_id, $hidden, $ticket_creator)
 {
     $ticket_content = new Ticket_Content();
     $ticket_content->setContent($content);
     $ticket_content->create();
     $content_id = $ticket_content->getTContentId();
     $ticket_reply = new Ticket_Reply();
     $ticket_reply->set(array('Ticket' => $ticket_id, 'Content' => $content_id, 'Author' => $author, 'Hidden' => $hidden));
     $ticket_reply->create();
     $reply_id = $ticket_reply->getTReplyId();
     if ($ticket_creator == $author) {
         Ticket::updateTicketStatus($ticket_id, 1, $author);
     }
     Ticket_Log::createLogEntry($ticket_id, $author, 4, $reply_id);
 }
コード例 #2
0
ファイル: show_reply.php プロジェクト: ryzom/ryzomcore
/**
* This function is beign used to load info that's needed for the show_reply page.
* check if the person is allowed to see the reply, if not he'll be redirected to an error page.
* data regarding to the reply will be returned by this function that will be used by the template.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function show_reply()
{
    //if logged in
    if (WebUsers::isLoggedIn() && isset($_GET['id'])) {
        $result['reply_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
        $reply = new Ticket_Reply();
        $reply->load_With_TReplyId($result['reply_id']);
        $ticket = new Ticket();
        $ticket->load_With_TId($reply->getTicket());
        //check if the user is allowed to see the reply
        if ($ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId() && !$reply->getHidden() || Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
            $content = new Ticket_Content();
            $content->load_With_TContentId($reply->getContent());
            $author = new Ticket_User();
            $author->load_With_TUserId($reply->getAuthor());
            $result['hidden'] = $reply->getHidden();
            $result['ticket_id'] = $reply->getTicket();
            $result['reply_timestamp'] = $reply->getTimestamp();
            $result['author_permission'] = $author->getPermission();
            $result['reply_content'] = $content->getContent();
            $result['author'] = $author->getExternId();
            $webUser = new WebUsers($author->getExternId());
            $result['authorName'] = $webUser->getUsername();
            if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
                $result['isMod'] = "TRUE";
            }
            global $INGAME_WEBPATH;
            $result['ingame_webpath'] = $INGAME_WEBPATH;
            return $result;
        } else {
            //ERROR: No access!
            $_SESSION['error_code'] = "403";
            header("Cache-Control: max-age=1");
            header("Location: index.php?page=error");
            throw new SystemExit();
        }
    } else {
        //ERROR: not logged in!
        header("Cache-Control: max-age=1");
        header("Location: index.php");
        throw new SystemExit();
    }
}