From ba8029e8b89408de58a5b3d8b588718a9ad88f07 Mon Sep 17 00:00:00 2001 From: Baptiste Date: Thu, 10 Mar 2022 00:34:02 +0100 Subject: [PATCH] map finit --- {map => assets/map}/ajax.php | 6 +- {map => assets/map}/map2d.svg | 0 {map => assets/map}/map3D.glb | Bin {map => assets/map}/script_map2d.js | 4 +- {map => assets/map}/script_map3d.js | 7 +- map.php | 110 ++++++++++++---------------- map/map_init.php | 56 -------------- 7 files changed, 58 insertions(+), 125 deletions(-) rename {map => assets/map}/ajax.php (95%) rename {map => assets/map}/map2d.svg (100%) rename {map => assets/map}/map3D.glb (100%) rename {map => assets/map}/script_map2d.js (94%) rename {map => assets/map}/script_map3d.js (98%) delete mode 100644 map/map_init.php diff --git a/map/ajax.php b/assets/map/ajax.php similarity index 95% rename from map/ajax.php rename to assets/map/ajax.php index 595db95..1974e5e 100644 --- a/map/ajax.php +++ b/assets/map/ajax.php @@ -64,9 +64,9 @@ $desc = [ //c'est peu compréhensible mais l'ancien systeme (avant Baptiste Rébillard <- moi) utilisait inutilement une base de donnée if (isset($_GET['function'])) { - if ($_GET['function'] == "get_map_info") + if (htmlspecialchars($_GET['function']) == "get_map_info") get_map_info(); - elseif ($_GET['function'] == "get_map_selectors") + elseif (htmlspecialchars($_GET['function']) == "get_map_selectors") get_map_selectors(); } @@ -87,7 +87,7 @@ function get_map_selectors() { function get_map_info() { if (isset($_GET['selector'])) { - $select = $_GET['selector']; + $select = htmlspecialchars($_GET['selector']); header('Content-Type: application/json'); diff --git a/map/map2d.svg b/assets/map/map2d.svg similarity index 100% rename from map/map2d.svg rename to assets/map/map2d.svg diff --git a/map/map3D.glb b/assets/map/map3D.glb similarity index 100% rename from map/map3D.glb rename to assets/map/map3D.glb diff --git a/map/script_map2d.js b/assets/map/script_map2d.js similarity index 94% rename from map/script_map2d.js rename to assets/map/script_map2d.js index 5836943..331803e 100644 --- a/map/script_map2d.js +++ b/assets/map/script_map2d.js @@ -2,6 +2,8 @@ let hoverColor = "#e9b82f"; let normalColor = "#efbd95"; +var rep2 = "assets/map/"; + function get_name(id){ return id.replace("map-", ""); } @@ -16,7 +18,7 @@ function clicked(elem){ 'selector': get_name(elem.id), }; return $.ajax({ - url: 'ajax.php', + url: rep2+'ajax.php', data: object, method: 'get' }).done(function (data) { diff --git a/map/script_map3d.js b/assets/map/script_map3d.js similarity index 98% rename from map/script_map3d.js rename to assets/map/script_map3d.js index 5408e70..be4da6f 100644 --- a/map/script_map3d.js +++ b/assets/map/script_map3d.js @@ -3,6 +3,7 @@ * Code : Ronan Bonnet * */ +var rep = "assets/map/"; import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.119.1/build/three.module.js'; @@ -84,7 +85,7 @@ function init() { // var loader = new GLTFLoader(loadingManager); - loader.load('map3D.glb', function(gltf) { + loader.load(rep+'map3D.glb', function(gltf) { var object = gltf.scene; gltf.scene.scale.set( 2, 2, 2 ); gltf.scene.position.x = 0; //Position (x = right+ left-) @@ -162,7 +163,7 @@ function getSelectors() { 'info': info, } return $.ajax({ - url: 'ajax.php', + url: rep+'ajax.php', data: object, method: 'get', success: function(data){ @@ -204,7 +205,7 @@ function handleClickOnBuilding(x,y) { 'selector': selector, }; return $.ajax({ - url: 'ajax.php', + url: rep+'ajax.php', data: object, method: 'get' }).done(function (data) { diff --git a/map.php b/map.php index 7c8f643..3e7197a 100755 --- a/map.php +++ b/map.php @@ -1,74 +1,59 @@ -
-

Le Plan

-

- Voici le plan de ton nouveau campus, que tu vas connaître par cœur en quelques jours ! -

-

- Clique sur un bâtiment pour voir les infos. -

- - - - - - - -
- - -
- -
- -
- -
-
- - - -
- - - - - + + + + + +
+ + +
+ +
+ +
+ +
+
+ + + +
+ +

Une petite note sur le numéro des salles : sur ton emploi du temps, le bâtiment est marqué en premier, et @@ -83,6 +68,7 @@ function enable2DMap() { Map.

+ - - - - - - - -
- - -
- -
- -
- -
-
- - - -
- - - - -