view www/latest.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 7758acc2fc41
children 7f90630781a7
line wrap: on
line source

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

$showAll = isset($_REQUEST["all"]);
$locTable = mpParseLocFiles(!$showAll);

mpPrintPageHeader($pageTitle." - Latest added locations");
//echo "<div><b>DEVELOPMENT VERSION</b></div>";
?>
<h1>Latest added locations</h1>

<div class="attnbox">
The dates presented are supposed to be the date when area was added in the game.
<b>However, this information can be inaccurate for various reasons</b>; 
<a href="faq.php#6">please read our FAQ item concerning the accuracy of
the information presented here</a>. You may also be interested in the
<a href="changelog.txt">PupuMaps project changelog</a>, which lists
the changes made to the data.
</div>
<hr />
<?
$locGetNameLink = function($sdata)
{
  return "<a href=\"loc.php?a=".
    chentities($sdata["name"])."\">".
    chentities($sdata["name"])."</a>";
};


$locGetNameStr = function($sdata)
{
  return $sdata["name"];
};


// Compare two location records by addition date timestamp and primary name
function locCompare($va, $vb)
{
  if ($va["added"] > $vb["added"])
    return -1;
  else
  if ($va["added"] == $vb["added"])
    return strcmp($va["name"], $vb["name"]);
  else
    return 1;
}


echo "Currently showing ";
if ($showAll)
  echo "all locations [<a href=\"?\">Show only notable locations</a> (not including player cities)]";
else
  echo "only notable locations [<a href=\"?all\">Show all latest added locations</a> (including player cities)]";
echo "<hr />\n";


if (count($locTable) > 0)
{
  // Sort locations by timestamp ..
  foreach ($locTable as $location)
  {
    // If "nodate" is set, show locations with NO known addition timestamp
    if (isset($_REQUEST["nodate"]))
    {
      if ($location["added"] < 0)
        $sortedLocs[] = $location;
    }
    else
    {
      if ($location["added"] > 0)
        $sortedLocs[] = $location;
    }
  }

  usort($sortedLocs, "locCompare");

  // Print the list
  $totalLoc = 0;
  echo
    "<table class=\"locTable\">\n".
    " <tr>\n".
    "  <th class=\"locdate\">Date</th>\n".
    "  <th class=\"locname\">Location name</th>\n".
    "  <th class=\"loccont\">Continent</th>\n".
    ($showAll ? "  <th>Type</th>\n" : "").
    "  <th class=\"locauthor\">Author(s)</th>\n".
    "  <th class=\"locinfo\">Information</th>\n".
    " </tr>\n";

  foreach ($sortedLocs as $ik => $iv)
  {
    $totalLoc++;

    echo
      " <tr>\n".
      "  <td>".(($iv["added"] <= 0) ? "?" : mpLocFormatTime($iv))."</td>\n".
      "  <td class=\"".$iv["continent"]."\">".mpGetMapLink($iv, TRUE, TRUE, FALSE)."</td>\n".
      "  <td>".$continentList[$iv["continent"]][CTI_NAME]."</td>\n".
      ($showAll ? "  <td>".mpGetLocationTypeStr($iv["flags"])."</td>\n" : "").
      "  <td>".implode(", ", array_map(
        (($iv["flags"] & LOCF_M_MASK) == LOCF_M_PCITY) ? $locGetNameStr : $locGetNameLink,
        $iv["authors"]))."</td>\n".
      "  <td>".(isset($iv["freeform"]) ? chentities($iv["freeform"]) : "")."</td>\n".
      " </tr>\n";
  }
  echo
    "</table>\n".
    "<p><b>".$totalLoc."</b> locations.</p>\n";
}
else
{
  echo "<p><b>No locations known!</b></p>\n";
}

mpPrintPageFooter();
?>