Town page no longer uses tables

This commit is contained in:
Sky Johnson 2024-12-13 13:15:04 -06:00
parent 82a2e42cb9
commit 5ea0de2ae1
4 changed files with 83 additions and 99 deletions

View File

@ -170,3 +170,12 @@ a:hover {
height: 38px;
}
div.town-content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1rem;
}
div.town-content div.options, div.town-content div.news {
grid-column: span 2;
}

View File

@ -101,34 +101,6 @@ if ($l['code'] !== 200) exit($l['code']);
if (!empty($l['middleware'])) foreach ($l['middleware'] as $middleware) $middleware();
$l['handler'](...$l['params'] ?? []);
/*
$do = explode(':', $_GET['do'] ?? '');
match ($do[0]) {
'inn' => inn(),
'buy' => buy(),
'buy2' => buy2($do[1]),
'buy3' => buy3($do[1]),
// 'sell' => sell(),
'maps' => maps(),
'maps2' => maps2($do[1]),
'maps3' => maps3($do[1]),
'gotown' => travelto($do[1]),
'move' => move(),
'fight' => fight(),
'victory' => victory(),
'drop' => drop(),
'dead' => dead(),
'verify' => header("Location: users.php?do=verify"),
'spell' => healspells($do[1]),
'showchar' => showchar(),
'onlinechar' => onlinechar($do[1]),
'showmap' => showmap(),
'babblebox' => babblebox(),
'ninja' => ninja(),
default => donothing()
};
*/
function donothing()
{
global $userrow;
@ -163,9 +135,8 @@ function dotown()
// News box. Grab latest news entry and display it. Something a little more graceful coming soon maybe.
if ($controlrow["shownews"] == 1) {
$newsrow = db()->query('SELECT * FROM news ORDER BY id DESC LIMIT 1;')->fetchArray(SQLITE3_ASSOC);
$townrow["news"] = "<table width=\"95%\"><tr><td class=\"title\">Latest News</td></tr><tr><td>\n";
$townrow["news"] = '<div class="title">Latest News</div>';
$townrow["news"] .= "<span class=\"light\">[".prettydate($newsrow["postdate"])."]</span><br>".nl2br($newsrow["content"]);
$townrow["news"] .= "</td></tr></table>\n";
}
// Who's Online. Currently just members. Guests maybe later.
@ -180,22 +151,18 @@ function dotown()
$online_rows[] = "<a href=\"/onlinechar/{$onlinerow["id"]}\">".$onlinerow["username"]."</a>";
}
$townrow["whosonline"] = "<table width=\"95%\"><tr><td class=\"title\">Who's Online</td></tr><tr><td>\n";
$townrow["whosonline"] = '<div class="title">Who\'s Online</div>';
$townrow["whosonline"] .= "There are <b>$online_count</b> user(s) online within the last 10 minutes: ";
$townrow["whosonline"] .= rtrim(implode(', ', $online_rows), ', ');
$townrow["whosonline"] .= "</td></tr></table>\n";
}
if ($controlrow["showbabble"] == 1) {
$townrow["babblebox"] = <<<HTML
<table width="95%">
<tr><td class="title">Babble Box</td></tr>
<tr><td>
<iframe src="/babblebox" name="sbox" width="100%" height="250" frameborder="0" id="bbox">
Your browser does not support inline frames! The Babble Box will not be available until you upgrade to a newer <a href="http://www.mozilla.org" target="_new">browser</a>.
</iframe>
</td></tr>
</table>
<div class="title">Babble Box</div>
<iframe src="/babblebox" name="sbox" width="100%" height="250" frameborder="0" id="bbox">
Your browser does not support inline frames! The Babble Box will not be available until you upgrade to
a newer <a href="http://www.mozilla.org" target="_new">browser</a>.
</iframe>
HTML;
}
@ -305,15 +272,13 @@ function babblebox()
redirect('/babblebox');
}
$babblebox = ["content" => ""];
$bg = 1;
$query = db()->query('SELECT * FROM babble ORDER BY id DESC LIMIT 20;');
$babblebox['content'] = '';
$query = db()->query('SELECT * FROM babble ORDER BY id DESC LIMIT 40;');
while ($babblerow = $query->fetchArray(SQLITE3_ASSOC)) {
if ($bg == 1) { $new = "<div style=\"width:98%; background-color:#eeeeee;\">[<b>".$babblerow["author"]."</b>] ".$babblerow["babble"]."</div>\n"; $bg = 2; }
else { $new = "<div style=\"width:98%; background-color:#ffffff;\">[<b>".$babblerow["author"]."</b>] ".stripslashes($babblerow["babble"])."</div>\n"; $bg = 1; }
$new = "<div class=\"message\">[<b>{$babblerow["author"]}</b>] {$babblerow["babble"]}</div>\n";
$babblebox["content"] = $new . $babblebox["content"];
}
$babblebox["content"] .= "<center><form action=\"/babblebox\" method=\"post\"><input type=\"text\" name=\"babble\" size=\"15\" maxlength=\"120\" /><br><input type=\"submit\" name=\"submit\" value=\"Babble\" /> <input type=\"reset\" name=\"reset\" value=\"Clear\" /></form></center>";
$babblebox["content"] .= '<form action="/babblebox" method="post" style="margin-top: 1rem;"><input type="text" name="babble" maxlength="255" style="width: 100%;"><br><input type="submit" name="submit" value="Babble"><input type="reset" name="reset" value="Clear"></form>';
echo parsetemplate("<html>\n" . gettemplate("babblebox"), $babblebox);
}

