summaryrefslogtreecommitdiff
path: root/program/include/rcmail_output_html.php
diff options
context:
space:
mode:
authorAndy Wermke <andy@dev.next-step-software.com>2013-04-08 14:31:28 +0200
committerAndy Wermke <andy@dev.next-step-software.com>2013-04-08 14:31:28 +0200
commit58e3a504b98f68595151fa908536b1e35b043b76 (patch)
tree79c466f72042ef7b0fb6d09ff68d56d84a381092 /program/include/rcmail_output_html.php
parentfe245e5f5dbea1c18517471103185e04a52c89b3 (diff)
Removed parse_expression() & added error logging to eval_expression().
Diffstat (limited to 'program/include/rcmail_output_html.php')
-rw-r--r--program/include/rcmail_output_html.php30
1 files changed, 15 insertions, 15 deletions
diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php
index 772bdccf7..0fba66080 100644
--- a/program/include/rcmail_output_html.php
+++ b/program/include/rcmail_output_html.php
@@ -759,14 +759,11 @@ class rcmail_output_html extends rcmail_output
/**
- * 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 @@ class rcmail_output_html extends rcmail_output
"\$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);
}