put all the information returned from a select in the result
[squirrelmail.git] / src / redirect.php
index 52b2083839b4521dbac47f2e685ef59a85f6964d..f5eb22e9f8f54f9ad5d8a479a28753c3605bcbd0 100644 (file)
@@ -25,10 +25,10 @@ require_once('../functions/page_header.php');
 if (get_magic_quotes_gpc()) {
     global $REQUEST_METHOD;
 
-    if ($REQUEST_METHOD == "POST") {
+    if ($REQUEST_METHOD == 'POST') {
         global $HTTP_POST_VARS;
         RemoveSlashes($HTTP_POST_VARS);
-    } else if ($REQUEST_METHOD == "GET") {
+    } else if ($REQUEST_METHOD == 'GET') {
         global $HTTP_GET_VARS;
         RemoveSlashes($HTTP_GET_VARS);
     }
@@ -36,8 +36,10 @@ if (get_magic_quotes_gpc()) {
 
 /* Before starting the session, the base URI must be known. Assuming */
 /* that this file is in the src/ subdirectory (or something).        */
-ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
-$base_uri = $regs[1];
+if (!function_exists('sqm_baseuri')){
+    require_once('../functions/display_messages.php');
+}
+$base_uri = sqm_baseuri();
 
 header('Pragma: no-cache');
 $location = get_location();
@@ -54,17 +56,12 @@ if (! isset($squirrelmail_language) ||
 }
 set_up_language($squirrelmail_language, true);
 /* Refresh the language cookie. */
-setcookie('squirrelmail_language', $squirrelmail_language, time()+2592000,$base_uri);
+setcookie('squirrelmail_language', $squirrelmail_language, time()+2592000, 
+          $base_uri);
 
 if (!isset($login_username)) {
-    displayHtmlHeader( _("You must be logged in to access this page.") );
-    echo "<BODY BGCOLOR=\"#ffffff\">\n" .
-        "<BR>&nbsp;<BR>\n" .
-        "<CENTER>\n" .
-        '<B>' . _("You must be logged in to access this page.") . "</B><BR>" .
-        '<A HREF="../src/login.php">'  . _("Go to the login page") . "</A>\n" .
-        "</CENTER>\n" .
-        "</BODY></HTML>\n";
+    include_once( '../functions/display_messages.php' );
+    logout_error( _("You must be logged in to access this page.") );    
     exit;
 }
 
@@ -82,14 +79,11 @@ if (!session_is_registered('user_is_logged_in')) {
 
     $imapConnection = sqimap_login($login_username, $key, $imapServerAddress, $imapPort, 0);
     if (!$imapConnection) {
-        displayHtmlHeader( _("There was an error contacting the mail server.") );
-        echo "<body bgcolor=\"#ffffff\">\n".
-            "<br> <br>\n".
-            "<center>\n".
-            '<b>' . _("There was an error contacting the mail server.") . "</b><br>\n".
-            _("Contact your administrator for help.") . "\n".
-            "</center>\n".
-            "</body></html>\n";
+        $errTitle = _("There was an error contacting the mail server.");
+        $errString = $errTitle . "<br>\n".
+                     _("Contact your administrator for help.");
+        include_once( '../functions/display_messages.php' );
+        logout_error( _("You must be logged in to access this page.") );            
         exit;
     } else {
         $delimiter = sqimap_get_delimiter ($imapConnection);
@@ -120,12 +114,13 @@ session_register('attachment_common_types_parsed');
 
 $debug = false;
 if (isset($HTTP_SERVER_VARS['HTTP_ACCEPT']) &&
-    !isset($attachment_common_types_parsed[$HTTP_SERVER_VARS['HTTP_ACCEPT']]))
+    !isset($attachment_common_types_parsed[$HTTP_SERVER_VARS['HTTP_ACCEPT']])) {
     attachment_common_parse($HTTP_SERVER_VARS['HTTP_ACCEPT'], $debug);
+}
 if (isset($HTTP_ACCEPT) &&
-    !isset($attachment_common_types_parsed[$HTTP_ACCEPT]))
+    !isset($attachment_common_types_parsed[$HTTP_ACCEPT])) {
     attachment_common_parse($HTTP_ACCEPT, $debug);
-
+}
 
 /* Complete autodetection of Javascript. */
 $javascript_setting = getPref
@@ -149,7 +144,7 @@ setPref($data_dir, $username, 'javascript_on', $js_pref);
 /* Compute the URL to forward the user to. */
 if(isset($rcptemail)) {
     $redirect_url = 'webmail.php?right_frame=compose.php&rcptaddress=';
-    $redirect_url .= urlencode($rcptemail);
+    $redirect_url .= $rcptemail;
 } else {
     $redirect_url = 'webmail.php';
 }
@@ -177,4 +172,4 @@ function attachment_common_parse($str, $debug) {
 }
 
 
-?>
+?>
\ No newline at end of file