Mercurial > hg > batmud > maputils
diff www/loc.php @ 321:eeb6167cf81e
Updates.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 22 Jun 2007 06:49:01 +0000 |
parents | 134dded5369b |
children | ca191c3a0ce1 |
line wrap: on
line diff
--- a/www/loc.php Fri Jun 22 06:48:40 2007 +0000 +++ b/www/loc.php Fri Jun 22 06:49:01 2007 +0000 @@ -1,6 +1,7 @@ <? require "config.inc.php"; + function readLocations($filename, &$locTable, $showPCities = FALSE) { $inFile = @fopen($filename.".loc", "r"); @@ -62,6 +63,54 @@ } +function submitWizInfo(&$wizTable, $m) +{ + $s = trim($m[1]); + $wizTable[$s] = array( + "name" => $s, + "homeURL" => trim($m[2]), + "imageURL" => trim($m[3]), + "desc" => trim($m[4]) + ); +} + +function readWizInfo($filename, &$wizTable) +{ + $inFile = @fopen($filename, "r"); + if (!$inFile) { + return FALSE; + } + + $contMode = FALSE; + while (!feof($inFile)) { + $inLine = rtrim(fgets($inFile)); + + if ($contMode) { + if (substr($inLine, -1, 1) == "$") { + $m[4] .= " ".substr($inLine, 0, -1); + $contMode = FALSE; + submitWizInfo($wizTable, $m); + } else + $m[4] .= " ".$inLine; + } else + if (strlen($inLine) == 0 || $inLine[0] == "#") { + } else + if (preg_match("/^([A-Z][a-z]+);(http:\/\/[^;]+|bat)?;(http:\/\/[^;]+|bat:\/\/[^;]+)?;([^\$]*)\\\$$/", $inLine, $m)) { + submitWizInfo($wizTable, $m); + } else + if (preg_match("/^([A-Z][a-z]+);(http:\/\/[^;]+|bat)?;(http:\/\/[^;]+|bat:\/\/[^;]+)?;(.*)$/", $inLine, $m)) { + $contMode = TRUE; + } else { + echo "Error: <b>$inLine</b><br>\n"; + //return FALSE; + } + } + + fclose($inFile); + return TRUE; +} + + echo "<?xml version=\"1.0\" encoding=\"".$pageCharset."\"?>\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> @@ -76,16 +125,18 @@ <body> <? $locTable = array(); +$wizTable = array(); $onlyPCities = isset($_GET["c"]); $showCoders = !isset($_GET["s"]); if (isset($_GET["a"])) { $coderName = basename($_GET["a"]); + $coderName = strtoupper(substr($coderName, 0, 1)).strtolower(substr($coderName, 1)); } if (isset($_GET["n"])) { - $setName = basename($_GET["n"]); + $setName = strtolower(basename($_GET["n"])); if (isset($continentList[$setName]) && file_exists($setName.".loc")) { readLocations($setName, $locTable, $onlyPCities); } else { @@ -119,8 +170,11 @@ echo " <td class=\"".$class."\">"; else echo " <td>"; - - echo "<a href=\"loc.php?".$s."\">".$desc."</a></td>\n"; + + + echo "<a href=\"loc.php"; + if (strlen($s) > 0) echo "?".$s; + echo "\">".$desc."</a></td>\n"; } /* Header @@ -138,60 +192,75 @@ echo " by ".$coderName; echo "</h1>\n"; -echo "<table>\n <tr>\n"; - -echo " <td><a href=\"loc.php\">EVERYTHING</a></td>\n"; +echo "<div class=\"selbar\">\n <table>\n <tr>\n"; +makeURL(FALSE, TRUE, null, "EVERYTHING", "sel1"); if (!$onlyPCities) { - makeURL(TRUE, $showCoders, $setName, "PCities"); + makeURL(TRUE, $showCoders, $setName, "PCities", "sel2"); if (!$showCoders) - makeURL($onlyPCities, TRUE, $setName, "Show Coders"); + makeURL($onlyPCities, TRUE, $setName, "Show Coders", "sel3"); else - makeURL($onlyPCities, FALSE, $setName, "Hide Coders"); + makeURL($onlyPCities, FALSE, $setName, "Hide Coders", "sel3"); } else { - makeURL(FALSE, $showCoders, $setName, "Locations"); + makeURL(FALSE, $showCoders, $setName, "Locations", "sel2"); if (!$showCoders) - makeURL($onlyPCities, TRUE, $setName, "Show SS"); + makeURL($onlyPCities, TRUE, $setName, "Show SS", "sel3"); else - makeURL($onlyPCities, FALSE, $setName, "Hide SS"); + makeURL($onlyPCities, FALSE, $setName, "Hide SS", "sel3"); } - -echo " <td></td>\n"; +echo " <td></td>\n"; reset($continentList); while (list($iKey, $iValue) = each($continentList)) { makeURL($onlyPCities, $showCoders, $iKey, $iValue, $iKey); } ?> - </tr> -</table> -<p> -[<a href="index.php">Back to main map page</a>] -</p> + + <td>[<a href="index.php">Back to main page</a>]</td> + </tr> + </table> +</div> + <? /* -if (isset($coderName)) { - echo "<a href=\"http://www.bat.org/help/finger.php?str=".$coderName."\"> -} +if ($showCoders && isset($coderName) && isset($wizTable[$coderName])) { + echo "<div class=\"wizinfo\">\n <table>\n <tr>\n"; + + $s = $wizTable[$coderName]["imageURL"]; + if (strlen($s) > 0) { + if (substr($s, 0, 6) == "bat://") + $s = "http://www.bat.org/albums/".substr($s, 6); + echo " <td class=\"img\"><img src=\"".$s."\" alt=\"".$coderName."\" /></td>\n"; + } + + echo " <td class=\"info\">\n"; + + echo " <h2><a href=\"http://www.bat.org/help/finger.php?str=".$coderName."\">".$coderName."</a></h2>\n"; -if (isset($coderName)) { - $coderList = array( - "Kyo" => "http://www.bat.org/albums/album47/aav.jpg", - "" => ""," - ); - if (isset($coderList[$coderName])) { - echo "<img src=\"".$coderList[$coderName]."\" /><br />\n"; + $s = $wizTable[$coderName]["desc"]; + if (strlen($s) > 0) { + echo " <p>".$s."</p>\n"; } + + echo " [<a href=\"http://www.bat.org/help/finger.php?str=".$coderName."\">Finger</a>]\n"; + $s = $wizTable[$coderName]["homeURL"]; + if (strlen($s) > 0) { + if ($s == "bat") + $s = "http://wiz.bat.org/~".strtolower($coderName)."/"; + + echo " [<a href=\"".$s."\">Homepage</a>]<br />\n"; + } + + echo " </td>\n </tr>\n </table>\n</div>\n"; } */ /* Print list of locations */ if (count($locTable) > 0) { - /* Make alphabetical table of locations */ while (list($key, $value) = each($locTable)) { @@ -215,7 +284,7 @@ if (count($value) > 0) { asort($value); echo "<h3><a name=\"".strtolower($key)."\"></a>".$key."</h3>\n"; - echo "<table width=\"95%\">\n"; + echo "<table class=\"loc\" width=\"95%\">\n"; $n = 0; while (list($ik, $iv) = each($value)) { if ($n == 0) {