changeset 119:2f2937e8921f gmap2

More work on sanitizing the overlays generation etc.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 08 Mar 2014 21:30:21 +0200
parents e7c9dd34adeb
children 3b725e8ac51a
files tools/makegmaps.php
diffstat 1 files changed, 18 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/tools/makegmaps.php	Sat Mar 08 20:55:39 2014 +0200
+++ b/tools/makegmaps.php	Sat Mar 08 21:30:21 2014 +0200
@@ -28,9 +28,9 @@
 $mkloc = $mapUtils."mkloc";
 
 $modes = array(
-  "xml"     => "markers.xml",
-  "overlay" => "overlay.txt",
-  "labels"  => "overlaylabels.txt",
+  "xml"     => array("markers.xml"       , 0, 0),
+  "overlay" => array("overlay.txt"       , 0, 0),
+  "labels"  => array("overlaylabels.txt" , 2, -1),
 );
 
 $mapPalette = array();
@@ -161,21 +161,24 @@
  * Generate marker files from LOC data
  */
 echo "Converting location data from LOC files to GMaps markers...\n";
-$args = "";
-foreach ($continentList as $name => $data)
+
+foreach ($modes as $mode => $mdata)
 {
-  if ($data[4] && $data[7]) { // has a map
-    $args .=
-    "-l ".escapeshellarg($locPath.$name.".loc")." ".
-    "-c ".escapeshellarg($data[0])." ".
-    "-x ".escapeshellarg($worldMap["ox"] + $data[1])." ".
-    "-y ".escapeshellarg($worldMap["oy"] + $data[2])." ";
+  $tmp = escapeshellcmd($mkloc)." -v -o ".escapeshellarg($markerPath.$mdata[0])." -G ".$mode." ";
+
+  foreach ($continentList as $name => $data)
+  {
+    if ($data[4] && $data[7])
+    {
+      // has a map
+      $tmp .=
+      "-l ".escapeshellarg($locPath.$name.".loc")." ".
+      "-c ".escapeshellarg($data[0])." ".
+      "-x ".escapeshellarg($worldMap["ox"] + $data[1] + $mdata[1])." ".
+      "-y ".escapeshellarg($worldMap["oy"] + $data[2] + $mdata[2])." ";
+    }
   }
-}
 
-foreach ($modes as $mode => $file)
-{
-  $tmp = escapeshellcmd($mkloc)." -v -o ".escapeshellarg($markerPath.$file)." -G ".$mode." ".$args;
   passthru($tmp) == 0 or die("Error executing: ".$tmp."\n");
 }