Browse Source

[svn r13147] Always return api_get_path(WEB_PATH) and api_get_path(SYS_PATH) with a trailing slash.

Yannick Warnier 17 years ago
parent
commit
39b891b5ea
1 changed files with 17 additions and 3 deletions
  1. 17 3
      main/inc/lib/main_api.lib.php

+ 17 - 3
main/inc/lib/main_api.lib.php

@@ -285,14 +285,28 @@ function api_get_path($path_type)
 	switch ($path_type)
 	{
 		case WEB_PATH :
-			// example: http://www.mydokeos.com or http://www.mydokeos.com/portal/ if you're using
+			// example: http://www.mydokeos.com/ or http://www.mydokeos.com/portal/ if you're using
 			// a subdirectory of your document root for Dokeos
-			return $_configuration['root_web'];
+			if(substr($_configuration['root_web'],-1) == '/')
+			{
+				return $_configuration['root_web'];
+			}
+			else
+			{
+				return $_configuration['root_web'].'/';
+			}
 			break;
 
 		case SYS_PATH :
 			// example: /var/www/
-			return $_configuration['root_sys'];
+			if(substr($_configuration['root_sys'],-1) == '/')
+			{
+				return $_configuration['root_sys'];
+			}
+			else
+			{
+				return $_configuration['root_sys'].'/';				
+			}
 			break;
 
 		case REL_PATH :