Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / web / public_php / ams / inc / show_reply.php
bloba1a3d6c7ba833fc21d39708bdac5cbea2ccfb31b
1 <?php
2 /**
3 * This function is beign used to load info that's needed for the show_reply page.
4 * check if the person is allowed to see the reply, if not he'll be redirected to an error page.
5 * data regarding to the reply will be returned by this function that will be used by the template.
6 * @author Daan Janssens, mentored by Matthew Lagoe
7 */
8 function show_reply(){
9 //if logged in
10 if(WebUsers::isLoggedIn() && isset($_GET['id'])){
12 $result['reply_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
13 $reply = new Ticket_Reply();
14 $reply->load_With_TReplyId($result['reply_id']);
17 $ticket = new Ticket();
18 $ticket->load_With_TId($reply->getTicket());
20 //check if the user is allowed to see the reply
21 if(( $ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId() && ! $reply->getHidden()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user']) )){
22 $content = new Ticket_Content();
23 $content->load_With_TContentId($reply->getContent());
25 $author = new Ticket_User();
26 $author->load_With_TUserId($reply->getAuthor());
28 $result['hidden'] = $reply->getHidden();
29 $result['ticket_id'] = $reply->getTicket();
30 $result['reply_timestamp'] = $reply->getTimestamp();
31 $result['author_permission'] = $author->getPermission();
32 $result['reply_content'] = $content->getContent();
33 $result['author'] = $author->getExternId();
34 $webUser = new WebUsers($author->getExternId());
35 $result['authorName'] = $webUser->getUsername();
36 if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){
37 $result['isMod'] = "TRUE";
39 global $INGAME_WEBPATH;
40 $result['ingame_webpath'] = $INGAME_WEBPATH;
41 return $result;
43 }else{
44 //ERROR: No access!
45 $_SESSION['error_code'] = "403";
46 header("Cache-Control: max-age=1");
47 header("Location: index.php?page=error");
48 throw new SystemExit();
50 }else{
51 //ERROR: not logged in!
52 header("Cache-Control: max-age=1");
53 header("Location: index.php");
54 throw new SystemExit();