Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / web / public_php / ams / inc / show_ticket_info.php
blob9884df0bbb20ba81fcbb0b3c53551f1cc20c192f
1 <?php
2 /**
3 * This function is beign used to load info that's needed for the show_ticket_info page.
4 * check if the person browsing this page is a mod/admin or the ticket creator himself, if not he'll be redirected to an error page.
5 * not all tickets have this page related to it, only tickets created ingame will have additional information. The returned info will be used by the template to show the show_ticket_info page.
6 * @author Daan Janssens, mentored by Matthew Lagoe
7 */
8 function show_ticket_info(){
10 //if logged in
11 if(WebUsers::isLoggedIn() && isset($_GET['id'])){
13 $result['ticket_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
14 $target_ticket = new Ticket();
15 $target_ticket->load_With_TId($result['ticket_id']);
17 if( $target_ticket->hasInfo() && (($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user']) ))){
18 $result['ticket_title'] = $target_ticket->getTitle();
19 $result['ticket_author'] = $target_ticket->getAuthor();
21 $ticket_info = new Ticket_Info();
22 $ticket_info->load_With_Ticket($result['ticket_id']);
23 $result['shard_id'] = $ticket_info->getShardId();
24 $result['user_position'] = $ticket_info->getUser_Position();
25 $result['view_position'] = $ticket_info->getView_Position();
26 $result['client_version'] = $ticket_info->getClient_Version();
27 $result['patch_version'] = $ticket_info->getPatch_Version();
28 $result['server_tick'] = $ticket_info->getServer_Tick();
29 $result['connect_state'] = $ticket_info->getConnect_State();
30 $result['local_address'] = $ticket_info->getLocal_Address();
31 $result['memory'] = $ticket_info->getMemory();
32 $result['os'] = $ticket_info->getOS();
33 $result['processor'] = $ticket_info->getProcessor();
34 $result['cpu_id'] = $ticket_info->getCPUId();
35 $result['cpu_mask'] = $ticket_info->getCPU_Mask();
36 $result['ht'] = $ticket_info->getHT();
37 $result['nel3d'] = $ticket_info->getNel3D();
38 $result['user_id'] = $ticket_info->getUser_Id();
39 global $IMAGELOC_WEBPATH;
40 $result['IMAGELOC_WEBPATH'] = $IMAGELOC_WEBPATH;
42 if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){
43 $result['isMod'] = "TRUE";
45 global $INGAME_WEBPATH;
46 $result['ingame_webpath'] = $INGAME_WEBPATH;
47 return $result;
49 }else{
50 //ERROR: No access!
51 $_SESSION['error_code'] = "403";
52 header("Cache-Control: max-age=1");
53 header("Location: index.php?page=error");
54 throw new SystemExit();
56 }else{
57 //ERROR: not logged in!
58 header("Cache-Control: max-age=1");
59 header("Location: index.php");
60 throw new SystemExit();