From 399846eafde629feb72e20d8a2b1d24d247da183 Mon Sep 17 00:00:00 2001 From: graf25 Date: Sat, 6 Apr 2002 21:00:18 +0000 Subject: [PATCH] Better base_uri workaround code. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2691 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/auth.php | 8 -------- functions/display_messages.php | 25 +++++++++++++++++++------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/functions/auth.php b/functions/auth.php index 83affbe6..3ac8fc89 100644 --- a/functions/auth.php +++ b/functions/auth.php @@ -11,14 +11,6 @@ * $Id$ */ -/* If a user opens a new session then comes back to this one, - * $base_uri isn't set because it the session is invalid. - */ - -if (!isset($base_uri)) { - $base_uri = dirname(dirname($PHP_SELF)) . "/"; -} - function is_logged_in() { if ( session_is_registered('user_is_logged_in') ) { diff --git a/functions/display_messages.php b/functions/display_messages.php index adb7acff..29e1c16e 100644 --- a/functions/display_messages.php +++ b/functions/display_messages.php @@ -12,6 +12,17 @@ * $Id$ */ +function sqm_baseuri(){ + global $base_uri, $PHP_SELF; + if (isset($base_uri)){ + return $base_uri; + } + $dirs = array("|src/.*|", "|plugins/.*|", "|functions/.*|"); + $repl = array("", "", ""); + $base_uri = preg_replace($dirs, $repl, $PHP_SELF); + return $base_uri; +} + function error_username_password_incorrect() { global $frame_top, $color; /* XXX: Should really not start the HTML before this, or close off more @@ -28,8 +39,8 @@ function error_username_password_incorrect() { '' . ''. '

' . _("Unknown user or password incorrect.") . - '
' . - _("Click here to try again") . + '
' . _("Click here to try again") . '.
'. ''. ''. @@ -80,7 +91,9 @@ function error_message($message, $mailbox, $sort, $startMessage, $color) { ''. "

$message
\n". '
'. - ""; + ""; printf (_("Click here to return to %s"), $mailbox); echo '.'. ''. @@ -103,11 +116,11 @@ function logout_error( $errString, $errTitle = '' ) { GLOBAL $frame_top, $org_logo, $org_name, $org_logo_width, $org_logo_height, $hide_sm_attributions, $version; - - include_once( '../functions/page_header.php' ); + $base_uri = sqm_baseuri(); + include_once($base_uri . 'functions/page_header.php' ); if ( !isset( $org_logo ) ) { // Don't know yet why, but in some accesses $org_logo is not set. - include( '../config/config.php' ); + include( $base_uri . '../config/config.php' ); } /* Display width and height like good little people */ $width_and_height = ''; -- 2.25.1