From aa370627b211a51dc46891cfa4b6e3d2ef3e52db Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Tue, 16 Jul 2013 10:45:17 -0400
Subject: [PATCH] - Fixed FS#2924 - the month will not set automatically in the autoresponder by click now   Along with this fixed some display problems with the combo boxes introduced in 3.0.5.   Some fields were not correctly displayed with the predefined values if value and text of the underlying option element differ.

---
 interface/lib/classes/tpl.inc.php |   33 ++++++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/interface/lib/classes/tpl.inc.php b/interface/lib/classes/tpl.inc.php
index e935240..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;
@@ -322,7 +324,8 @@
          */
         public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
         {
-            $db_type = strtoupper($db_type);
+            /*
+			$db_type = strtoupper($db_type);
             if (!in_array($db_type, $this->allowed_loop_dbs)) {
                 vlibTemplateError::raiseError('VT_WARNING_INVALID_LOOP_DB', WARNING, $db_type);
                 return false;
@@ -448,6 +451,7 @@
             }
             $this->setLoop($loopname, $loop_arr);
             return true;
+			*/
         }
 
         /**
@@ -847,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);
@@ -876,8 +880,15 @@
          */
         private function _fileSearch($file) 
         {
-            $filename = basename($file);
+			
+			$filename = basename($file);
             $filepath = dirname($file);
+			
+			if(isset($_SESSION['s']['module']['name']) && isset($_SESSION['s']['theme'])) {
+				if(is_file(ISPC_THEMES_PATH.'/'.$_SESSION['s']['theme'].'/templates/'.$_SESSION['s']['module']['name'].'/'.$filename)) {
+					return ISPC_THEMES_PATH.'/'.$_SESSION['s']['theme'].'/templates/'.$_SESSION['s']['module']['name'].'/'.$filename;
+				}
+			}
 
             //* check fullpath first..
             $fullpath = $filepath.'/'.$filename;
@@ -1224,10 +1235,10 @@
          */
         private function _intParse ()
         {
-            $mqrt = get_magic_quotes_runtime();
-            set_magic_quotes_runtime(0);
+            //$mqrt = get_magic_quotes_runtime();
+            //set_magic_quotes_runtime(0);
             $this->_tmplfilep = '?>'.$this->_getData($this->_tmplfilename).'<?php return true;';
-            set_magic_quotes_runtime($mqrt);
+            //set_magic_quotes_runtime($mqrt);
             return true;
         }
 

--
Gitblit v1.9.1