Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / web / public_php / ams / inc / createticket.php
blob7a4dea3c2c472aa7d0c504caafcf02892e5872d4
1 <?php
2 /**
3 * This function is beign used to load info that's needed for the createticket page.
4 * the $_GET['user_id'] identifies for which user you try to create a ticket. A normal user can only create a ticket for himself, a mod/admin however can also create tickets for other users.
5 * It will also load all categories and return these, they will be used by the template.
6 * @author Daan Janssens, mentored by Matthew Lagoe
7 */
8 function createticket(){
10 //if logged in
11 if(WebUsers::isLoggedIn()){
12 //in case user_id-GET param set it's value as target_id, if no user_id-param is given, use the session id.
13 if(isset($_GET['user_id'])){
15 //check if you are a mod/admin or you try to create a ticket for your own, if this is not the case redirect to error page
16 if(($_GET['user_id'] != $_SESSION['id']) && ( ! ticket_user::isMod(unserialize($_SESSION['ticket_user']))) ){
18 //ERROR: No access!
19 $_SESSION['error_code'] = "403";
20 header("Cache-Control: max-age=1");
21 header("Location: index.php?page=error");
22 throw new SystemExit();
24 }else{
25 //if user_id is given, then set it as the target_id
26 $result['target_id'] = filter_var($_GET['user_id'], FILTER_SANITIZE_NUMBER_INT);
29 }else{
30 //set session_id as target_id
31 $result['target_id'] = $_SESSION['id'];
35 if(Helpers::check_if_game_client()){
36 //get all additional info, which is needed for adding the extra info page
37 $result[] = $_GET;
38 $result['ingame'] = true;
42 //create array of category id & names
43 $catArray = Ticket_Category::getAllCategories();
44 $result['category'] = Gui_Elements::make_table_with_key_is_id($catArray, Array("getName"), "getTCategoryId" );
45 global $INGAME_WEBPATH;
46 $result['ingame_webpath'] = $INGAME_WEBPATH;
47 $result['TITLE_ERROR'] = $INGAME_WEBPATH;
48 return $result;
50 }else{
51 //ERROR: not logged in!
52 header("Cache-Control: max-age=1");
53 header("Location: index.php");
54 throw new SystemExit();