Ejemplo n.º 1
0
 case "PUT":
     $json_arr = json_decode($json_string, true);
     if (!does_map_exist_by_id($student_id, $map_id)) {
         deliver_response(200, "Map with id={$map_id} does not exist");
         break;
     }
     if ($map_id != $json_arr['id']) {
         deliver_response(200, "You cannot update map's id");
         break;
     }
     if (!does_map_exist_by_id($student_id, $map_id)) {
         deliver_response(200, "Map with id={$map_id} does not exist");
         break;
     }
     if (is_array($json_arr)) {
         update_map($student_id, $map_id, $json_string);
         $map = get_user_maps($student_id, $map_id);
         $map = xml_maps_to_json($map);
         $map = json_decode($map, true);
         deliver_response(200, "The map has been updated", $map);
     } else {
         deliver_response(400, "The request cannot be fulfilled due to bad syntax");
     }
     break;
 case "DELETE":
     if (!does_map_exist_by_id($student_id, $map_id)) {
         deliver_response(200, "Map with id={$map_id} does not exist");
         break;
     }
     delete_map($student_id, $map_id);
     deliver_response(200, "The map has been deleted");
Ejemplo n.º 2
0
    $map_description = $_POST['mapdescription'];
    if ($map_image != "" && $map_name != "") {
        add_map($game_id, $map_image, $map_name, $map_description);
    }
    //dbg: echo "Map: $game_id, $map_image, $map_name, $map_description";
    //exit();
    header("Location: admin_config.php?eb_games&gameid={$game_id}");
    exit;
}
if (isset($_POST['edit_map']) && $_POST['edit_map'] != "") {
    $map = $_POST['edit_map'];
    $map_name = $_POST['mapname' . $map];
    $map_image = $_POST['mapimage' . $map];
    $map_description = $_POST['mapdescription' . $map];
    if ($map_image != "" && $map_name != "") {
        update_map($map, $map_image, $map_name, $map_description);
    }
    //dbg: echo "Update Map: $map, $map_image, $map_name, $map_description";
    header("Location: admin_config.php?eb_games&gameid={$game_id}");
    exit;
}
if (isset($_POST['del_map']) && $_POST['del_map'] != "") {
    $map = $_POST['del_map'];
    delete_map($map);
    header("Location: admin_config.php?eb_games&gameid={$game_id}");
    exit;
}
exit;
/***************************************************************************************
Functions
***************************************************************************************/