- bugfix UNC WINDOWS PATH like "\\psf\path\to\dir" did not work as template directory (Issue 192)

This commit is contained in:
Uwe.Tews@googlemail.com
2014-06-08 18:12:09 +00:00
parent ee4a77b797
commit 7ca939f47b
2 changed files with 7 additions and 6 deletions

View File

@@ -2,6 +2,7 @@
08.06.2014 08.06.2014
- bugfix registered objects did not work after spelling fixes of 06.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 {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 06.06.2014
- fixed PHPUnit outputFilterTrimWhitespaceTests.php assertion of test result - fixed PHPUnit outputFilterTrimWhitespaceTests.php assertion of test result

View File

@@ -891,7 +891,7 @@ class Smarty extends Smarty_Internal_TemplateBase
{ {
$this->template_dir = array(); $this->template_dir = array();
foreach ((array) $template_dir as $k => $v) { 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); $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)) { if (is_array($template_dir)) {
foreach ($template_dir as $k => $v) { 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)) { if (is_int($k)) {
// indexes are not merged but appended // indexes are not merged but appended
$this->template_dir[] = $v; $this->template_dir[] = $v;
@@ -925,7 +925,7 @@ class Smarty extends Smarty_Internal_TemplateBase
} }
} }
} else { } else {
$v = str_replace(array('//', '\\\\'), DS, rtrim($template_dir, '/\\')) . DS; $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($template_dir, '/\\')) . DS;
if ($key !== null) { if ($key !== null) {
// override directory at specified index // override directory at specified index
$this->template_dir[$key] = $v; $this->template_dir[$key] = $v;
@@ -966,7 +966,7 @@ class Smarty extends Smarty_Internal_TemplateBase
{ {
$this->config_dir = array(); $this->config_dir = array();
foreach ((array) $config_dir as $k => $v) { 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); $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)) { if (is_array($config_dir)) {
foreach ($config_dir as $k => $v) { 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)) { if (is_int($k)) {
// indexes are not merged but appended // indexes are not merged but appended
$this->config_dir[] = $v; $this->config_dir[] = $v;
@@ -999,7 +999,7 @@ class Smarty extends Smarty_Internal_TemplateBase
} }
} }
} else { } else {
$v = str_replace(array('//', '\\\\'), DS, rtrim($config_dir, '/\\')) . DS; $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($config_dir, '/\\')) . DS;
if ($key !== null) { if ($key !== null) {
// override directory at specified index // override directory at specified index
$this->config_dir[$key] = rtrim($v, '/\\') . DS; $this->config_dir[$key] = rtrim($v, '/\\') . DS;