From de6585eb771ef6a7e7a98c9a9b011da34cbf05b0 Mon Sep 17 00:00:00 2001
From: Andy Wermke <andy@dev.next-step-software.com>
Date: Mon, 08 Apr 2013 08:34:17 -0400
Subject: [PATCH] Merge branch 'master' of git.next-step-software.com:/git-pub/roundcubemail

---
 program/include/rcmail_output_html.php |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php
index 772bdcc..0fba660 100644
--- a/program/include/rcmail_output_html.php
+++ b/program/include/rcmail_output_html.php
@@ -759,14 +759,11 @@
 
 
     /**
-     * Parses expression and replaces variables
-     *
+     * Parse & evaluate a given expression and return its result.
      * @param  string Expression statement
-     * @return string Expression value
      */
-    protected function parse_expression($expression)
-    {
-        return preg_replace(
+    protected function eval_expression ($expression) {
+        $expression = preg_replace(
             array(
                 '/session:([a-z0-9_]+)/i',
                 '/config:([a-z0-9_]+)(:([a-z0-9_]+))?/i',
@@ -785,16 +782,19 @@
                 "\$browser->{'\\1'}",
                 $this->template_name,
             ),
-            $expression);
-    }
-    
-    /**
-     * Evaluate a given expression and return its result.
-     * @param  string Expression statement
-     */
-    protected function eval_expression ($expression) {
-        $expression = $this->parse_expression($expression);
+            $expression
+        );
+        
         $fn = create_function('$app,$browser,$env', "return ($expression);");
+        if(!$fn) {
+            rcube::raise_error(array(
+                'code' => 505,
+                'type' => 'php',
+                'file' => __FILE__,
+                'line' => __LINE__,
+                'message' => "Expression parse error on: ($expression)"), true, false);
+        }
+        
         return $fn($this->app, $this->browser, $this->env);
     }
 

--
Gitblit v1.9.1