changeset 277:023f5d0f627e gmap2

Cosmetics and improved error messages.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 16 Apr 2015 21:04:23 +0300
parents 9ed3aa7ca7b5
children 2233bdad4ab5
files tools/makegmaps.php
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/tools/makegmaps.php	Thu Jan 01 09:29:48 2015 +0200
+++ b/tools/makegmaps.php	Thu Apr 16 21:04:23 2015 +0300
@@ -2,7 +2,7 @@
 <?php
 // Prevent non-cli execution
 if (php_sapi_name() != "cli" || !empty($_SERVER["REMOTE_ADDR"]))
-  die("Dongs.\n");
+  die("You can only run this script as a commandline application.\n");
 
 
 $gmapsConfig = "config.php";
@@ -507,8 +507,7 @@
   global $mapPalette, $fontFile, $fontSize;
 
   // Try to open input file
-  $file = @fopen($inFilename, "r");
-  if ($file === FALSE)
+  if (($file = @fopen($inFilename, "r")) === FALSE)
   {
     echo "Could not open input '".$inFilename."'\n";
     return FALSE;
@@ -520,8 +519,7 @@
   $height = $data[6];
 
   // Create image and assign colors
-  $im = @imagecreate($width*$zoom, $height*$zoom);
-  if ($im === FALSE)
+  if (($im = imagecreate($width*$zoom, $height*$zoom)) === FALSE)
   {
     echo "Could not allocate image data for '".$inFilename."'\n";
     return FALSE;
@@ -574,7 +572,8 @@
   return TRUE;
 }
 
-if (!stMakeDir($cfg["pathImageCache"])) {
+if (!stMakeDir($cfg["pathImageCache"]))
+{
   die("Failed to create cache directory '".$cfg["pathImageCache"]."'!\n");
 }