This will hopefully solve the src/src problem. I am a bit concerned about
authorgraf25 <graf25@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 6 Apr 2002 20:19:47 +0000 (20:19 +0000)
committergraf25 <graf25@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 6 Apr 2002 20:19:47 +0000 (20:19 +0000)
auth.php, since it's in functions and is, therefore, included. $PHP_SELF
can be anything in it.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2689 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/auth.php
src/login.php
src/redirect.php
src/signout.php
src/webmail.php

index b3b26e77a4ac737bee9e66f3134a71e764cb960e..0f22c8a0aa367e89939ef8c646ea8f8986868e2c 100644 (file)
@@ -15,9 +15,8 @@
  * $base_uri isn't set because it the session is invalid.
  */
 
-if (! isset($base_uri)) {
-    ereg ('(^.*/)[^/]+/[^/]+$', $PHP_SELF, $regs);
-    $base_uri = $regs[1];    
+if (!isset($base_uri)) {
+    $base_uri = dirname(dirname($PHP_SELF));
 }
 
 function is_logged_in() {
index fdcfc86f4333befa4f31e1ff752bf54a90f68940..57a47e93f3f225470d7fe66542a9af08d11a1120 100644 (file)
@@ -66,9 +66,10 @@ require_once('../functions/page_header.php');
  */
 set_up_language($squirrelmail_language, TRUE);
 
-/* Need the base URI to set the cookies. (Same code as in webmail.php). */
-ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
-$base_uri = $regs[1];
+/**
+ * Find out the base URI to set cookies.
+ */
+$base_uri = dirname(dirname($PHP_SELF));
 @session_destroy();
 
 /*
@@ -76,7 +77,8 @@ $base_uri = $regs[1];
  * we get a new one.
  */
 $cookie_params = session_get_cookie_params();
-setcookie(session_name(),'',0,$cookie_params['path'].$cookie_params['domain']);
+setcookie(session_name(), '', 0, $cookie_params['path'], 
+          $cookie_params['domain']);
 setcookie('username', '', 0, $base_uri);
 setcookie('key', '', 0, $base_uri);
 header('Pragma: no-cache');
index d188c0ed354a6c5f818ef6212d8f8fb191cd085c..9b82bee7aa8ff0e2770da716443a2bd30744749d 100644 (file)
@@ -36,8 +36,7 @@ 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];
+$base_uri = dirname(dirname($PHP_SELF));
 
 header('Pragma: no-cache');
 $location = get_location();
@@ -54,7 +53,8 @@ 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)) {
     include_once( '../functions/display_messages.php' );
index fae6ce9c7dce8de3c5deacf6edb7785c460b13f0..01aa236be52f2b7691122696502561de5ce64af0 100644 (file)
@@ -34,9 +34,8 @@ if (!isset($frame_top)) {
 
 /* If a user hits reload on the last page, $base_uri isn't set
  * because it was deleted with the session. */
-if (! isset($base_uri)) {
-    ereg ('(^.*/)[^/]+/[^/]+$', $PHP_SELF, $regs);
-    $base_uri = $regs[1];
+if (!isset($base_uri)) {
+    $base_uri = dirname(dirname($PHP_SELF));
 }
 
 do_hook('logout');
@@ -76,7 +75,8 @@ CELLPADDING="2" ALIGN="CENTER">
     <TD ALIGN="CENTER">
       <?php do_hook('logout_above_text'); ?>
       <?php echo _("You have been successfully signed out.") ?><BR>
-      <A HREF="login.php" TARGET="<?php echo $frame_top ?>">
+      <A HREF="<?php echo "$base_uri/login.php" ?>" 
+           TARGET="<?php echo $frame_top ?>">
       <?php echo _("Click here to log back in.") ?>
       </A><BR><BR>
     </TD>
index a54d4045e800fbb0073130b0642afc292beaebb3..c2768dc8bee885374c626812ec1035a675cc9f51 100644 (file)
@@ -21,8 +21,7 @@ require_once('../functions/plugin.php');
 require_once('../functions/i18n.php');
 require_once('../functions/auth.php');
 
-ereg( '(^.*/)[^/]+/[^/]+$', $PHP_SELF, $regs);
-$base_uri = $regs[1];
+$base_uri = dirname(dirname($PHP_SELF));
 
 session_start();
 is_logged_in();