From f087575c70cef9016411288e19c009e7f165f045 Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Tue, 09 Jul 2013 10:01:45 -0400
Subject: [PATCH] - Fixed:  FS#3013 - PHP 5.5 compatibility 

---
 interface/lib/classes/tpl.inc.php      |    4 ++--
 server/lib/classes/tpl.inc.php         |    2 +-
 interface/lib/classes/ispcmail.inc.php |    6 +++++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/interface/lib/classes/ispcmail.inc.php b/interface/lib/classes/ispcmail.inc.php
index e9534ec..d49af96 100644
--- a/interface/lib/classes/ispcmail.inc.php
+++ b/interface/lib/classes/ispcmail.inc.php
@@ -496,6 +496,10 @@
         $this->_is_signed = true;
     }
     
+    private function _char_to_hex($matches) {
+        return '=' . strtoupper(dechex(ord($matches[1])));
+    }
+    
     /**
     * Function to encode a header if necessary
     * according to RFC2047
@@ -504,7 +508,7 @@
     private function _encodeHeader($input, $charset = 'ISO-8859-1') {
 		preg_match_all('/(\s?\w*[\x80-\xFF]+\w*\s?)/', $input, $matches);
 		foreach ($matches[1] as $value) {
-			$replacement = preg_replace('/([\x20\x80-\xFF])/e', '"=" . strtoupper(dechex(ord("\1")))', $value);
+			$replacement = preg_replace_callback('/([\x20\x80-\xFF])/', array($this, '_char_to_hex'), $value);
 			$input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input);
 		}
         
diff --git a/interface/lib/classes/tpl.inc.php b/interface/lib/classes/tpl.inc.php
index 5ccd5df..070e349 100644
--- a/interface/lib/classes/tpl.inc.php
+++ b/interface/lib/classes/tpl.inc.php
@@ -851,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);
diff --git a/server/lib/classes/tpl.inc.php b/server/lib/classes/tpl.inc.php
index af2e0da..3b42495 100644
--- a/server/lib/classes/tpl.inc.php
+++ b/server/lib/classes/tpl.inc.php
@@ -930,7 +930,7 @@
                 $regex.= '(?:>|\/>|}|-->){1}';
 				$regex.= '/ie';
                 //$regex.= '([\r\n|\n|\r])?/ie';
-                $data = preg_replace($regex,"\$this->_parseTag(array('\\0','\\1','\\2','\\3','\\4','\\5','\\6','\\7','\\8','\\9'));",$data);
+                $data = preg_replace_callback($regex, array($this, '_parseTag'), $data);
 
                 if ($this->_cache) { // add cache if need be
                     $this->_createCache($data);

--
Gitblit v1.9.1