some more fixes to solve the vhost problem (icy cold here in the freeze)
[squirrelmail.git] / functions / strings.php
index 6cd038a13cecdbcc57596497d777e7b2830452b1..d4b5802af87bf478084cd464a065bcfd88152503 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-/**
+/** 
  * strings.php
  *
  * Copyright (c) 1999-2002 The SquirrelMail Project Team
@@ -32,7 +32,7 @@
  * SquirrelMail version number -- DO NOT CHANGE
  */
 global $version;
-$version = '1.2.2';
+$version = '1.2.3 [cvs]';
 
 /**
  * If $haystack is a full mailbox name and $needle is the mailbox
@@ -261,6 +261,20 @@ function find_mailbox_name ($mailbox) {
     
 }
 
+function php_self () {
+    global $PHP_SELF, $HTTP_SERVER_VARS;
+    
+    if (isset($PHP_SELF) && !empty($PHP_SELF)) {
+        return $PHP_SELF;
+    } else if (isset($HTTP_SERVER_VARS['PHP_SELF']) &&
+               !empty($HTTP_SERVER_VARS['PHP_SELF'])) {
+        return $HTTP_SERVER_VARS['PHP_SELF'];
+    } else {
+        return '';
+    }
+}
+
+
 /**
  * This determines the location to forward to relative to your server.
  * If this doesnt work correctly for you (although it should), you can
@@ -300,7 +314,11 @@ function get_location () {
         $host = $HTTP_HOST;
     } else if (isset($SERVER_NAME) && !empty($SERVER_NAME)) {
         $host = $SERVER_NAME;
+    } else if (isset($HTTP_SERVER_VARS['SERVER_NAME']) &&
+               !empty($HTTP_SERVER_VARS['SERVER_NAME'])) {
+        $host = $HTTP_SERVER_VARS['SERVER_NAME'];
     }
+
     
     $port = '';
     if (! strstr($host, ':')) {
@@ -585,4 +603,6 @@ function RemoveSlashes(&$array) {
     }
 }
 
+$PHP_SELF = php_self();
+
 ?>