mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
- bugfix a '//' or '\\' in template_dir path could produce wrong path on relative filepath in {include} (Issue 175)
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
===== trunk =====
|
||||
16.02.2014
|
||||
- bugfix a '//' or '\\' in template_dir path could produce wrong path on relative filepath in {include} (Issue 175)
|
||||
|
||||
05.02.2014
|
||||
- bugfix shared.literal_compiler_param.php did throw an exception when literal did contain a '-' (smarty-developers group)
|
||||
|
||||
|
@@ -835,7 +835,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
{
|
||||
$this->template_dir = array();
|
||||
foreach ((array) $template_dir as $k => $v) {
|
||||
$this->template_dir[$k] = rtrim($v, '/\\') . DS;
|
||||
$this->template_dir[$k] = str_replace(array('//','\\\\'), DS, rtrim($v, '/\\')) . DS;
|
||||
}
|
||||
|
||||
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
|
||||
@@ -858,20 +858,24 @@ 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;
|
||||
if (is_int($k)) {
|
||||
// indexes are not merged but appended
|
||||
$this->template_dir[] = rtrim($v, '/\\') . DS;
|
||||
$this->template_dir[] = $v;
|
||||
} else {
|
||||
// string indexes are overridden
|
||||
$this->template_dir[$k] = rtrim($v, '/\\') . DS;
|
||||
$this->template_dir[$k] = $v;
|
||||
}
|
||||
}
|
||||
} elseif ($key !== null) {
|
||||
// override directory at specified index
|
||||
$this->template_dir[$key] = rtrim($template_dir, '/\\') . DS;
|
||||
} else {
|
||||
// append new directory
|
||||
$this->template_dir[] = rtrim($template_dir, '/\\') . DS;
|
||||
} else {
|
||||
$v = str_replace(array('//','\\\\'), DS, rtrim($template_dir, '/\\')) . DS;
|
||||
if ($key !== null) {
|
||||
// override directory at specified index
|
||||
$this->template_dir[$key] = $v;
|
||||
} else {
|
||||
// append new directory
|
||||
$this->template_dir[] = $v;
|
||||
}
|
||||
}
|
||||
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
|
||||
|
||||
@@ -903,7 +907,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
{
|
||||
$this->config_dir = array();
|
||||
foreach ((array) $config_dir as $k => $v) {
|
||||
$this->config_dir[$k] = rtrim($v, '/\\') . DS;
|
||||
$this->config_dir[$k] = str_replace(array('//','\\\\'), DS, rtrim($v, '/\\')) . DS;
|
||||
}
|
||||
|
||||
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
|
||||
@@ -925,20 +929,24 @@ 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;
|
||||
if (is_int($k)) {
|
||||
// indexes are not merged but appended
|
||||
$this->config_dir[] = rtrim($v, '/\\') . DS;
|
||||
$this->config_dir[] = $v;
|
||||
} else {
|
||||
// string indexes are overridden
|
||||
$this->config_dir[$k] = rtrim($v, '/\\') . DS;
|
||||
$this->config_dir[$k] = $v;
|
||||
}
|
||||
}
|
||||
} elseif ($key !== null) {
|
||||
// override directory at specified index
|
||||
$this->config_dir[$key] = rtrim($config_dir, '/\\') . DS;
|
||||
} else {
|
||||
// append new directory
|
||||
$this->config_dir[] = rtrim($config_dir, '/\\') . DS;
|
||||
$v = str_replace(array('//','\\\\'), DS, rtrim($config_dir, '/\\')) . DS;
|
||||
if ($key !== null) {
|
||||
// override directory at specified index
|
||||
$this->config_dir[$key] = rtrim($v, '/\\') . DS;
|
||||
} else {
|
||||
// append new directory
|
||||
$this->config_dir[] = rtrim($v, '/\\') . DS;
|
||||
}
|
||||
}
|
||||
|
||||
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
|
||||
|
Reference in New Issue
Block a user