changeset 89:eb5b6db2b250 default tip

Fixes.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 19 Oct 2017 17:42:05 +0300
parents 4c88842414dd
children
files herbs/index.php
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/herbs/index.php	Mon Oct 09 18:47:35 2017 +0300
+++ b/herbs/index.php	Thu Oct 19 17:42:05 2017 +0300
@@ -93,6 +93,11 @@
 {
   while ($data = fgetcsv($fh, 1000, ";"))
   {
+    // Fix undefined columns
+    for ($n = 0; $n <= 4; $n++)
+      if (!isset($data[$n])) $data[$n] = "";
+
+    // Parse seasons
     $sdata = 0;
     foreach (preg_split("/, */", $data[1]) as $value)
     {
@@ -100,6 +105,7 @@
         $sdata |= tlGetSeasonFromName($value, TRUE);
     }
 
+    // Parse terrains
     $rdata = array();
     foreach (preg_split("/, */", $data[2]) as $value)
     {
@@ -107,6 +113,7 @@
         $rdata[] = tlGetTerrainDataByName($value);
     }
     
+    // Put it all into an array
     $herbData[] = array(
       "name"    => $data[0],
       "seasons" => $sdata,