From b99e600aaa809601f78fa29e2e938fcbe0af3b75 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 30 Aug 2003 11:03:20 +0000 Subject: [PATCH] added flag to disable the str_replace('phpGroupWare','eGroupWare'), called egroupware_hack --- phpgwapi/inc/class.Template.inc.php | 37 +++++++++++++---------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/phpgwapi/inc/class.Template.inc.php b/phpgwapi/inc/class.Template.inc.php index 6701b43f3a..c71340c70a 100644 --- a/phpgwapi/inc/class.Template.inc.php +++ b/phpgwapi/inc/class.Template.inc.php @@ -43,6 +43,9 @@ /* last error message is retained here */ var $last_error = ''; + // if true change all phpGroupWare into eGroupWare in set_var + var $egroupware_hack = True; + /***************************************************************************/ /* public: Constructor. * root: template directory. @@ -139,30 +142,24 @@ { if (!is_array($varname)) { - if (!empty($varname)) + if (empty($varname)) + { + return; + } + $varname = array( + $varname => $value + ); + } + foreach($varname as $k => $v) + { + if (!empty($k)) { if ($this->debug) { - print "scalar: set *$varname* to *$value*
\n"; - } - $this->varkeys[$varname] = $this->varname($varname); - $this->varvals[$varname] = str_replace('phpGroupWare','eGroupWare',$value); - } - } - else - { - reset($varname); - while(list($k, $v) = each($varname)) - { - if (!empty($k)) - { - if ($this->debug) - { - print "array: set *$k* to *$v*
\n"; - } - $this->varkeys[$k] = $this->varname($k); - $this->varvals[$k] = str_replace('phpGroupWare','eGroupWare',$v); + print "array: set *$k* to *$v*
\n"; } + $this->varkeys[$k] = $this->varname($k); + $this->varvals[$k] = $this->egroupware_hack ? str_replace('phpGroupWare','eGroupWare',$v) : $v; } } }