View File

@ -1,34 +1,44 @@
<?php
$template = <<<THEVERYENDOFYOU
$template = <<<HTML
<head>
<title>shoutbox</title>
<style type="text/css">
body {
background-image: url(/img/background.jpg);
color: black;
font: 11px verdana;
margins: 0px;
padding: 0px;
}
div {
padding: 2px;
border: solid 1px black;
margin: 2px;
text-align: left;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
</style>
<title>Babblebox</title>
<style type="text/css">
body {
background-image: url(/img/background.jpg);
color: black;
font: 11px verdana;
margin: 0px;
padding: 0px;
}
div {
padding: 2px;
border: solid 1px black;
margin: 2px;
text-align: left;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
div.message {
background-color: white;
}
div.message:nth-child(even) {
background-color: #eeeeee;
}
</style>
</head>
<body onload="window.scrollTo(0,99999)">
{{content}}
{{content}}
</body>
</html>
THEVERYENDOFYOU;
?>
HTML;

View File

@ -1,26 +1,26 @@
<?php
$template = <<<THEVERYENDOFYOU
<table width="100%">
<tr><td class="title"><img src="/img/town_{{id}}.gif" alt="Welcome to {{name}}" title="Welcome to {{name}}" /></td></tr>
<tr><td>
<b>Town Options:</b><br>
<ul>
<li /><a href="/inn">Rest at the Inn</a>
<li /><a href="/buy">Buy Weapons/Armor</a>
<li /><a href="/maps">Buy Maps</a>
</ul>
</td></tr>
<tr><td><center>
{{news}}
<br>
<table width="95%">
<tr><td width="50%">
{{whosonline}}
</td><td>
{{babblebox}}
</td></tr>
</table>
</td></tr>
</table>
THEVERYENDOFYOU;
?>
$template = <<<HTML
<div class="town-content">
<div class="options">
<div class="title"><img src="/img/town_{{id}}.gif" alt="Welcome to {{name}}" title="Welcome to {{name}}"></div>
<b>Town Options:</b><br>
<ul>
<li><a href="/inn">Rest at the Inn</a></li>
<li><a href="/buy">Buy Weapons/Armor</a></li>
<li><a href="/maps">Buy Maps</a></li>
</ul>
</div>
<div class="news">
{{news}}
</div>
<div class="whos-online">
{{whosonline}}
</div>
<div class="babblebox">
{{babblebox}}
</div>
</div>
HTML;