From 7d52e00a51450bc4a080d4e21b7dda02c0a65191 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 14 Nov 2013 05:42:06 -0500
Subject: [PATCH] Fixed list sorting
---
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