소스 검색

For the setup: try to make the URL detection work even if the actual PHP file is not part of the URL (i.e when index.php is implicitely added when browsing a folder)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1347 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 년 전
부모
커밋
b1b0f2c0bc
1개의 변경된 파일12개의 추가작업 그리고 1개의 파일을 삭제
  1. 12 1
      application/utils.inc.php

+ 12 - 1
application/utils.inc.php

@@ -419,7 +419,18 @@ class utils
 		}
 		else
 		{
-			throw new Exception("Failed to determine application root path $sAbsoluteUrl ($sCurrentRelativePath) APPROOT:'$sAppRoot'");
+			// Second attempt without index.php at the end...
+			$sCurrentRelativePath = str_replace('index.php', '', $sCurrentRelativePath);
+			$sAppRootPos = strpos($sAbsoluteUrl, $sCurrentRelativePath);
+			if ($sAppRootPos !== false)
+			{
+				$sAppRootUrl = substr($sAbsoluteUrl, 0, $sAppRootPos); // remove the current page and path
+			}
+			else
+			{
+				// No luck...
+				throw new Exception("Failed to determine application root path $sAbsoluteUrl ($sCurrentRelativePath) APPROOT:'$sAppRoot'");
+			}			
 		}
 		return $sAppRootUrl;
 	}