From 0bbd0fb44aaf8125e69439ba1249ada5bc0210b4 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Thu, 9 Apr 2015 10:00:15 +0200 Subject: [PATCH] Cleaning PHP (eew) --- stream/index.php | 26 +------------------------- stream/js/Params.js.php | 39 +++++++++++++++++++++++++++++++++++++++ stream/js/main.js | 2 +- 3 files changed, 41 insertions(+), 26 deletions(-) create mode 100644 stream/js/Params.js.php diff --git a/stream/index.php b/stream/index.php index cbcc214..0e4b9bd 100644 --- a/stream/index.php +++ b/stream/index.php @@ -21,31 +21,7 @@ - 25) - { - throw new Exception('Variable res not set'); - } - } - else - { - throw new Exception('Variable res not set'); - } - } - catch (Exception $e) - { - $res = $default; - } - echo "\n"; - ?> + diff --git a/stream/js/Params.js.php b/stream/js/Params.js.php new file mode 100644 index 0000000..10153b6 --- /dev/null +++ b/stream/js/Params.js.php @@ -0,0 +1,39 @@ + 25) + { + throw new Exception('Variable res not set'); + } + } + catch (Exception $e) + { + // If an exception occur, let's just set the default value + $res = $default; + } + + // And finally, generate a correct js code with no possible injection + echo "params.get.res = " . $res . ";\n"; diff --git a/stream/js/main.js b/stream/js/main.js index 2b3872a..1ce57b3 100644 --- a/stream/js/main.js +++ b/stream/js/main.js @@ -46,7 +46,7 @@ function init() { // Load the scene loader = new THREE.OBJLoader(); - sphere = new ProgessiveSphere(loader, global_array.res); + sphere = new ProgessiveSphere(loader, params.get.res); plane = new Plane(1000,1000); plane.translate(0,0,-100);