view www/info.php @ 2620:164aa519640d

Use 'author' instead of 'creator' or 'coder'.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 16 Feb 2024 23:50:59 +0200
parents 5c04ea63bf29
children 78ad0e51b7b5
line wrap: on
line source

<?php
require "config.inc.php";
require "world.inc.php";
require "common.inc.php";

/* Page start
 */
mpPrintPageHeader($pageTitle." - Wizards of the Realm");

echo
  "<h1>Wizards of the Realm</h1>\n".
  "<div class=\"attnbox\">\n".
  "  <b>Notice #1</b>: The area counts are not really accurate, as the database MOSTLY ".
  "lists areas accessible from outworld. Thus areas only accessible via some ".
  "other fashion MIGHT not be listed. Also, maintainerships of some areas are not ".
  "clear, and may be credited to wrong wizard(s).\n".
  "  <br />\n".
  "\n".
  "  <b>Notice #2</b>: Not everyone who has once been immortal is listed. ".
  "Some purged and/or remorted wizards without known contributions are unlisted.\n".
  "  <br />\n".
  "\n".
  "  <b>Notice #3</b>: It is certainly possible, that some of this information is ".
  "incorrect. Sorry for that. Please report to ".burl("Ggr").", if you have Knowledge(tm).\n".
  "</div>\n".
  "<hr />\n".
  "<div style=\"text-align: center;\">\n".
  " <table class=\"locWizHasInfo\">\n".
  "  <tr>\n".
  "   <td class=\"locWizHasDesc\">Entry has information about the wizard.</td>\n".
  "   <td class=\"locWizHasNoDesc\">No wizard information entry.</td>\n".
  "  </tr>\n".
  " </table>\n".
  "</div>\n";

$locTable = apcu_fetch("info_locTable");
if (empty($locTable))
{
  $locTable = mpParseLocFiles(TRUE);
  apcu_store("info_locTable", $locTable, 3600);
}
$wizTable = apcu_fetch("wizTable");
if (empty($wizTable))
{
  $wizTable = mpReadWizInfoFiles();
  apcu_store("wizTable", $wizTable, 3600);
}


function wizardSort($a, $b)
{
  return strcmp($a["name"], $b["name"]);
}


/* Print table of wizards
 */
foreach ($locTable as $location)
{
  foreach ($location["authors"] as $wiz)
  {
    $name = $wiz["name"];
    if (!isset($wizTable[$name]))
      $wizTable[$name] = array("name" => $name, "areas" => 0);
    $wizTable[$name]["areas"]++;
  }
}

if (count($wizTable) > 0)
{
  /* Make alphabetically sorted table of wizards
   */
  foreach ($wizTable as $alpha => $data)
    $alphaTable[$alpha[0]][] = $data;

  ksort($alphaTable, SORT_STRING);


  /* Print wizards alphabetically per first character of name
   */
  $totalWiz = 0;
  $maxRow = 6;
  foreach ($alphaTable as $alpha => $data)
  if (count($data) > 0)
  {
    usort($data, "wizardSort");

    $letter = strtoupper($alpha);
    echo "<h3><a id=\"ch".$letter."\"></a>".$letter."</h3>\n";
    echo "<div class=\"locTable\">\n";
    $n = 0;

    foreach ($data as $wizard)
    {
      $totalWiz++;

      echo
        "  <div class=\"locWizard ".((count($wizard) > 2 || isset($wizard["desc"])) ? "locWizHasDesc" : "locWizHasNoDesc")."\">".
        "<a href=\"loc.php?a=".$wizard["name"]."\">".$wizard["name"]."</a>";

      if ($wizard["areas"] > 0)
        echo " <span class=\"locWizNumAreas\">(".$wizard["areas"].")</span>";

      echo "</div>\n";
    }

    echo "</div>\n";
  }

  echo "<p><b>".$totalWiz."</b> wizards.</p>\n".
    "</div>\n"; // end of contents div

  // Print out the alpha link index
  mpPrintExtraBoxAlphaList("ch", $alphaTable);
}
else
{
  echo "<p><b>No wizards known!</b></p>\n".
    "</div>\n"; // end of contents div
}

mpPrintPageFooter(FALSE);
?>