drop obsolete parameter, thanks Tomas Kuliavas for finding
[squirrelmail.git] / src / redirect.php
index ce067196dd2dea479257b3752210cf75b3460799..bfa88bef29fb2eb8058864169c7c7cc524b0b729 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Derived from webmail.php by Ralf Kraudelt <kraude@wiwi.uni-rostock.de>
  *
- * @copyright &copy; 1999-2006 The SquirrelMail Project Team
+ * @copyright &copy; 1999-2007 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -35,8 +35,8 @@ sqGetGlobalVar('secretkey', $secretkey);
 if(!sqGetGlobalVar('squirrelmail_language', $squirrelmail_language) || $squirrelmail_language == '') {
     $squirrelmail_language = $squirrelmail_default_language;
 }
-if (!sqgetGlobalVar('mailto', $mailto)) {
-    $mailto = '';
+if (!sqgetGlobalVar('mailtodata', $mailtodata)) {
+    $mailtodata = '';
 }
 
 /* end of get globals */
@@ -52,7 +52,7 @@ if (!isset($login_username)) {
 }
 
 if (!sqsession_is_registered('user_is_logged_in')) {
-    do_hook ('login_before');
+    do_hook('login_before', $null);
 
     $onetimepad = OneTimePadCreate(strlen($secretkey));
     $key = OneTimePadEncrypt($secretkey, $onetimepad);
@@ -70,7 +70,7 @@ if (!sqsession_is_registered('user_is_logged_in')) {
 
     /* regenerate the session id to avoid session hyijacking */
     sqsession_destroy();
-    sqsession_is_active();
+    @sqsession_is_active();
     session_regenerate_id();
     /**
      * The cookie part. session_start and session_regenerate_session normally set
@@ -79,13 +79,9 @@ if (!sqsession_is_registered('user_is_logged_in')) {
      * function which gives us full control how the cookie is set. We do that
      * to add the HttpOnly cookie attribute which blocks javascript access on
      * IE6 SP1.
-     * sqsetcookieflush is needed to send out the headers. sqsetcookie caches
-     * the cookies to be send. If we don't do that we only can send 1 single cookie
-     * which is not sufficient.
      */
     sqsetcookie(session_name(),session_id(),false,$base_uri);
     sqsetcookie('key', $key, false, $base_uri);
-    sqsetcookieflush();
 
     sqsession_register($onetimepad, 'onetimepad');
 
@@ -106,12 +102,17 @@ if (!sqsession_is_registered('user_is_logged_in')) {
     sqsession_register($sqimap_capabilities, 'sqimap_capabilities');
     $delimiter = sqimap_get_delimiter ($imapConnection);
 
+    if (isset($sqimap_capabilities['NAMESPACE']) && $sqimap_capabilities['NAMESPACE'] == true) {
+        $namespace = sqimap_get_namespace($imapConnection);
+        sqsession_register($namespace, 'sqimap_namespace');
+    }
+
     sqimap_logout($imapConnection);
     sqsession_register($delimiter, 'delimiter');
 
     $username = $login_username;
     sqsession_register ($username, 'username');
-    do_hook ('login_verified');
+    do_hook('login_verified', $null);
 }
 
 /* Set the login variables. */
@@ -128,11 +129,9 @@ $attachment_common_types_parsed = array();
 sqsession_register($attachment_common_types, 'attachment_common_types');
 sqsession_register($attachment_common_types_parsed, 'attachment_common_types_parsed');
 
-$debug = false;
-
 if ( sqgetGlobalVar('HTTP_ACCEPT', $http_accept, SQ_SERVER) &&
     !isset($attachment_common_types_parsed[$http_accept]) ) {
-    attachment_common_parse($http_accept, $debug);
+    attachment_common_parse($http_accept);
 }
 
 /* Complete autodetection of Javascript. */
@@ -150,15 +149,15 @@ if ( sqgetGlobalVar('session_expired_location', $session_expired_location, SQ_SE
             // of the last page
             $redirect_url = $session_expired_location;
         } else {
-            $redirect_url = $location.'/webmail.php?right_frame='.urldecode($session_expired_location);
+            $redirect_url = $location.'/webmail.php?right_frame='.urlencode($session_expired_location);
         }
     }
     unset($session_expired_location);
 }
 
-if($mailto != '') {
-    $redirect_url  = $location . '/webmail.php?right_frame=compose.php&mailto=';
-    $redirect_url .= urlencode($mailto);
+if($mailtodata != '') {
+    $redirect_url  = $location . '/webmail.php?right_frame=compose.php&mailtodata=';
+    $redirect_url .= urlencode($mailtodata);
 }
 
 /* Write session data and send them off to the appropriate page. */
@@ -168,11 +167,9 @@ exit;
 
 /* --------------------- end main ----------------------- */
 
-function attachment_common_parse($str, $debug) {
+function attachment_common_parse($str) {
     global $attachment_common_types, $attachment_common_types_parsed;
 
-    $attachment_common_types_parsed[$str] = true;
-
     /*
      * Replace ", " with "," and explode on that as Mozilla 1.x seems to
      * use "," to seperate whilst IE, and earlier versions of Mozilla use
@@ -192,4 +189,7 @@ function attachment_common_parse($str, $debug) {
         }
     }
     sqsession_register($attachment_common_types, 'attachment_common_types');
+
+    /* mark as parsed */
+    $attachment_common_types_parsed[$str] = true;
 }