diff --git a/change_log.txt b/change_log.txt index 306eb492..3530b496 100644 --- a/change_log.txt +++ b/change_log.txt @@ -2,6 +2,7 @@ 08.06.2014 - bugfix registered objects did not work after spelling fixes of 06.06.2014 - bugfix {block} tags within {literal} .. {/literal} got not displayed correctly (topic 25024) + - bugfix UNC WINDOWS PATH like "\\psf\path\to\dir" did not work as template directory (Issue 192) 06.06.2014 - fixed PHPUnit outputFilterTrimWhitespaceTests.php assertion of test result diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index f31294f8..ea5b9cea 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -891,7 +891,7 @@ class Smarty extends Smarty_Internal_TemplateBase { $this->template_dir = array(); foreach ((array) $template_dir as $k => $v) { - $this->template_dir[$k] = str_replace(array('//', '\\\\'), DS, rtrim($v, '/\\')) . DS; + $this->template_dir[$k] = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS; } $this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir); @@ -915,7 +915,7 @@ class Smarty extends Smarty_Internal_TemplateBase if (is_array($template_dir)) { foreach ($template_dir as $k => $v) { - $v = str_replace(array('//', '\\\\'), DS, rtrim($v, '/\\')) . DS; + $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS; if (is_int($k)) { // indexes are not merged but appended $this->template_dir[] = $v; @@ -925,7 +925,7 @@ class Smarty extends Smarty_Internal_TemplateBase } } } else { - $v = str_replace(array('//', '\\\\'), DS, rtrim($template_dir, '/\\')) . DS; + $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($template_dir, '/\\')) . DS; if ($key !== null) { // override directory at specified index $this->template_dir[$key] = $v; @@ -966,7 +966,7 @@ class Smarty extends Smarty_Internal_TemplateBase { $this->config_dir = array(); foreach ((array) $config_dir as $k => $v) { - $this->config_dir[$k] = str_replace(array('//', '\\\\'), DS, rtrim($v, '/\\')) . DS; + $this->config_dir[$k] = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS; } $this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir); @@ -989,7 +989,7 @@ class Smarty extends Smarty_Internal_TemplateBase if (is_array($config_dir)) { foreach ($config_dir as $k => $v) { - $v = str_replace(array('//', '\\\\'), DS, rtrim($v, '/\\')) . DS; + $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS; if (is_int($k)) { // indexes are not merged but appended $this->config_dir[] = $v; @@ -999,7 +999,7 @@ class Smarty extends Smarty_Internal_TemplateBase } } } else { - $v = str_replace(array('//', '\\\\'), DS, rtrim($config_dir, '/\\')) . DS; + $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($config_dir, '/\\')) . DS; if ($key !== null) { // override directory at specified index $this->config_dir[$key] = rtrim($v, '/\\') . DS;