Index: trunk/wifidog-auth/wifidog/classes/MainUI.php
===================================================================
--- trunk/wifidog-auth/wifidog/classes/MainUI.php	(revision 1013)
+++ trunk/wifidog-auth/wifidog/classes/MainUI.php	(revision 1018)
@@ -130,4 +130,6 @@
     private $footer_scripts = array ();
 
+	private $shrink_left_area = false;
+
     /**
      * Contructor
@@ -205,4 +207,8 @@
         $this->title = $title_string;
     }
+
+    public function shrinkLeftArea() {
+		$this->shrink_left_area = true;
+	}
 
     /**
@@ -280,13 +286,8 @@
 
                     // Init ALL smarty values
-                    $this->smarty->assign('isSuperAdmin', false);
-                    $this->smarty->assign('isOwner', false);
+					User::assignSmartyValues($this->smarty, $_currentUser);
                     $this->smarty->assign('formAction', "");
                     $this->smarty->assign('nodeUI', "");
                     $this->smarty->assign('networkUI', "");
-
-                    // Define user security levels for the template
-                    $this->smarty->assign('isSuperAdmin', $_currentUser && $_currentUser->isSuperAdmin());
-                    $this->smarty->assign('isOwner', $_currentUser && $_currentUser->isOwner());
 
                     /*
@@ -359,9 +360,6 @@
                 $_currentUser = User :: getCurrentUser();
 
-                // Init ALL smarty values
-                $this->smarty->assign('networkHomepageURL', "");
-                $this->smarty->assign('networkName', "");
-                $this->smarty->assign('isValidUser', false);
-                $this->smarty->assign('username', "");
+				User::assignSmartyValues($this->smarty, $_currentUser);
+
                 $this->smarty->assign('logoutParameters', "");
                 $this->smarty->assign('loginParameters', "");
@@ -370,8 +368,8 @@
                 $this->smarty->assign('accountInformation', "");
                 $this->smarty->assign('techSupportInformation', "");
+                $this->smarty->assign('shrinkLeftArea', $this->shrink_left_area);
 
                 // Provide Smarty with information about the network
-                $this->smarty->assign('networkHomepageURL', Network :: getCurrentNetwork()->getHomepageURL());
-                $this->smarty->assign('networkName', Network :: getCurrentNetwork()->getName());
+				Network::assignSmartyValues($this->smarty);
 
                 /*
@@ -381,8 +379,4 @@
                 if ($_currentUser != null) {
                     // User is logged in
-                    $this->smarty->assign('isValidUser', true);
-
-                    // Set username for Smarty
-                    $this->smarty->assign('username', $_currentUser->getUsername());
 
                     // Detect gateway information
@@ -447,5 +441,5 @@
      *
      * @access public
-     * @internal Uses a few request parameters to displaty debug information.
+     * @internal Uses a few request parameters to display debug information.
      * If $_REQUEST['debug_request'] is present, it will print out the
      * $_REQUEST array at the top of the page.
@@ -460,6 +454,6 @@
         $this->smarty->assign('stylesheetURL', "");
         $this->smarty->assign('stylesheetParsedFile', "");
-        $this->smarty->assign('isSuperAdmin', false);
-        $this->smarty->assign('isOwner', false);
+        // $this->smarty->assign('isSuperAdmin', false);
+        // $this->smarty->assign('isOwner', false);
         $this->smarty->assign('debugRequested', false);
         $this->smarty->assign('debugOutput', "");
@@ -496,15 +490,7 @@
 
         // Get information about user
-        $_currentUser = User :: getCurrentUser();
-
-        // Define user security levels for the template
-        $this->smarty->assign('isSuperAdmin', $_currentUser && $_currentUser->isSuperAdmin());
-        $this->smarty->assign('isOwner', $_currentUser && $_currentUser->isOwner());
-
-        if (isset ($_REQUEST['debug_request']) && ($_currentUser && $_currentUser->isSuperAdmin())) {
-            // Tell Smarty everything it needs to know
-            $this->smarty->assign('debugRequested', true);
-            $this->smarty->assign('debugOutput', print_r($_REQUEST, true));
-        }
+		User::assignSmartyValues($this->smarty);
+
+		$this->appendContent('page_header', $this->customBanner());
 
         /*
@@ -537,6 +523,6 @@
      */
     function displayError($errmsg, $show_tech_support_email = true) {
-            // Init ALL smarty values
-    $this->smarty->assign("error", "");
+        // Init ALL smarty values
+    	$this->smarty->assign("error", "");
         $this->smarty->assign("show_tech_support_email", false);
         $this->smarty->assign("tech_support_email", "");
@@ -559,4 +545,32 @@
     }
 
+	static public function redirect($redirect_url, $redirect_to_title=null, $timeout=60) {
+		if (!$redirect_to_title) {
+			$network = Network :: getCurrentNetwork();
+			$redirect_to_title = $network ? sprintf(_("%s Login"), $network->getName()) : _("Login");
+		}
+
+		header("Location: $redirect_url");
+		echo "<html>\n" .
+			"<head><meta http-equiv='Refresh' content='$timeout; URL=$redirect_url'/></head>\n".
+			"<body>\n" .
+			"<noscript>\n" .
+			"<span style='display:none;'>\n" .
+			"<h1>" . $redirect_to_title . "</h1>\n" .
+			sprintf(_("Click <a href='%s'>here</a> to continue"), $redirect_url) . "<br/>\n" .
+			_("The transfer from secure login back to regular http may cause a warning.") . "\n" .
+  			"</span>\n" .
+			"</noscript>\n" .
+			"</body>\n" .
+			"</html>\n"
+			;
+		exit;
+	}
+
+	public function customBanner() {
+		$custom_banner = '';
+
+		return $custom_banner;
+	}
 }
 
