Iniitial option templating.
[squirrelmail.git] / src / login.php
index e21cc3e67fc7df33bd2a6d9dc8f854f00193a974..870d4d43b7a9dad5dc005fd78d7aaceaecf99d10 100644 (file)
@@ -31,20 +31,31 @@ require_once(SM_PATH . 'functions/forms.php');
  */
 set_up_language($squirrelmail_language, TRUE, TRUE);
 
-/*
+/**
  * In case the last session was not terminated properly, make sure
- * we get a new one.
+ * we get a new one, but make sure we preserve session_expired_*
  */
-sqsession_destroy();
 /**
  * PHP bug. http://bugs.php.net/11643 (warning, spammed bug tracker) and
  * http://bugs.php.net/13834
  * SID constant is not destroyed in PHP 4.1.2, 4.2.3 and maybe other
  * versions. Produces warning on login page. Bug should be fixed only in 4.3.0
  */
-@sqsession_is_active();
-$_SESSION=array();
-
+if ( !empty($_SESSION['session_expired_post']) && !empty($_SESSION['session_expired_location']) ) {
+    $sep = $_SESSION['session_expired_post'];
+    $sel = $_SESSION['session_expired_location'];
+
+    sqsession_destroy();
+  
+    sqsession_is_active();
+    $_SESSION=array();
+    sqsession_register($sep, 'session_expired_post');
+    sqsession_register($sel, 'session_expired_location');
+} else {
+    sqsession_destroy();
+    @sqsession_is_active();
+    $_SESSION=array();
+}
 
 /**
  * This detects if the IMAP server has logins disabled, and if so,
@@ -174,4 +185,4 @@ $oTemplate->display('login.tpl');
 
 #trigger_error('login');
 $oTemplate->display('footer.tpl');
-?>
\ No newline at end of file
+?>