|
|
@ -1472,16 +1472,23 @@ class rcube_ldap extends rcube_addressbook
|
|
|
|
if (strpos($templ, '(') !== false) {
|
|
|
|
if (strpos($templ, '(') !== false) {
|
|
|
|
// replace {attr} placeholders with (escaped!) attribute values to be safely eval'd
|
|
|
|
// replace {attr} placeholders with (escaped!) attribute values to be safely eval'd
|
|
|
|
$code = preg_replace('/\{\w+\}/', '', strtr($templ, array_map('addslashes', $attrvals)));
|
|
|
|
$code = preg_replace('/\{\w+\}/', '', strtr($templ, array_map('addslashes', $attrvals)));
|
|
|
|
$fn = create_function('', "return ($code);");
|
|
|
|
$res = false;
|
|
|
|
if (!$fn) {
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
$res = eval("return ($code);");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (ParseError $e) {
|
|
|
|
|
|
|
|
// ignore
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($res === false) {
|
|
|
|
rcube::raise_error(array(
|
|
|
|
rcube::raise_error(array(
|
|
|
|
'code' => 505, 'type' => 'php',
|
|
|
|
'code' => 505, 'file' => __FILE__, 'line' => __LINE__,
|
|
|
|
'file' => __FILE__, 'line' => __LINE__,
|
|
|
|
|
|
|
|
'message' => "Expression parse error on: ($code)"), true, false);
|
|
|
|
'message' => "Expression parse error on: ($code)"), true, false);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$attrs[$lf] = $fn();
|
|
|
|
$attrs[$lf] = $res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
// replace {attr} placeholders with concrete attribute values
|
|
|
|
// replace {attr} placeholders with concrete attribute values
|
|
|
|