From 85b454a07d818465b91a2c3ae507e221fc5ba7e9 Mon Sep 17 00:00:00 2001 From: graf25 Date: Sat, 6 Apr 2002 20:19:47 +0000 Subject: [PATCH] This will hopefully solve the src/src problem. I am a bit concerned about 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 | 5 ++--- src/login.php | 10 ++++++---- src/redirect.php | 6 +++--- src/signout.php | 8 ++++---- src/webmail.php | 3 +-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/functions/auth.php b/functions/auth.php index b3b26e77..0f22c8a0 100644 --- a/functions/auth.php +++ b/functions/auth.php @@ -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() { diff --git a/src/login.php b/src/login.php index fdcfc86f..57a47e93 100644 --- a/src/login.php +++ b/src/login.php @@ -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'); diff --git a/src/redirect.php b/src/redirect.php index d188c0ed..9b82bee7 100644 --- a/src/redirect.php +++ b/src/redirect.php @@ -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' ); diff --git a/src/signout.php b/src/signout.php index fae6ce9c..01aa236b 100644 --- a/src/signout.php +++ b/src/signout.php @@ -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">
- + " + TARGET="">

diff --git a/src/webmail.php b/src/webmail.php index a54d4045..c2768dc8 100644 --- a/src/webmail.php +++ b/src/webmail.php @@ -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(); -- 2.25.1