2013-07-13 21:18:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
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']);
|
|
|
|
|
2013-07-19 13:59:39 +00:00
|
|
|
|
2013-07-13 21:18:49 +00:00
|
|
|
$ticket = new Ticket();
|
|
|
|
$ticket->load_With_TId($reply->getTicket());
|
|
|
|
|
2013-07-19 13:59:39 +00:00
|
|
|
if(( $ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId() && ! $reply->getHidden()) || Ticket_User::isMod($_SESSION['ticket_user'] )){
|
2013-07-13 21:18:49 +00:00
|
|
|
$content = new Ticket_Content();
|
|
|
|
$content->load_With_TContentId($reply->getContent());
|
|
|
|
|
|
|
|
$author = new Ticket_User();
|
|
|
|
$author->load_With_TUserId($reply->getAuthor());
|
|
|
|
|
2013-07-19 13:59:39 +00:00
|
|
|
$result['hidden'] = $reply->getHidden();
|
2013-07-13 21:18:49 +00:00
|
|
|
$result['ticket_id'] = $reply->getTicket();
|
|
|
|
$result['reply_timestamp'] = $reply->getTimestamp();
|
|
|
|
$result['author_permission'] = $author->getPermission();
|
|
|
|
$result['reply_content'] = $content->getContent();
|
|
|
|
$result['author'] = $author->getExternId();
|
2013-08-05 15:31:36 +00:00
|
|
|
$webUser = new WebUsers($author->getExternId());
|
|
|
|
$result['authorName'] = $webUser->getUsername();
|
2013-07-18 10:43:33 +00:00
|
|
|
if(Ticket_User::isMod($_SESSION['ticket_user'])){
|
2013-07-18 19:12:03 +00:00
|
|
|
$result['isMod'] = "TRUE";
|
2013-07-13 21:18:49 +00:00
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
//ERROR: No access!
|
|
|
|
$_SESSION['error_code'] = "403";
|
|
|
|
header("Location: index.php?page=error");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
//ERROR: not logged in!
|
|
|
|
header("Location: index.php");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|