Mercurial > hg > batmud > maputils
changeset 1891:68b784c7eae2
Get rid of mgeneric.inc.php here.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 06 Nov 2017 03:09:11 +0200 |
parents | 33dc25dd742b |
children | f8551f0a36cc |
files | www/common.inc.php www/faq.php www/index.php www/info.php www/latest.php www/level.php www/loc.php www/menu.inc.php www/quests.php www/simple.php www/ss.php |
diffstat | 11 files changed, 82 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/www/common.inc.php Mon Nov 06 03:07:56 2017 +0200 +++ b/www/common.inc.php Mon Nov 06 03:09:11 2017 +0200 @@ -1,5 +1,10 @@ <?php -require "mgeneric.inc.php"; +// Globals and definitions +$errorSet = FALSE; +$errorMsgs = array(); +$statusSet = 0; +$statusMsg = ""; + $wizFileList = array( "wizards.txt" @@ -27,24 +32,59 @@ -function mpGetMTimeStr($mtime) +function stError($msg) +{ + global $errorSet, $errorMsgs; + $errorSet = TRUE; + $errorMsgs[] = $msg; + return FALSE; +} + + +function stTrimIfString($val) { -// return date("D d.m.Y H:i:s T", $mtime); - return date("d.m.Y H:i", $mtime); + if (is_string($val)) + return trim($val); + else + return $val; +} + + +function stGetRequestItem($name, $default = "", $allowGet = FALSE) +{ + if ($allowGet) + return isset($_REQUEST[$name]) ? stTrimIfString($_REQUEST[$name]) : $default; + else + return isset($_POST[$name]) ? stTrimIfString($_POST[$name]) : $default; } -function mpPrintPageHeader($title, $extra = "") +function chentities($str) +{ + return htmlentities($str, ENT_NOQUOTES, "UTF-8"); +} + + +function mpPrintPageHeader($title, $extra = "", $bodyExtra = "", $useMenu = TRUE) { - global $pageTitle, $pageMapURL; + global $pageTitle, $pageMapURL, $pageCSS, $pageCharset, $pageLang; - cmPrintPageHeader($title, + echo + "<!DOCTYPE html>\n". + "<html".(isset($pageLang) ? " lang=\"".$pageLang."\"" : "").">\n". + "<head>\n". + " <meta charset=\"".$pageCharset."\">\n". + " <title>".strip_tags($pageTitle)."</title>\n". " <meta name=\"keywords\" content=\"batmud,map,laenor,lucentium,rothikgen,desolathya,furnachia,mud,mush,mmorpg,mmo,massively,multiplayer,online,network,game,ggr,pupunen\"/>\n". " <link rel=\"shortcut icon\" href=\"/maps/favicon.ico\" type=\"image/x-icon\" />\n". - $extra, FALSE); + $extra. + " <link rel=\"stylesheet\" href=\"".$pageCSS."\" type=\"text/css\" />\n". + "</head>\n". + "<body".$bodyExtra.">\n"; - require "menu.inc.php"; - + if ($useMenu) + require "menu.inc.php"; + echo "<div id=\"contents\">\n"; /* @@ -57,6 +97,22 @@ } +function mpPrintPageFooter($useContents = TRUE) +{ + if ($useContents) + echo "</div>\n"; + + echo "</body>\n</html>\n"; +} + + +function mpGetMTimeStr($mtime) +{ +// return date("D d.m.Y H:i:s T", $mtime); + return date("d.m.Y H:i", $mtime); +} + + function mpFingerURL($name) { return "http://www.bat.org/char/".$name; @@ -157,7 +213,8 @@ $file = @fopen(basename($filename.".loc"), "r"); if (!$file) return FALSE; - while (!feof($file)) { + while (!feof($file)) + { $inLine = mpChConv(trim(fgets($file))); // Ignore comments and empty lines
--- a/www/faq.php Mon Nov 06 03:07:56 2017 +0200 +++ b/www/faq.php Mon Nov 06 03:09:11 2017 +0200 @@ -3,7 +3,7 @@ require "common.inc.php"; require "mfaq.inc.php"; -mpPrintPageHeader($pageTitle, "", FALSE); +mpPrintPageHeader($pageTitle); cmPrintFAQ("Frequently Asked Questions", "faq.xml"); -cmPrintPageFooter(); +mpPrintPageFooter(); ?> \ No newline at end of file
--- a/www/index.php Mon Nov 06 03:07:56 2017 +0200 +++ b/www/index.php Mon Nov 06 03:09:11 2017 +0200 @@ -207,5 +207,5 @@ " <a href=\"/~ccr/bat/\">Ggr's Bat page</a>\n". "</div>\n"; -cmPrintPageFooter(FALSE); +mpPrintPageFooter(FALSE); ?> \ No newline at end of file
--- a/www/info.php Mon Nov 06 03:07:56 2017 +0200 +++ b/www/info.php Mon Nov 06 03:09:11 2017 +0200 @@ -118,5 +118,5 @@ echo "<p><b>No wizards known!</b></p>\n"; } -cmPrintPageFooter(); +mpPrintPageFooter(TRUE); ?> \ No newline at end of file
--- a/www/latest.php Mon Nov 06 03:07:56 2017 +0200 +++ b/www/latest.php Mon Nov 06 03:09:11 2017 +0200 @@ -94,5 +94,5 @@ echo "<p><b>No locations known!</b></p>\n"; } -cmPrintPageFooter(); +mpPrintPageFooter(); ?> \ No newline at end of file
--- a/www/level.php Mon Nov 06 03:07:56 2017 +0200 +++ b/www/level.php Mon Nov 06 03:09:11 2017 +0200 @@ -78,5 +78,5 @@ echo " <p><b>No level quests known!</b></p>\n"; } -cmPrintPageFooter(); +mpPrintPageFooter(); ?>
--- a/www/loc.php Mon Nov 06 03:07:56 2017 +0200 +++ b/www/loc.php Mon Nov 06 03:09:11 2017 +0200 @@ -442,5 +442,5 @@ stError("No locations known!"); } -cmPrintPageFooter(FALSE); +mpPrintPageFooter(FALSE); ?> \ No newline at end of file
--- a/www/menu.inc.php Mon Nov 06 03:07:56 2017 +0200 +++ b/www/menu.inc.php Mon Nov 06 03:09:11 2017 +0200 @@ -9,6 +9,7 @@ <a class="menuItem" href="loc.php?c&n=limbo">Pcities in "limbo"</a> <a class="menuItem" href="info.php">List of Wizards</a> <a class="menuItem" href="simple.php">Simple location list</a> + <a class="menuItem" href="search.php" style="color: yellow;">Map search (NEW)</a> <a class="menuItem" href="faq.php">FAQ</a> <div class="batmud"><a href="http://www.bat.org/play"><img src="img/batmud.png" alt="BatMUD - 25 Years of Adventure" /></a></div> </div>
--- a/www/quests.php Mon Nov 06 03:07:56 2017 +0200 +++ b/www/quests.php Mon Nov 06 03:09:11 2017 +0200 @@ -135,5 +135,5 @@ } echo "</div>\n"; -cmPrintPageFooter(); +mpPrintPageFooter(); ?>
--- a/www/simple.php Mon Nov 06 03:07:56 2017 +0200 +++ b/www/simple.php Mon Nov 06 03:09:11 2017 +0200 @@ -27,8 +27,9 @@ // Start of the page // $pageCSS = "simple.css"; -cmPrintPageHeader($pageTitle." - Simple locations list", - " <meta name=\"robots\" content=\"nofollow\" />\n", FALSE); +mpPrintPageHeader($pageTitle." - Simple locations list", + " <meta name=\"robots\" content=\"nofollow\" />\n", + "", FALSE); // // Print list of locations @@ -127,5 +128,5 @@ stError("No locations known!"); } -cmPrintPageFooter(FALSE); +mpPrintPageFooter(TRUE); ?> \ No newline at end of file