diff --git a/etemplate/inc/class.boetemplate.inc.php b/etemplate/inc/class.boetemplate.inc.php index d3164876a5..75904ee06d 100644 --- a/etemplate/inc/class.boetemplate.inc.php +++ b/etemplate/inc/class.boetemplate.inc.php @@ -195,7 +195,7 @@ class boetemplate extends soetemplate } else { - $value = str_replace(array("'",'"'),array('\\\'','"'),$value); + $value = str_replace(array("'",'"','[',']'),array('\\\'','"','[',']'),$value); $name = str_replace(array('{'.$matches[1].'}',$matches[1]),$value,$name); } } @@ -576,7 +576,10 @@ class boetemplate extends soetemplate */ static function isset_array($arr,$idx) { - $idxs = explode('[',str_replace(']','',$idx)); + if (count($idxs = explode('[', $idx, 2)) > 1) + { + $idxs = array_merge(array($idxs[0]), explode('][', substr($idxs[1],0,-1))); + } $last_idx = array_pop($idxs); $pos = &$arr; foreach($idxs as $idx) @@ -603,7 +606,10 @@ class boetemplate extends soetemplate */ static function set_array(&$arr,$idx,$val) { - $idxs = explode('[',str_replace(']','',$idx)); + if (count($idxs = explode('[', $idx, 2)) > 1) + { + $idxs = array_merge(array($idxs[0]), explode('][', substr($idxs[1],0,-1))); + } $pos = &$arr; foreach($idxs as $idx) { @@ -634,7 +640,10 @@ class boetemplate extends soetemplate } if (is_object($idx)) return false; // given an error in php5.2 - $idxs = explode('[',str_replace(']','',$idx)); + if (count($idxs = explode('[', $idx, 2)) > 1) + { + $idxs = array_merge(array($idxs[0]), explode('][', substr($idxs[1],0,-1))); + } $pos = &$arr; foreach($idxs as $idx) { @@ -663,7 +672,10 @@ class boetemplate extends soetemplate { throw new egw_exception_assertion_failed(__METHOD__."(\$arr,'$idx') \$arr is no array!"); } - $idxs = explode('[',str_replace(']','',$idx)); + if (count($idxs = explode('[', $idx, 2)) > 1) + { + $idxs = array_merge(array($idxs[0]), explode('][', substr($idxs[1],0,-1))); + } $last_idx = array_pop($idxs); $pos = &$arr; foreach($idxs as $idx) diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php index b5775989cf..cb792957ac 100644 --- a/etemplate/inc/class.etemplate.inc.php +++ b/etemplate/inc/class.etemplate.inc.php @@ -1,6 +1,6 @@