view index.php @ 571:ce11ea112a65

Change the header blurb a bit.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 23 May 2014 17:18:33 +0300
parents ed2247111fdd
children cec36fd24d21
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();

?>
<div id="header">
 <? echo stGetSetting("siteInfoText") ?>
</div>

<div id="menu">
  <? echo stGetSetting("siteMenuHeader") ?>

  <a href="about">About</a>
<?
if (stGetSetting("showNews"))
  echo "<a href=\"news\">News</a>\n";
?>
  <a href="compos">Compos</a>
  <a href="schedule">Schedule</a>
<?
$visibility = stAdmSessionAuth(TRUE);

if (stGetSetting("showAttendees"))
echo "  <a href=\"attendees\">Attendees</a>\n";
else
if (stChkSetting("allowRegister"))
echo "  <a href=\"register\">Register</a>\n";

if (stGetSetting("allowVoting"))
echo "  <a href=\"vote\">Vote</a>\n";

if ($visibility || stGetSetting("showResults"))
echo "  <a href=\"results\">Results</a>\n";

if ($visibility || stGetSetting("showAdmin"))
echo "  <a href=\"admin.php\">Admin</a>\n";
?>
  <? echo stGetSetting("siteMenuFooter") ?>
</div>

<?
echo stGetSetting("siteExtraHTML");

// Get the name of the page
$pagePath = "pages/";
$pageExt  = ".inc.php";
$pageName = isset($_GET["page"]) ? $_GET["page"] : stGetSetting("defaultPage");
$pageBasename = basename($pageName);

// Default to set default page if selected page does not exist
if (!file_exists($pagePath.$pageBasename.$pageExt))
  $pageBasename = stGetSetting("defaultPage");


echo "<div id=\"infobox\">".strtoupper($pageBasename)."</div>\n";
?>
<div id="mainContent">
<div>
<?
if (file_exists($pagePath.$pageBasename.$pageExt))
  include($pagePath.$pageBasename.$pageExt);
?>
</div>
</div>
<?
cmPrintPageFooter();
?>