changeset 926:dd5b00e9c263

Sync.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 02 May 2010 00:00:45 +0000
parents cee0e118bd45
children 074a1b2f1a5a
files www/common.inc.php www/latest.php www/loc.php www/quests.php www/ss.php
diffstat 5 files changed, 32 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/www/common.inc.php	Sun May 02 00:00:04 2010 +0000
+++ b/www/common.inc.php	Sun May 02 00:00:45 2010 +0000
@@ -5,12 +5,18 @@
   return iconv("ISO-8859-1", $pageCharset, $str);
 }
 
+function chentities($str)
+{
+  global $pageCharset;
+  return htmlentities($str, ENT_COMPAT, $pageCharset);
+}
+
 $continentList = array(
   "laenor"      => array("Laenor",      1313,  1486),
-  "roth"        => array("Rothikgen",   2786,  15),
-  "luc"         => array("Lucentium",   644,   3811),
-  "furn"        => array("Furnachia",   2458,  2615),
-  "deso"        => array("Desolathya",  54,    2285),
+  "rothikgen"   => array("Rothikgen",   2786,  15),
+  "lucentium"   => array("Lucentium",   644,   3811),
+  "furnachia"   => array("Furnachia",   2458,  2615),
+  "desolathya"  => array("Desolathya",  54,    2285),
 );
 
 $specialList = array(
--- a/www/latest.php	Sun May 02 00:00:04 2010 +0000
+++ b/www/latest.php	Sun May 02 00:00:45 2010 +0000
@@ -92,7 +92,7 @@
         
         printURL($iv["continent"].".html#loc".$iv["x"]."_".$iv["y"]);
         
-        echo htmlentities($iv["name"])."</a></td>\n".
+        echo chentities($iv["name"])."</a></td>\n".
         "  <td>".$continentList[$iv["continent"]][0]."</td>\n".
         "  <td>";
         
@@ -100,14 +100,14 @@
           $fs = "";
           while (list($fKey, $fVal) = each($iv["coders"])) {
             if ($fs != "") $fs .= ", ";
-            $fs .= "<a href=\"loc.php?a=".htmlentities($fVal)."\">".htmlentities($fVal)."</a>";
+            $fs .= "<a href=\"loc.php?a=".chentities($fVal)."\">".chentities($fVal)."</a>";
           }
           echo $fs;
         }
         echo "</td>\n".
         "  <td>";
         if (isset($iv["freeform"]))
-          echo htmlentities($iv["freeform"]);
+          echo chentities($iv["freeform"]);
         echo "</td>\n".
         " </tr>\n";
   }
