changeset 347:1ef6cd391590

Move things around a bit.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 02 Dec 2013 05:35:58 +0200
parents c922e5200c55
children e48abbbbb3b2
files admin.php
diffstat 1 files changed, 42 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/admin.php	Mon Dec 02 05:02:48 2013 +0200
+++ b/admin.php	Mon Dec 02 05:35:58 2013 +0200
@@ -10,34 +10,6 @@
 require_once "msession.inc.php";
 require_once "majax.php";
 
-$pageCSS["admin.css"] = "";
-
-cmLocaleInit();
-
-// Switch to https first, if needed
-if (!stCheckHTTPS())
-{
-  header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
-  exit;
-}
-
-// Start output
-cmPrintPageHeader("FAPWeb Administration",
-  " <meta http-equiv=\"Pragma\" content=\"no-cache\" />",
-  FALSE);
-
-
-// Initiate SQL database connection
-if (!stConnectSQLDB())
-{
-  // Error occured, bail out early
-  cmPrintPageFooter();
-  exit;
-}
-
-// Fetch non-"hardcoded" settings from SQL database
-stReloadSettings();
-
 function stCreateSettingsData()
 {
   $args = array();
@@ -67,25 +39,62 @@
   "}\n";
 }
 
+function stAdminContent()
+{
+  echo "<div id=\"adminContent\">\n";
+}
+
+// Switch to https first, if needed
+if (!stCheckHTTPS())
+{
+  header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
+  exit;
+}
+
+// Start output
+$pageCSS["admin.css"] = "";
+cmLocaleInit();
+cmPrintPageHeader("FAPWeb Administration",
+  " <meta http-equiv=\"Pragma\" content=\"no-cache\" />",
+  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"))
 {
+  stAdminContent();
   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";
+  cmPrintPageFooter();
+  exit;
 }
 else
 if (!stAdmSessionAuth(FALSE))
 {
   // Perform authentication if we are not in session already
+  stAdminContent();
   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".
-    stGetFormStart("admlogin", "admlogin.php").
-    stGetFormHiddenInput("mode", "check")."\n".
-    stGetFormPasswordInput("admpass", "", "", "autofocus=\"autofocus\"")."\n".
-    stGetFormSubmitInput("submit", "Login").
-    "</form>\n";
+    " ".stGetFormStart("admlogin", "admlogin.php").
+    "  ".stGetFormHiddenInput("mode", "check")."\n".
+    "  ".stGetFormPasswordInput("admpass", "", "", "autofocus=\"autofocus\"")."\n".
+    "  ".stGetFormSubmitInput("submit", "Login")."\n".
+    " </form>\n";
+  cmPrintPageFooter();
+  exit;
 }
 else
 {