Mercurial > hg > fapweb
view admin.php @ 1069:5f92fa5e683a
Refactor how the "AJAX" stuff works.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 24 Jan 2017 17:25:48 +0200 |
parents | ffacd904fd1f |
children | e23057465ca2 |
line wrap: on
line source
<? // // FAPWeb - Simple Web-based Demoparty Management System // Party administration page frontend module // (C) Copyright 2012-2015 Tecnic Software productions (TNSP) // $sessionType = "admin"; require_once "mconfig.inc.php"; require_once "msite.inc.php"; require_once "msession.inc.php"; function stLoginContent() { echo "<div id=\"adminContent\">\n<div id=\"adminLogin\">"; } function stLoginFooter() { echo "</div>\n"; cmPrintPageFooter(); } // Switch to https first, if needed if (!stCheckHTTPS()) { header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); exit; } // Start output $pageCSS = "css/admin.css"; cmPrintPageHeader("FAPWeb Administration", " <meta http-equiv=\"Pragma\" content=\"no-cache\" />\n". " <script type=\"text/javascript\" src=\"admajax.js.php\"></script>\n". " <script type=\"text/javascript\" src=\"genajax.js\"></script>\n", FALSE); // Initiate SQL database connection if (!stConnectSQLDB()) { // Error occured, bail out early cmPrintPageFooter(); exit; } // Fetch non-"hardcoded" settings from SQL database stReloadSettings(); // Check if sessions are enabled if (!stChkSetting("admPassword")) { stLoginContent(); echo "<h1>Oh noes, admin configuration not done!</h1>\n". "<p>Better go and prod that, so you get to use the fine admin interface.</p>\n"; stLoginFooter(); exit; } else if (!stAdmSessionAuth(FALSE)) { // Perform authentication if we are not in session already stLoginContent(); echo "<h1>Party admin login</h1>\n". "<p>Please use illegal telepathy over HTTP to provide a ". "password to enter the party administration systembolaget.</p>\n". "\n". " ".stGetFormStart("admlogin", "admlogin.php"). " ".stGetFormHiddenInput("mode", "check")."\n". " ".stGetFormPasswordInput("admpass", "", "", "autofocus=\"autofocus\"")."\n". " ".stGetFormSubmitInput("submit", "Login")."\n". " </form>\n". "\n". "<p>[<a href=\"".stGetSetting("defaultPage")."\">Return to the main page</a>].</p>\n"; stLoginFooter(); exit; } else { ?> <script type="text/javascript" src="admin.js"></script> <!-- ========================== --> <div id="adminPopup"></div> <div id="adminContent"> <div id="nstatus">-</div> <div id="tabHeadersCC" class="tabHeaders"></div> <div id="tabContentsCC" class="tabContents"> <noscript> <h1>Ehm, you need to enable JavaScript to use the admin interface.</h1> </noscript> </div> <script type="text/javascript"> jsRegisterTab("CC", "Settings", "Settings"); jsRegisterTab("CC", "News", "News"); jsRegisterTab("CC", "Attendees", "Attendees"); jsRegisterTab("CC", "Voting", "Voting"); jsRegisterTab("CC", "Compos", "Compos"); jsRegisterTab("CC", "Entries", "Entries"); jsRegisterTab("CC", "InfoSys", "Infosystem"); jsUpdateTabList("CC", "<a class=\"admin\" href=\"admlogout.php\">Logout</a> " + "<a class=\"admin\" href=\"about\">Mainpage</a>"); jsSwitchActiveTab("CC", "Settings"); </script> <? } cmPrintPageFooter(); ?>