Code

Updated smarty to 1.0.9
[gosa.git] / gosa-core / include / smarty / sysplugins / smarty_internal_get_include_path.php
index 7a9739e92f8544810a68d77a39aa8cea2aef5ef6..b9f193162430e5f57e5ae0052dc42dc19f834557 100644 (file)
@@ -1,43 +1,44 @@
 <?php\r
+\r
 /**\r
  * Smarty read include path plugin\r
- *\r
+ * \r
  * @package Smarty\r
  * @subpackage PluginsInternal\r
- * @author Monte Ohrt\r
+ * @author Monte Ohrt \r
  */\r
 \r
 /**\r
  * Smarty Internal Read Include Path Class\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsInternal\r
  */\r
 class Smarty_Internal_Get_Include_Path {\r
-\r
     /**\r
      * Return full file path from PHP include_path\r
-     *\r
+     * \r
      * @param string $filepath filepath\r
-     * @return string|boolean full filepath or false\r
+     * @return mixed full filepath or false\r
      */\r
     public static function getIncludePath($filepath)\r
     {\r
-        static $_include_path = null;\r
+    static $_path_array = null;\r
 \r
-        if ($_path_array === null) {\r
-            $_include_path = explode(PATH_SEPARATOR, get_include_path());\r
-        }\r
+    if(!isset($_path_array)) {\r
+        $_ini_include_path = ini_get('include_path');\r
 \r
-        foreach ($_include_path as $_path) {\r
-            if (file_exists($_path . DS . $filepath)) {\r
-                return $_path . DS . $filepath;\r
-            }\r
+        if(strstr($_ini_include_path,';')) {\r
+            // windows pathnames\r
+            $_path_array = explode(';',$_ini_include_path);\r
+        } else {\r
+            $_path_array = explode(':',$_ini_include_path);\r
         }\r
-        \r
-        return false;\r
     }\r
-\r
-}\r
+    foreach ($_path_array as $_include_path) {\r
+        if (file_exists($_include_path . DS . $filepath)) {\r
+            return $_include_path . DS . $filepath;\r
+        }\r
+    }\r
+    return false;\r
+    } \r
+} \r
 \r
 ?>
\ No newline at end of file