[gosa.git] / gosa-core / include / smarty / sysplugins / smarty_internal_compile_private_modifier.php
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_modifier.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_modifier.php
index 1648db2ed7649c086016555bcb2a47e390407887..ca4d90774f526ca75f9932331db21849de2da514 100644 (file)
<?php\r
+\r
/**\r
* Smarty Internal Plugin Compile Modifier\r
- * \r
+ *\r
* Compiles code for modifier execution\r
- * \r
+ *\r
* @package Smarty\r
* @subpackage Compiler\r
- * @author Uwe Tews \r
+ * @author Uwe Tews\r
*/\r
\r
/**\r
* Smarty Internal Plugin Compile Modifier Class\r
+ *\r
+ * @package Smarty\r
+ * @subpackage Compiler\r
*/\r
class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase {\r
+\r
/**\r
* Compiles code for modifier execution\r
- * \r
- * @param array $args array with attributes from parser\r
- * @param object $compiler compiler object\r
- * @param array $parameter array with compilation parameter\r
+ *\r
+ * @param array $args array with attributes from parser\r
+ * @param object $compiler compiler object\r
+ * @param array $parameter array with compilation parameter\r
* @return string compiled code\r
*/\r
public function compile($args, $compiler, $parameter)\r
{\r
- $this->compiler = $compiler;\r
- $this->smarty = $this->compiler->smarty;\r
// check and get attributes\r
- $_attr = $this->_get_attributes($args);\r
- $output = $parameter['value']; \r
+ $_attr = $this->getAttributes($compiler, $args);\r
+ $output = $parameter['value'];\r
// loop over list of modifiers\r
foreach ($parameter['modifierlist'] as $single_modifier) {\r
$modifier = $single_modifier[0];\r
- $single_modifier[0] = $output;\r
- $params = implode(',', $single_modifier); \r
+ $single_modifier[0] = $output;\r
+ $params = implode(',', $single_modifier);\r
// check for registered modifier\r
if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier])) {\r
$function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];\r
@@ -43,27 +46,36 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
$output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';\r
} else {\r
$output = $function[0] . '::' . $function[1] . '(' . $params . ')';\r
- } \r
- } \r
+ }\r
+ }\r
+ } else if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0])) {\r
+ $output = call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0], $single_modifier, $compiler->smarty);\r
// check for plugin modifiercompiler\r
} else if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {\r
- $plugin = 'smarty_modifiercompiler_' . $modifier;\r
- $output = $plugin($single_modifier, $compiler); \r
+ // check if modifier allowed\r
+ if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {\r
+ $plugin = 'smarty_modifiercompiler_' . $modifier;\r
+ $output = $plugin($single_modifier, $compiler);\r
+ }\r
// check for plugin modifier\r
- } else if ($function = $this->compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {\r
- $output = "{$function}({$params})"; \r
+ } else if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {\r
+ // check if modifier allowed\r
+ if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {\r
+ $output = "{$function}({$params})";\r
+ }\r
// check if trusted PHP function\r
} else if (is_callable($modifier)) {\r
// check if modifier allowed\r
- if (!is_object($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedModifier($modifier, $this->compiler)) {\r
+ if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) {\r
$output = "{$modifier}({$params})";\r
- } \r
+ }\r
} else {\r
- $this->compiler->trigger_template_error ("unknown modifier \"" . $modifier . "\"", $this->compiler->lex->taglineno);\r
- } \r
- } \r
+ $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno);\r
+ }\r
+ }\r
return $output;\r
- } \r
-} \r
+ }\r
+\r
+}\r
\r
?>
\ No newline at end of file