From f790b443353866c25d28bf32fb5bef20e9186aea Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Wed, 01 May 2013 06:57:04 -0400 Subject: [PATCH] Small code improvements --- program/include/rcmail_output_html.php | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 0fba660..02eef2f 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -760,9 +760,13 @@ /** * Parse & evaluate a given expression and return its result. - * @param string Expression statement + * + * @param string Expression statement + * + * @return mixed Expression result */ - protected function eval_expression ($expression) { + protected function eval_expression ($expression) + { $expression = preg_replace( array( '/session:([a-z0-9_]+)/i', @@ -784,17 +788,19 @@ ), $expression ); - + $fn = create_function('$app,$browser,$env', "return ($expression);"); - if(!$fn) { + if (!$fn) { rcube::raise_error(array( 'code' => 505, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Expression parse error on: ($expression)"), true, false); + + return null; } - + return $fn($this->app, $this->browser, $this->env); } @@ -980,7 +986,7 @@ // return code for a specified eval expression case 'exp': - return html::quote( $this->eval_expression($attrib['expression']) ); + return html::quote($this->eval_expression($attrib['expression'])); // return variable case 'var': -- Gitblit v1.9.1