--- a/www/loc.php	Sun May 02 00:00:04 2010 +0000
+++ b/www/loc.php	Sun May 02 00:00:45 2010 +0000
@@ -41,7 +41,7 @@
   if (isset($_GET["f"]) && $_GET["f"] != "") {
     $filter = $_GET["f"];
     if (!preg_match("/^[\^A-Za-z]+\$/", $filter)) {
-      echo "<h1>Invalid filter rule '".htmlentities($filter)."'</h1>\n";
+      echo "<h1>Invalid filter rule '".chentities($filter)."'</h1>\n";
       $filter = "C";
       $applyFilter = FALSE;
     } else {
@@ -104,7 +104,7 @@
  <form action="<? echo $_SERVER["PHP_SELF"]; ?>" method="get">
 <?
 if (isset($setName))
-  echo "<input type=\"hidden\" name=\"n\" value=\"".htmlentities($setName)."\" />\n";
+  echo "<input type=\"hidden\" name=\"n\" value=\"".chentities($setName)."\" />\n";
 ?>
  <table>
   <tr>
@@ -223,25 +223,25 @@
         (100 / $maxRow), $iv["continent"]);
         
       if (isset($specialList[$iv["continent"]]) && !$specialList[$iv["continent"]][1]) {
-        echo "<b>".htmlentities($iv["name"])."</b>";
+        echo "<b>".chentities($iv["name"])."</b>";
       } else {
         printURL($iv["continent"].".html#loc".$iv["x"]."_".$iv["y"]);
-        echo htmlentities($iv["name"])."</a>";
+        echo chentities($iv["name"])."</a>";
       }
       
       // If either freeform desc or URL field are set, we add those
       if (isset($iv["url"]) || isset($iv["freeform"])) {
         // Free form description
-        $desc = isset($iv["freeform"]) ? htmlentities($iv["freeform"]) : "";
+        $desc = isset($iv["freeform"]) ? chentities($iv["freeform"]) : "";
 
         // Add URL information, chopped, if any
         if (isset($iv["url"])) {
           $urlEnt = $iv["url"];
-          $urlBegin = "<a href=\"".htmlentities($urlEnt)."\" target=\"_blank\">";
+          $urlBegin = "<a href=\"".chentities($urlEnt)."\" target=\"_blank\">";
           $urlEnd = "</a>";
           if (strlen($iv["url"]) > 40)
             $urlEnt = substr($urlEnt, 0, 40)."...";
-          $desc .= "<br /><br /><b>".htmlentities($urlEnt)."</b>";
+          $desc .= "<br /><br /><b>".chentities($urlEnt)."</b>";
         } else {
           $urlBegin = $urlEnd = "";
         }
@@ -257,7 +257,7 @@
         
       // Alternative names
       if (count($iv["names"]) > 0) {
-        echo "<br />".htmlentities(implode(" | ", $iv["names"]));
+        echo "<br />".chentities(implode(" | ", $iv["names"]));
       }
         
       // Coder / society names
@@ -298,7 +298,7 @@
    */
   foreach ($locationTips as $tipID => $tip) {
     echo "<div class=\"tooltip\" id=\"tt".$tipID.
-    "\"><div class=\"holder\"><b>".htmlentities($tip["title"]).
+    "\"><div class=\"holder\"><b>".chentities($tip["title"]).
     "</b><br />".$tip["desc"]."</div></div>\n";
   }
 } else {
--- a/www/quests.php	Sun May 02 00:00:04 2010 +0000
+++ b/www/quests.php	Sun May 02 00:00:45 2010 +0000
@@ -52,13 +52,13 @@
 {
   global $batQuestURL, $specialList, $continentList;
   echo
-  "<td><a href=\"".$batQuestURL.urlencode($name)."\">".htmlentities($name)."</a></td>".
+  "<td><a href=\"".$batQuestURL.urlencode($name)."\">".chentities($name)."</a></td>".
   "<td class=\"".$area["continent"]."\">";
   if (isset($specialList[$area["continent"]]) && !$specialList[$area["continent"]][1]) {
-    echo "<b>".htmlentities($area["name"])."</b>";
+    echo "<b>".chentities($area["name"])."</b>";
   } else {
     printURL($area["continent"].".html#loc".$area["x"]."_".$area["y"]);
-    echo htmlentities($area["name"])."</a>";
+    echo chentities($area["name"])."</a>";
   }
   echo "</td><td>".$continentList[$area["continent"]][0]."</td>";
 }
--- a/www/ss.php	Sun May 02 00:00:04 2010 +0000
+++ b/www/ss.php	Sun May 02 00:00:45 2010 +0000
@@ -21,12 +21,10 @@
 /* Print list of societies
  */
 if (count($locTable) > 0) {
-  /* Make a list
-   */
-  while (list($key, $value) = each($locTable)) {
+  /* Make a list */
+  foreach ($locTable as $key => $value) {
     if (count($value["coders"]) > 0) {
-
-      while (list($qkey, $qvalue) = each($value["coders"])) {
+      foreach ($value["coders"] as $qvalue) {
         $sortTable[$qvalue] = array(
           "name" => $value["name"],
           "continent" => $value["continent"],
@@ -45,14 +43,14 @@
   "  <th>Continent</th>\n".
   " </tr>\n";
   
-  while (list($ik, $iv) = each($sortTable)) {
+  foreach ($sortTable as $name => $data) {
         echo
         " <tr>\n".
-        "  <td>".htmlentities($ik)."</td>\n".
-        "  <td class=\"".$iv["continent"]."\">".htmlentities($iv["name"])."</td>\n".
+        "  <td>".chentities($name)."</td>\n".
+        "  <td class=\"".$data["continent"]."\">".chentities($data["name"])."</td>\n".
         "  <td>";
         
-        $t = $iv["continent"];
+        $t = $data["continent"];
         if (isset($continentList[$t]))
           echo $continentList[$t][0];
         else