changeset 1638:775208d791fa

Code cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 19 May 2016 06:29:58 +0300
parents 9332c380003d
children c6f92ccd96cc
files www/loc.php
diffstat 1 files changed, 61 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/www/loc.php	Thu May 19 06:29:39 2016 +0300
+++ b/www/loc.php	Thu May 19 06:29:58 2016 +0300
@@ -82,6 +82,7 @@
   $applyFilter = FALSE;
 }
 
+
 $showCoders = !isset($_GET["s"]);
 
 if (($tmpName = stGetRequestItem("a", FALSE, TRUE)) !== false)
@@ -136,8 +137,55 @@
 }
 
 
-/* Start of the page
- */
+// Make alphabetically sorted table of locations
+$alphaTable = [];
+foreach ($locTable as $id => $data)
+if (isset($data["name"]))
+{
+  $idx = $data["name"][0];
+  if (isset($_GET["nocoders"]))
+  {
+    if (count($data["coders"]) == 0 && !preg_match("/[SPG]/", $data["flags"]))
+      $alphaTable[$idx][] = $data;
+  }
+  else
+  if (isset($coderName))
+  {
+    foreach ($data["coders"] as $coder)
+    {
+      if ($coderName == $coder["name"])
+        $alphaTable[$idx][] = $data;
+    }
+  }
+  else
+    $alphaTable[$idx][] = $data;
+}
+
+ksort($alphaTable, SORT_STRING);
+
+
+//
+// Start of the page
+//
+if ($applyFilter)
+{
+  if (array_key_exists($filter, $locationTypes))
+  
+    $mtitle = $locationTypes[$filter][2];
+  else
+    $mtitle = "Filter '".$filter."'";
+}
+else
+  $mtitle = "Locations";
+
+$mtitle .= " of ";
+
+if (isset($setName) && isset($continentList[$setName]))
+{
+  $mtitle .= $continentList[$setName][0].
+    ($continentList[$setName][3] ? " in " : " continent in ");
+}
+
 mpPrintPageHeader($pageTitle." - Locations",
   "<script type=\"text/javascript\" src=\"tooltip.js\"></script>\n".
   "<meta name=\"robots\" content=\"nofollow\" />\n");
@@ -146,31 +194,7 @@
 
 echo
   "<div id=\"contents\">\n".
-  "<h1>";
-
-if ($applyFilter)
-{
-  if (array_key_exists($filter, $locationTypes))
-    echo $locationTypes[$filter][2];
-  else
-    echo "Filter '".$filter."'";
-}
-else
-  echo "Locations";
-
-echo " of ";
-
-if (isset($setName) && isset($continentList[$setName]))
-{
-  echo $continentList[$setName][0].
-    ($continentList[$setName][3] ? " in " : " continent in ");
-}
-
-echo
-  "BatMUD".(isset($coderName) ? " by ".chentities($coderName) : "").
-  "</h1>\n";
-
-echo
+  "<h1>".$mtitle."BatMUD".(isset($coderName) ? " by ".chentities($coderName) : "")."</h1>\n".
   "<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"get\">\n".
   "<div class=\"controls\">\n";
 
@@ -224,7 +248,9 @@
       $s = $wizImageURL."unknown.png";
 
     echo
-      "<div class=\"wizinfo\">\n <table>\n  <tr>\n".
+      "<div class=\"wizinfo\">\n".
+      " <table>\n".
+      "  <tr>\n".
       "   <td class=\"img\"><img src=\"".$s."\" alt=\"".$coderName."\" /></td>\n".
       "   <td class=\"info\">\n".
       "    <h2>".$coderName."</h2>\n";
@@ -251,8 +277,12 @@
         
       echo "    [<a href=\"".$s."\">Homepage</a>]<br />\n";
     }
-    
-    echo "   </td>\n  </tr>\n </table>\n</div>\n";
+
+    echo
+      "   </td>\n".
+      "  </tr>\n".
+      " </table>\n".
+      "</div>\n";
   }
   else
     stError("No information entry for this wizard.");
@@ -280,39 +310,9 @@
 //
 // Print list of locations
 //
-if (/* !$errorSet && */ count($locTable) > 0)
+if (count($alphaTable) > 0)
 {
-  // Make alphabetically sorted table of locations
-  $alphaTable = [];
-  foreach ($locTable as $id => $data)
-  if (isset($data["name"]))
-  {
-    $idx = $data["name"][0];
-    if (isset($_GET["nocoders"]))
-    {
-      if (count($data["coders"]) == 0 && !preg_match("/[SPG]/", $data["flags"]))
-        $alphaTable[$idx][] = $data;
-    }
-    else
-    {
-      if (isset($coderName))
-      {
-        foreach ($data["coders"] as $coder)
-        {
-          if ($coderName == $coder["name"])
-            $alphaTable[$idx][] = $data;
-        }
-      }
-      else
-        $alphaTable[$idx][] = $data;
-    }
-  }
 
-  ksort($alphaTable, SORT_STRING);
-
-  //
-  // Print locations per first character
-  //
   $locationTips = [];
   $totalLoc = 0;
   $maxRow = 6;