forked from extern/egroupware
Fix for bug #432123.
This commit is contained in:
parent
b9ca04bb8a
commit
aff1f64be4
@ -127,14 +127,14 @@ class Template {
|
|||||||
if (!is_array($varname)) {
|
if (!is_array($varname)) {
|
||||||
if (!empty($varname))
|
if (!empty($varname))
|
||||||
if ($this->debug) print "scalar: set *$varname* to *$value*<br>\n";
|
if ($this->debug) print "scalar: set *$varname* to *$value*<br>\n";
|
||||||
$this->varkeys[$varname] = "/".$this->varname($varname)."/";
|
$this->varkeys[$varname] = $this->varname($varname);
|
||||||
$this->varvals[$varname] = $value;
|
$this->varvals[$varname] = $value;
|
||||||
} else {
|
} else {
|
||||||
reset($varname);
|
reset($varname);
|
||||||
while(list($k, $v) = each($varname)) {
|
while(list($k, $v) = each($varname)) {
|
||||||
if (!empty($k))
|
if (!empty($k))
|
||||||
if ($this->debug) print "array: set *$k* to *$v*<br>\n";
|
if ($this->debug) print "array: set *$k* to *$v*<br>\n";
|
||||||
$this->varkeys[$k] = "/".$this->varname($k)."/";
|
$this->varkeys[$k] = $this->varname($k);
|
||||||
$this->varvals[$k] = $v;
|
$this->varvals[$k] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,7 +150,11 @@ class Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$str = $this->get_var($handle);
|
$str = $this->get_var($handle);
|
||||||
$str = @preg_replace($this->varkeys, $this->varvals, $str);
|
reset($this->varkeys);
|
||||||
|
while (list($k, $v) = each($this->varkeys))
|
||||||
|
{
|
||||||
|
$str = str_replace($v, $this->varvals[$k], $str);
|
||||||
|
}
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +334,7 @@ class Template {
|
|||||||
* varname: name of a replacement variable to be protected.
|
* varname: name of a replacement variable to be protected.
|
||||||
*/
|
*/
|
||||||
function varname($varname) {
|
function varname($varname) {
|
||||||
return preg_quote("{".$varname."}");
|
return "{".$varname."}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private: loadfile(string $handle)
|
/* private: loadfile(string $handle)
|
||||||
|
Loading…
Reference in New Issue
Block a user