Fix help footer, do some lib housekeeping and improve parse function.
This commit is contained in:
parent
240f121298
commit
adcd4166c6
73
public/css/help.css
Normal file
73
public/css/help.css
Normal file
|
@ -0,0 +1,73 @@
|
|||
:root {
|
||||
--font-size: 14px;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: var(--font-size);
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background-image: url('/img/background.jpg');
|
||||
padding: 2rem;
|
||||
}
|
||||
table {
|
||||
border-style: none;
|
||||
padding: 0px;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background-color: white;
|
||||
}
|
||||
td {
|
||||
border-style: none;
|
||||
padding: 3px;
|
||||
vertical-align: top;
|
||||
}
|
||||
td.top {
|
||||
border-bottom: solid 2px black;
|
||||
}
|
||||
td.left {
|
||||
width: 150px;
|
||||
border-right: solid 2px black;
|
||||
}
|
||||
td.right {
|
||||
width: 150px;
|
||||
border-left: solid 2px black;
|
||||
}
|
||||
a {
|
||||
color: #663300;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
a:hover {
|
||||
color: #330000;
|
||||
}
|
||||
.small {
|
||||
font: 10px verdana;
|
||||
}
|
||||
.highlight {
|
||||
color: red;
|
||||
}
|
||||
.light {
|
||||
color: #999999;
|
||||
}
|
||||
.title {
|
||||
border: solid 1px black;
|
||||
background-color: #eeeeee;
|
||||
font-weight: bold;
|
||||
padding: 5px;
|
||||
margin: 3px;
|
||||
}
|
||||
.copyright {
|
||||
border: solid 1px black;
|
||||
background-color: #eeeeee;
|
||||
font: 10px verdana;
|
||||
}
|
||||
|
||||
footer {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
font-size: 0.8rem;
|
||||
padding: 0.5rem;
|
||||
margin-top: 2rem;
|
||||
}
|
|
@ -84,7 +84,7 @@ function dotown()
|
|||
if ($controlrow["shownews"] == 1) {
|
||||
$newsrow = db()->query('SELECT * FROM news ORDER BY id DESC LIMIT 1;')->fetchArray(SQLITE3_ASSOC);
|
||||
$townrow["news"] = '<div class="title">Latest News</div>';
|
||||
$townrow["news"] .= "<span class=\"light\">[".prettydate($newsrow["postdate"])."]</span><br>".nl2br($newsrow["content"]);
|
||||
$townrow["news"] .= "<span class=\"light\">[".pretty_date($newsrow["postdate"])."]</span><br>".nl2br($newsrow["content"]);
|
||||
}
|
||||
|
||||
// Who's Online. Currently just members. Guests maybe later.
|
||||
|
|
|
@ -59,7 +59,7 @@ function donothing()
|
|||
because mistakes in the database content may result in script errors or your game breaking completely.
|
||||
HTML;
|
||||
|
||||
admindisplay($page, "Admin Home");
|
||||
display_admin($page, "Admin Home");
|
||||
}
|
||||
|
||||
function primary()
|
||||
|
@ -86,10 +86,10 @@ function primary()
|
|||
$form['gamename'], $form['gamesize'], $form['class1name'], $form['class2name'], $form['class3name'], $form['gameopen'], $form['verifyemail'], $form['gameurl'], $form['adminemail'], $form['shownews'], $form['showonline'], $form['showbabble']
|
||||
]);
|
||||
|
||||
admindisplay("Settings updated.", "Main Settings");
|
||||
display_admin("Settings updated.", "Main Settings");
|
||||
} else {
|
||||
$errorlist = ul_from_validate_errors($form['errors']);
|
||||
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Main Settings");
|
||||
display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Main Settings");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ function primary()
|
|||
if ($controlrow["gameopen"] == 1) { $controlrow["open1select"] = "selected=\"selected\" "; } else { $controlrow["open1select"] = ""; }
|
||||
if ($controlrow["gameopen"] == 0) { $controlrow["open0select"] = "selected=\"selected\" "; } else { $controlrow["open0select"] = ""; }
|
||||
|
||||
admindisplay(parsetemplate($page, $controlrow), "Main Settings");
|
||||
display_admin(parse($page, $controlrow), "Main Settings");
|
||||
}
|
||||
|
||||
function items()
|
||||
|
@ -143,7 +143,7 @@ function items()
|
|||
}
|
||||
|
||||
if (!$hasItems) $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n";
|
||||
admindisplay($page . "</table>", "Edit Items");
|
||||
display_admin($page . "</table>", "Edit Items");
|
||||
}
|
||||
|
||||
function edititem($id)
|
||||
|
@ -163,10 +163,10 @@ function edititem($id)
|
|||
db()->query('UPDATE items SET name=?, type=?, buycost=?, attribute=?, special=? WHERE id=?;', [
|
||||
$n, $_POST['type'] ?? 0, $bc, $a, $s, $id
|
||||
]);
|
||||
admindisplay("Item updated.","Edit Items");
|
||||
display_admin("Item updated.","Edit Items");
|
||||
} else {
|
||||
$errorlist = implode('<br>', $errors);
|
||||
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Items");
|
||||
display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Items");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ function edititem($id)
|
|||
if ($item["type"] == 2) { $item["type2select"] = "selected=\"selected\" "; } else { $item["type2select"] = ""; }
|
||||
if ($item["type"] == 3) { $item["type3select"] = "selected=\"selected\" "; } else { $item["type3select"] = ""; }
|
||||
|
||||
admindisplay(parsetemplate($page, $item), "Edit Items");
|
||||
display_admin(parse($page, $item), "Edit Items");
|
||||
}
|
||||
|
||||
function drops()
|
||||
|
@ -219,7 +219,7 @@ function drops()
|
|||
|
||||
if (!$has_drops) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No drops found.</td></tr>\n"; }
|
||||
|
||||
admindisplay($page . "</table>", "Edit Drops");
|
||||
display_admin($page . "</table>", "Edit Drops");
|
||||
}
|
||||
|
||||
function editdrop($id)
|
||||
|
@ -241,10 +241,10 @@ function editdrop($id)
|
|||
db()->query('UPDATE drops SET name=?, mlevel=?, attribute1=?, attribute2=? WHERE id=?;', [
|
||||
$n, $ml, $a, $a2, $id
|
||||
]);
|
||||
admindisplay("Item updated.","Edit Drops");
|
||||
display_admin("Item updated.","Edit Drops");
|
||||
} else {
|
||||
$errorlist = implode('<br>', $errors);
|
||||
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Drops");
|
||||
display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Drops");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ function editdrop($id)
|
|||
defensepower - total defense power
|
||||
HTML;
|
||||
|
||||
admindisplay(parsetemplate($page, $drop), "Edit Drops");
|
||||
display_admin(parse($page, $drop), "Edit Drops");
|
||||
}
|
||||
|
||||
function towns()
|
||||
|
@ -292,7 +292,7 @@ function towns()
|
|||
|
||||
if (!$has_towns) $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No towns found.</td></tr>\n";
|
||||
|
||||
admindisplay($page . "</table>", "Edit Towns");
|
||||
display_admin($page . "</table>", "Edit Towns");
|
||||
}
|
||||
|
||||
function edittown($id)
|
||||
|
@ -322,10 +322,10 @@ function edittown($id)
|
|||
db()->query('UPDATE towns SET name=?, latitude=?, longitude=?, innprice=?, mapprice=?, travelpoints=?, itemslist=? WHERE id=?;', [
|
||||
$n, $la, $lo, $ip, $mp, $tp, $il, $id
|
||||
]);
|
||||
admindisplay("Town updated.", "Edit Towns");
|
||||
display_admin("Town updated.", "Edit Towns");
|
||||
} else {
|
||||
$errorlist = implode('<br>', $errors);
|
||||
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Towns");
|
||||
display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Towns");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ function edittown($id)
|
|||
</form>
|
||||
HTML;
|
||||
|
||||
admindisplay(parsetemplate($page, $row), "Edit Towns");
|
||||
display_admin(parse($page, $row), "Edit Towns");
|
||||
}
|
||||
|
||||
function monsters()
|
||||
|
@ -376,7 +376,7 @@ function monsters()
|
|||
|
||||
if (!$has_monsters) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No monsters found.</td></tr>\n"; }
|
||||
|
||||
admindisplay($page."</table>", "Edit Monster");
|
||||
display_admin($page."</table>", "Edit Monster");
|
||||
}
|
||||
|
||||
function editmonster($id)
|
||||
|
@ -403,10 +403,10 @@ function editmonster($id)
|
|||
db()->query('UPDATE monsters SET name=?, maxhp=?, maxdam=?, armor=?, level=?, maxexp=?, maxgold=?, immune=? WHERE id=?;', [
|
||||
$n, $mh, $md, $a, $l, $me, $mg, $_POST['immune'] ?? 0, $id
|
||||
]);
|
||||
admindisplay("Monster updated.", "Edit monsters");
|
||||
display_admin("Monster updated.", "Edit monsters");
|
||||
} else {
|
||||
$errorlist = implode('<br>', $errors);
|
||||
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit monsters");
|
||||
display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit monsters");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ function editmonster($id)
|
|||
if ($row["immune"] == 2) { $row["immune2select"] = "selected=\"selected\" "; } else { $row["immune2select"] = ""; }
|
||||
if ($row["immune"] == 3) { $row["immune3select"] = "selected=\"selected\" "; } else { $row["immune3select"] = ""; }
|
||||
|
||||
admindisplay(parsetemplate($page, $row), "Edit Monsters");
|
||||
display_admin(parse($page, $row), "Edit Monsters");
|
||||
}
|
||||
|
||||
function spells()
|
||||
|
@ -451,7 +451,7 @@ function spells()
|
|||
|
||||
if (!$has_spells) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
|
||||
|
||||
admindisplay($page."</table>", "Edit Spells");
|
||||
display_admin($page."</table>", "Edit Spells");
|
||||
}
|
||||
|
||||
function editspell($id)
|
||||
|
@ -470,10 +470,10 @@ function editspell($id)
|
|||
db()->query('UPDATE spells SET name=?, mp=?, attribute=?, type=? WHERE id=?;', [
|
||||
$n, $mp, $a, $_POST['type'] ?? 0, $id
|
||||
]);
|
||||
admindisplay("Spell updated.", "Edit Spells");
|
||||
display_admin("Spell updated.", "Edit Spells");
|
||||
} else {
|
||||
$errorlist = implode('<br>', $errors);
|
||||
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Spells");
|
||||
display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Spells");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@ function editspell($id)
|
|||
if ($row["type"] == 4) { $row["type4select"] = "selected=\"selected\" "; } else { $row["type4select"] = ""; }
|
||||
if ($row["type"] == 5) { $row["type5select"] = "selected=\"selected\" "; } else { $row["type5select"] = ""; }
|
||||
|
||||
admindisplay(parsetemplate($page, $row), "Edit Spells");
|
||||
display_admin(parse($page, $row), "Edit Spells");
|
||||
}
|
||||
|
||||
function levels()
|
||||
|
@ -522,12 +522,12 @@ function levels()
|
|||
</form>
|
||||
HTML;
|
||||
|
||||
admindisplay($page, "Edit Levels");
|
||||
display_admin($page, "Edit Levels");
|
||||
}
|
||||
|
||||
function editlevel()
|
||||
{
|
||||
if (!isset($_POST["level"])) admindisplay("No level to edit.", "Edit Levels");
|
||||
if (!isset($_POST["level"])) display_admin("No level to edit.", "Edit Levels");
|
||||
$id = $_POST["level"];
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
|
@ -594,10 +594,10 @@ function editlevel()
|
|||
$three_exp, $three_hp, $three_mp, $three_tp, $three_strength, $three_dexterity, $three_spells,
|
||||
$id
|
||||
]);
|
||||
admindisplay("Level updated.", "Edit Levels");
|
||||
display_admin("Level updated.", "Edit Levels");
|
||||
} else {
|
||||
$errorlist = implode('<br>', $errors);
|
||||
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Spells");
|
||||
display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Spells");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -652,7 +652,7 @@ function editlevel()
|
|||
</form>
|
||||
HTML;
|
||||
|
||||
admindisplay(parsetemplate($page, $row), "Edit Levels");
|
||||
display_admin(parse($page, $row), "Edit Levels");
|
||||
}
|
||||
|
||||
function users()
|
||||
|
@ -669,7 +669,7 @@ function users()
|
|||
|
||||
if (!$has_users) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
|
||||
|
||||
admindisplay($page."</table>", "Edit Users");
|
||||
display_admin($page."</table>", "Edit Users");
|
||||
}
|
||||
|
||||
function edituser($id)
|
||||
|
@ -787,10 +787,10 @@ function edituser($id)
|
|||
$slot3name, $dropcode, $spells, $towns, $id
|
||||
]);
|
||||
|
||||
admindisplay("User updated.", "Edit Users");
|
||||
display_admin("User updated.", "Edit Users");
|
||||
} else {
|
||||
$errorlist = implode('<br>', $errors);
|
||||
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Users");
|
||||
display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Edit Users");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -883,7 +883,7 @@ function edituser($id)
|
|||
if ($row["charclass"] == 2) { $row["class2select"] = "selected=\"selected\" "; } else { $row["class2select"] = ""; }
|
||||
if ($row["charclass"] == 3) { $row["class3select"] = "selected=\"selected\" "; } else { $row["class3select"] = ""; }
|
||||
|
||||
admindisplay(parsetemplate($page, $row), "Edit Users");
|
||||
display_admin(parse($page, $row), "Edit Users");
|
||||
}
|
||||
|
||||
function addnews()
|
||||
|
@ -898,10 +898,10 @@ function addnews()
|
|||
|
||||
if (count($errors) === 0) {
|
||||
db()->query('INSERT INTO news (author, content) VALUES (?, ?);', [$userrow['username'], $c]);
|
||||
admindisplay("News post added.", "Add News");
|
||||
display_admin("News post added.", "Add News");
|
||||
} else {
|
||||
$errorlist = implode('<br>', $errors);
|
||||
admindisplay("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Add News");
|
||||
display_admin("<b>Errors:</b><br><div style=\"color:red;\">$errorlist</div><br>Please go back and try again.", "Add News");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -914,5 +914,5 @@ function addnews()
|
|||
</form>
|
||||
HTML;
|
||||
|
||||
admindisplay($page, "Add News");
|
||||
display_admin($page, "Add News");
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ function showthread($id, $start)
|
|||
|
||||
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><td colspan=\"2\" style=\"background-color:#dddddd;\"><b><a href=\"/forum\">Forum</a> :: ".$title['title']."</b></td></tr>\n";
|
||||
while ($row = $posts->fetchArray(SQLITE3_ASSOC)) {
|
||||
$page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br><br>".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n";
|
||||
$page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br><br>".pretty_date($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n";
|
||||
}
|
||||
$page .= "</table></td></tr></table><br>";
|
||||
$page .= "<table width=\"100%\"><tr><td><b>Reply To This Thread:</b><br><form action=\"/forum/reply\" method=\"post\"><input type=\"hidden\" name=\"parent\" value=\"$id\" /><input type=\"hidden\" name=\"title\" value=\"Re: ".$title["title"]."\" /><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>";
|
||||
|
|
|
@ -246,7 +246,7 @@ function main()
|
|||
[ <a href="#top">Top</a> ]
|
||||
HTML;
|
||||
|
||||
display_help(parsetemplate($page, $controlrow));
|
||||
display_help(parse($page, $controlrow));
|
||||
}
|
||||
|
||||
function items()
|
||||
|
@ -489,12 +489,16 @@ function levels()
|
|||
Experience points listed are total values up until that point. All other values are just the new amount that you gain for each level.
|
||||
HTML;
|
||||
|
||||
display_help(parsetemplate($page, $controlrow));
|
||||
display_help(parse($page, $controlrow));
|
||||
}
|
||||
|
||||
function display_help(string $content)
|
||||
{
|
||||
global $controlrow;
|
||||
$template = parsetemplate(gettemplate('help'), $controlrow);
|
||||
echo parsetemplate($template, ['content' => $content]);
|
||||
echo render('help', [
|
||||
'control' => $controlrow,
|
||||
'content' => $content,
|
||||
'version' => VERSION,
|
||||
'build' => BUILD
|
||||
]);
|
||||
}
|
||||
|
|
68
src/lib.php
68
src/lib.php
|
@ -44,46 +44,30 @@ function render(string $path_to_base_view, array $data = []): string|false
|
|||
return ob_get_clean();
|
||||
}
|
||||
|
||||
function gettemplate($templatename) { // SQL query for the template.
|
||||
|
||||
$filename = __DIR__ . "/../templates/" . $templatename . ".php";
|
||||
include("$filename");
|
||||
return $template;
|
||||
|
||||
/**
|
||||
* Replace tags with given content.
|
||||
*/
|
||||
function parse(string $template, array $array): string
|
||||
{
|
||||
return strtr($template, array_combine(
|
||||
array_map(fn($key) => "{{{$key}}}", array_keys($array)),
|
||||
array_values($array)
|
||||
));
|
||||
}
|
||||
|
||||
function parsetemplate($template, $array) { // Replace template with proper content.
|
||||
|
||||
foreach($array as $a => $b) {
|
||||
$template = str_replace("{{{$a}}}", $b, $template);
|
||||
}
|
||||
return $template;
|
||||
|
||||
}
|
||||
|
||||
function getmicrotime() { // Used for timing script operations.
|
||||
|
||||
list($usec, $sec) = explode(" ",microtime());
|
||||
return ((float)$usec + (float)$sec);
|
||||
|
||||
}
|
||||
|
||||
function prettydate($uglydate) { // Change the MySQL date format (YYYY-MM-DD) into something friendlier.
|
||||
|
||||
return date("F j, Y", mktime(0,0,0,substr($uglydate, 5, 2),substr($uglydate, 8, 2),substr($uglydate, 0, 4)));
|
||||
|
||||
}
|
||||
|
||||
function prettyforumdate($uglydate) { // Change the MySQL date format (YYYY-MM-DD) into something friendlier.
|
||||
|
||||
return date("F j, Y", mktime(0,0,0,substr($uglydate, 5, 2),substr($uglydate, 8, 2),substr($uglydate, 0, 4)));
|
||||
|
||||
}
|
||||
|
||||
function is_email($email) { // Thanks to "mail(at)philipp-louis.de" from php.net!
|
||||
|
||||
return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email));
|
||||
|
||||
/**
|
||||
* Change the SQLite3 datetime format (YYYY-MM-DD HH:MM:SS) into something friendlier.
|
||||
*/
|
||||
function pretty_date(string $uglydate): string
|
||||
{
|
||||
return date("l, F j, Y", mktime(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
substr($uglydate, 5, 2), // Month
|
||||
substr($uglydate, 8, 2), // Day
|
||||
substr($uglydate, 0, 4) // Year
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,14 +81,12 @@ function make_safe(string $content): string
|
|||
/**
|
||||
* Finalize admin page and output to browser.
|
||||
*/
|
||||
function admindisplay($content, $title)
|
||||
function display_admin($content, $title)
|
||||
{
|
||||
global $controlrow;
|
||||
|
||||
echo render('admin', [
|
||||
"title" => $title,
|
||||
"content" => $content,
|
||||
"totaltime" => round(getmicrotime() - START, 4),
|
||||
"totaltime" => round(microtime(true) - START, 4),
|
||||
"numqueries" => db()->count,
|
||||
"version" => VERSION,
|
||||
"build" => BUILD
|
||||
|
@ -227,7 +209,7 @@ function display($content, $title, bool $topnav = true, bool $leftnav = true, bo
|
|||
'rightnav' => $rightnav ? render('rightnav', ['user' => $userrow]) : '',
|
||||
"leftnav" => $leftnav ? render('leftnav', ['user' => $userrow]) : '',
|
||||
"topnav" => $topnav,
|
||||
"totaltime" => round(getmicrotime() - START, 4),
|
||||
"totaltime" => round(microtime(true) - START, 4),
|
||||
"numqueries" => db()->count,
|
||||
"version" => VERSION,
|
||||
"build" => BUILD,
|
||||
|
|
|
@ -1,85 +1,27 @@
|
|||
<?php
|
||||
|
||||
$template = <<<HTML
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{{gamename}} Help</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
background-image: url('/img/background.jpg');
|
||||
color: black;
|
||||
font: 11px verdana;
|
||||
}
|
||||
table {
|
||||
border-style: none;
|
||||
padding: 0px;
|
||||
font: 11px verdana;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background-color: white;
|
||||
}
|
||||
td {
|
||||
border-style: none;
|
||||
padding: 3px;
|
||||
vertical-align: top;
|
||||
}
|
||||
td.top {
|
||||
border-bottom: solid 2px black;
|
||||
}
|
||||
td.left {
|
||||
width: 150px;
|
||||
border-right: solid 2px black;
|
||||
}
|
||||
td.right {
|
||||
width: 150px;
|
||||
border-left: solid 2px black;
|
||||
}
|
||||
a {
|
||||
color: #663300;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
a:hover {
|
||||
color: #330000;
|
||||
}
|
||||
.small {
|
||||
font: 10px verdana;
|
||||
}
|
||||
.highlight {
|
||||
color: red;
|
||||
}
|
||||
.light {
|
||||
color: #999999;
|
||||
}
|
||||
.title {
|
||||
border: solid 1px black;
|
||||
background-color: #eeeeee;
|
||||
font-weight: bold;
|
||||
padding: 5px;
|
||||
margin: 3px;
|
||||
}
|
||||
.copyright {
|
||||
border: solid 1px black;
|
||||
background-color: #eeeeee;
|
||||
font: 10px verdana;
|
||||
}
|
||||
</style>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?= $control['gamename'] ?> Help</title>
|
||||
<link rel="stylesheet" href="/css/help.css">
|
||||
</head>
|
||||
<body>
|
||||
<a name="top"></a>
|
||||
<h1>{{gamename}} Help</h1>
|
||||
[ <a href="/">Return to the game</a> ]
|
||||
<h1><?= $control['gamename'] ?> Help</h1>
|
||||
[ <a href="/help">Back to Help</a> ]<br>
|
||||
[ <a href="/">Return to Game</a> ]
|
||||
|
||||
<br><br><hr>
|
||||
|
||||
{{content}}
|
||||
<?= $content ?>
|
||||
|
||||
<br><br>
|
||||
|
||||
<table class="copyright" width="100%"><tr>
|
||||
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">© 2003-2006 by renderse7en</td>
|
||||
</tr></table>
|
||||
<footer>
|
||||
<div>Powered by <a href="/" target="_new">Dragon Knight</a></div>
|
||||
<div>© 2024 Sharkk</div>
|
||||
<div>Version <?= $version ?> <?= $build ?></div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
HTML;
|
||||
|
|
Loading…
Reference in New Issue
Block a user