Mercurial > hg > fapweb
view index.php @ 629:894a4a6bfb5f fap2013
Better fix for the DB migration issue.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 01 Nov 2014 07:03:10 +0200 |
parents | 167ca3827c31 |
children | 9a948144dcc9 |
line wrap: on
line source
<? // // FAPWeb - Simple Web-based Demoparty Management System // Main HTML page wrapper // (C) Copyright 2012-2014 Tecnic Software productions (TNSP) // require_once "mconfig.inc.php"; require_once "msite.inc.php"; require_once "msession.inc.php"; // Switch to https first, if needed $isSecurePage = isset($_GET["page"]) && array_key_exists($_GET["page"], $securePages); if (!stCheckHTTPS() && $isSecurePage) { header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); exit; } // Check for cache-controlled pages $noCache = $isSecurePage && $securePages[$_GET["page"]]; if ($noCache) stSetupCacheControl(); // Start output cmPrintPageHeader($pageTitle, ($noCache ? " <meta http-equiv=\"Pragma\" content=\"no-cache\" />\n" : ""). " <meta name=\"viewport\" content=\"width=device-width\" />\n"); // Initiate SQL database connection if (!stConnectSQLDB()) { // Error occured, bail out early cmPrintPageFooter(); exit; } // Fetch non-"hardcoded" settings from SQL database stReloadSettings(); // Get the name of the page $pagePath = "pages/"; $pageExt = ".inc.php"; $pageName = isset($_GET["page"]) ? $_GET["page"] : stGetSetting("defaultPage"); $pageBasename = basename($pageName); $currPagename = ""; // Default to set default page if selected page does not exist if (!file_exists($pagePath.$pageBasename.$pageExt)) $pageBasename = stGetSetting("defaultPage"); else $currPagename = $pageBasename; // Output the page menu etc. echo "<div id=\"header\">\n". stGetSetting("siteInfoText"). " <div id=\"menu\">\n". " ".stGetSetting("siteMenuHeader")."\n". " <div id=\"menuInner\">\n". stGetMainPageLink("about", "About"). stGetMainPageLink("news", "News", stGetSetting("showNews")). stGetMainPageLink("compos", "Compos", stGetSetting("showCompos")). stGetMainPageLink("schedule", "Schedule", stGetSetting("showSchedule")); if (stGetSetting("showAttendees")) echo stGetMainPageLink("visitors", "Visitors"); else if (stChkSetting("allowRegister")) echo stGetMainPageLink("register", "Register"); $visibility = stAdmSessionAuth(TRUE); echo stGetMainPageLink("vote", "Vote", stGetSetting("allowVoting")). stGetMainPageLink("results", "Results", $visibility || stGetSetting("showResults")). stGetMainPageLink("admin.php", "Admin", $visibility || stGetSetting("showAdmin")). stGetSetting("siteMenuFooter"). " </div>\n". " </div>\n". "</div>\n". "<div id=\"infobox\">".$pageBasename."</div>\n"; ?> <div id="mainContent"> <div id="mainContentInner"> <div id="mainContentWrap"> <? if (file_exists($pagePath.$pageBasename.$pageExt)) include($pagePath.$pageBasename.$pageExt); ?> </div> </div> </div> <? echo stGetSetting("siteExtraHTML"); cmPrintPageFooter(); ?>