diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php index 9f81961b2..699562abf 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php @@ -2,28 +2,27 @@ function show_ticket(){ //if logged in - if(WebUsers::isLoggedIn()){ + if(WebUsers::isLoggedIn() && isset($_GET['id'])){ - //if( !isset($_GET['id']) || WebUsers::isAdmin() || $_GET['id'] == $_SESSION['id'] ){ + global $cfg; + $result['ticket_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT); + $target_ticket = new Ticket($cfg['db']['lib']); + $target_ticket->load_With_TId($result['ticket_id']); + + if(($target_ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || WebUsers::isAdmin() ){ - if(isset($_GET['id'])){ - $result['target_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT); - }else{ - $result['target_id'] = $_SESSION['id']; - } - global $cfg; - $entire_ticket = Ticket::getEntireTicket( $result['target_id'], $cfg['db']['lib']); + $entire_ticket = Ticket::getEntireTicket( $result['ticket_id'], $cfg['db']['lib']); + $result['ticket_tId'] = $entire_ticket['ticket_obj']->getTId(); $result['ticket_title'] = $entire_ticket['ticket_obj']->getTitle(); $result['ticket_replies'] = Gui_Elements::make_table($entire_ticket['reply_array'], Array("getTReplyId","getContent()->getContent","getTimestamp"), Array("tReplyId","replyContent","timestamp")); - //$result['ticket_replies'][0]['replyContent'] = nl2br($result['ticket_replies'][0]['replyContent']); return $result; - /*}else{ + }else{ //ERROR: No access! $_SESSION['error_code'] = "403"; header("Location: index.php?page=error"); exit; - }*/ + } }else{ //ERROR: not logged in! header("Location: index.php"); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl index fecaa7817..d8a04fdd9 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl @@ -2,7 +2,7 @@
-

Ticket

+

Ticket [ID#{$ticket_tId}]

@@ -16,7 +16,7 @@ {foreach from=$ticket_replies item=reply} -

[ID{$reply.tReplyId}] {$reply.timestamp} {$username}

+

[ID#{$reply.tReplyId}] {$reply.timestamp} {$username}

{$reply.replyContent}

@@ -28,10 +28,17 @@
- +
+ +
+ +
+ +
+