From 450f05d2094a9da01860dd7b8a19a66dbd9755ff Mon Sep 17 00:00:00 2001 From: sjb4891 Date: Mon, 22 Jan 2001 01:35:47 +0000 Subject: [PATCH] Hack to work around link() problems experienced by r0kawa when running PHP as a cgi under windows. --- phpgwapi/inc/class.phpgw.inc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/phpgwapi/inc/class.phpgw.inc.php b/phpgwapi/inc/class.phpgw.inc.php index a70d4dd7aa..0eca99be96 100644 --- a/phpgwapi/inc/class.phpgw.inc.php +++ b/phpgwapi/inc/class.phpgw.inc.php @@ -151,6 +151,18 @@ global $phpgw, $phpgw_info, $usercookie, $kp3, $PHP_SELF; if ($url == $PHP_SELF){ $url = ""; } //fix problems when PHP_SELF if used as the param if (! $kp3) { $kp3 = $phpgw_info["user"]["kp3"]; } + + // Explicit hack to work around problems with php running as CGI on windows + // please let us know if this doesn't work for you! + if (! $url && (PHP_OS == "Windows" || PHP_OS == "OS/2" || PHP_OS == "WIN32" || PHP_OS == "WIN16")) { + $exe = strpos($PHP_SELF,"php.exe"); + if ($exe != false) { + $exe += 7; // strlen("php.exe") + $url_root = split ("/", $phpgw_info["server"]["webserver_url"]); + $url = (strlen($url_root[0])? $url_root[0].'//':'') . $url_root[2]; + $url .= substr($PHP_SELF,$exe,strlen($PHP_SELF)-$exe); + } + } if (! $url) { $url_root = split ("/", $phpgw_info["server"]["webserver_url"]); /* Some hosting providers have their paths screwy.