fix bug #466878 if no folder is select to un/subscribe
[squirrelmail.git] / src / redirect.php
index 12adb1c3e885a78a8d3d2eef646bc1e8d1d095af..5f4b1b21bff244c3a419af53dce3ada17563ae6e 100644 (file)
@@ -13,9 +13,9 @@
     **  $Id$
     **/
 
-   include('../functions/i18n.php');
-   include('../functions/strings.php');
-   include('../config/config.php');
+   require_once('../functions/i18n.php');
+   require_once('../functions/strings.php');
+   require_once('../config/config.php');
 
    // Before starting the session, the base URI must be known.
    // Assuming that this file is in the src/ subdirectory (or
    session_unregister ('user_is_logged_in');
    session_register ('base_uri');
 
-   if (! isset($squirrelmail_language)) 
+   if (! isset($squirrelmail_language))
       $squirrelmail_language = '';
    set_up_language($squirrelmail_language, true);
-   
+
    if(!isset($login_username)) {
-      echo "<html><body bgcolor=\"ffffff\">\n";
+      echo "<html><body bgcolor=\"#ffffff\">\n";
       echo "<br><br>";
       echo "<center>";
       echo "<b>"._("You must be logged in to access this page.")."</b><br>";
 
    // Refresh the language cookie.
    if (isset($squirrelmail_language)) {
-      setcookie('squirrelmail_language', $squirrelmail_language, time()+2592000);
+      setcookie('squirrelmail_language', $squirrelmail_language, time()+2592000,$base_uri);
    }
 
 
-   include ('../functions/prefs.php');
-   include ('../functions/imap.php');
-   include ('../functions/plugin.php');
+   require_once('../functions/prefs.php');
+   require_once('../functions/imap.php');
+   require_once('../functions/plugin.php');
 
    if (!session_is_registered('user_is_logged_in')) {
       do_hook ('login_before');
           $login_username = strtolower($login_username);
 
       $imapConnection = sqimap_login($login_username, $key, $imapServerAddress, $imapPort, 0);
-         if (!$imapConnection) {
-             echo "<html><body bgcolor=\"ffffff\">\n";
-            echo "<br><br>";
-            echo "<center>";
-            echo "<b>"._("There was an error contacting the mail server.")."</b><br>";
-            echo _("Contact your administrator for help.")."\n";
-            echo "</center>";
-            echo "</body></html>\n";
-            exit;
-         }
+      if (!$imapConnection) {
+         echo "<html><body bgcolor=\"#ffffff\">\n";
+         echo "<br><br>";
+         echo "<center>";
+         echo "<b>"._("There was an error contacting the mail server.")."</b><br>";
+         echo _("Contact your administrator for help.")."\n";
+         echo "</center>";
+         echo "</body></html>\n";
+         exit;
+      } else {
+         $delimiter = sqimap_get_delimiter ($imapConnection);
+      }
       sqimap_logout($imapConnection);
 
       $username = $login_username;
       session_register ('username');
       setcookie('key', $key, 0, $base_uri);
+      setcookie('delimiter', $delimiter, 0, $base_uri);
       do_hook ('login_verified');
    }