Mercurial > hg > batmud > maputils
diff www/loc.php @ 975:af0fc3a965dc
Fix all the web-interface PHP crap to work with the new LOC file format. Urgh. This shit could really use some refactoring cleanup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 13 Jun 2010 23:39:52 +0000 |
parents | dd5b00e9c263 |
children | 047fa29bc07e |
line wrap: on
line diff
--- a/www/loc.php Sun Jun 13 22:52:02 2010 +0000 +++ b/www/loc.php Sun Jun 13 23:39:52 2010 +0000 @@ -189,8 +189,10 @@ $alphaTable[$idx][] = $data; } else { if (isset($coderName)) { - if (array_search($coderName, $data["coders"]) !== FALSE) - $alphaTable[$idx][] = $data; + foreach ($data["coders"] as $coder) { + if ($coderName == $coder["name"]) + $alphaTable[$idx][] = $data; + } } else $alphaTable[$idx][] = $data; } @@ -256,8 +258,17 @@ } // Alternative names - if (count($iv["names"]) > 0) { - echo "<br />".chentities(implode(" | ", $iv["names"])); + $nnames = count($iv["names"]); + if ($nnames > 1) { + echo "<br />"; + for ($nname = 1; $nname < $nnames; $nname++) { + if ($iv["names"][$nname]["flags"] & NAME_ORIG) + echo "<b>"; + echo chentities($iv["names"][$nname]["name"]); + if ($iv["names"][$nname]["flags"] & NAME_ORIG) + echo "</b>"; + if ($nname < $nnames - 1) echo " | "; + } } // Coder / society names @@ -265,12 +276,19 @@ $isSG = preg_match("/[SG]/", $iv["flags"]); if ((!isset($coderName) && !$isSG) || isset($coderName)) { $fs = ""; - foreach ($iv["coders"] as $fKey => $fVal) { + foreach ($iv["coders"] as $name) { if ($fs != "") $fs .= ", "; + switch ($name["flags"]) { + case NAME_ORIG: $qs = "title=\"Original creator\""; break; + case NAME_RECODER: $qs = "title=\"Converter, recoder\""; break; + case NAME_MAINTAINER: $qs = "title=\"Maintainer\""; break; + case NAME_EXPANDER: $qs = "title=\"Implemented new content, expansion(s)\""; break; + default: $qs = ""; + } if ($filter != "C" || !$applyFilter) - $fs .= "<a href=\"".$_SERVER["PHP_SELF"]."?a=".$fVal."\">".$fVal."</a>"; + $fs .= "<a ".$qs." href=\"".$_SERVER["PHP_SELF"]."?a=".$name["name"]."\">".$name["name"]."</a>"; else - $fs .= $fVal; + $fs .= $name["name"]; } echo "<br />[".$fs."]"; }