From 615a0a96618fa99e7e452523145d6c0f238d4473 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Wed, 31 Jul 2013 09:33:43 -0400 Subject: [PATCH] Merged revisions 3960-4065 from stable branch. --- interface/lib/classes/tpl.inc.php | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/interface/lib/classes/tpl.inc.php b/interface/lib/classes/tpl.inc.php index 72d0dfe..070e349 100644 --- a/interface/lib/classes/tpl.inc.php +++ b/interface/lib/classes/tpl.inc.php @@ -192,12 +192,12 @@ if (is_array($k)) { foreach($k as $key => $value){ $key = ($this->OPTIONS['CASELESS']) ? strtolower(trim($key)) : trim($key); - if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $key) && $value !== null ) { + if (preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $key) && $value !== null ) { $this->_vars[$key] = $value; } } } else { - if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $k) && $v !== null) { + if (preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $k) && $v !== null) { if ($this->OPTIONS['CASELESS']) $k = strtolower($k); $this->_vars[trim($k)] = $v; } else { @@ -243,7 +243,7 @@ for ($i = 0; $i < $num_args; $i++) { $var = func_get_arg($i); if ($this->OPTIONS['CASELESS']) $var = strtolower($var); - if (!preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $var)) continue; + if (!preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $var)) continue; unset($this->_vars[$var]); } return true; @@ -300,12 +300,14 @@ */ public function setLoop($k, $v) { - if (is_array($v) && preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $k)) { + if (is_array($v) && preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $k)) { $k = ($this->OPTIONS['CASELESS']) ? strtolower(trim($k)) : trim($k); $this->_arrvars[$k] = array(); if ($this->OPTIONS['SET_LOOP_VAR'] && !empty($v)) $this->setvar($k, 1); if (($this->_arrvars[$k] = $this->_arrayBuild($v)) == false) { vlibTemplateError::raiseError('VT_WARNING_INVALID_ARR', WARNING, $k); + } else { + $this->vars['_'.$k.'_num'] = count($v); } } return true; @@ -849,8 +851,8 @@ $regex.= '[\"\']?'; $regex.= ')?\s*'; $regex.= '(?:>|\/>|}|-->){1}'; - $regex.= '([\r\n|\n|\r])?/ie'; - $data = preg_replace($regex,"\$this->_parseTag(array('\\0','\\1','\\2','\\3','\\4','\\5','\\6','\\7','\\8','\\9'));",$data); + $regex.= '([\r\n|\n|\r])?/i'; + $data = preg_replace_callback($regex, array($this, _parseTag), $data); if ($this->_cache) { // add cache if need be $this->_createCache($data); -- Gitblit v1.9.1