From cf646e99be232c783dcbae86e329470674772749 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 23 Jan 2014 03:50:27 -0500
Subject: [PATCH] Merge remote-tracking branch 'origin/stable-3.0.5'
---
server/lib/classes/tpl.inc.php | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/server/lib/classes/tpl.inc.php b/server/lib/classes/tpl.inc.php
index deb9ca1..b4d8ca2 100644
--- a/server/lib/classes/tpl.inc.php
+++ b/server/lib/classes/tpl.inc.php
@@ -1109,7 +1109,7 @@
* @access private
* @return string used for eval'ing
*/
- function _parseIf ($varname, $value=null, $op=null, $namespace=null) {
+ function _parseIf ($varname, $value=null, $op=null, $namespace=null, $format=null) {
if (isset($namespace)) $namespace = substr($namespace, 0, -1);
$comp_str = ''; // used for extended if statements
@@ -1151,10 +1151,19 @@
}
}
if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
- return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str;
+ $retstr = '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])';
+ if(isset($format) && isset($value) && $format == 'version') {
+ return 'version_compare(' . $retstr . ', \'' . $value . '\', ' . (!empty($op) ? $op : '==') . ')';
+ } else {
+ return $retstr.$comp_str;
+ }
}
else {
- return $retstr."['".$varname."']".$comp_str;
+ if(isset($format) && isset($value) && $format == 'version') {
+ return 'version_compare(' . $retstr."['".$varname."']" . ', \'' . $value . '\', ' . (!empty($op) ? $op : '==') . ')';
+ } else {
+ return $retstr."['".$varname."']".$comp_str;
+ }
}
}
@@ -1330,15 +1339,15 @@
break;
case 'if':
- return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+ return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'.$newline;
break;
case 'unless':
- return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+ return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'.$newline;
break;
case 'elseif':
- return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+ return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'.$newline;
break;
case 'loop':
--
Gitblit v1.9.1