36 $this->allowedTags = $tags;
41 $this->allowedFilters = $filters;
46 $this->allowedMethods = array();
47 foreach ($methods as
$class => $m) {
48 $this->allowedMethods[
$class] = array_map(
'strtolower', is_array($m) ? $m : array($m));
54 $this->allowedProperties = $properties;
59 $this->allowedFunctions = $functions;
64 foreach ($tags as $tag) {
65 if (!in_array($tag, $this->allowedTags)) {
70 foreach ($filters as $filter) {
71 if (!in_array($filter, $this->allowedFilters)) {
76 foreach ($functions as $function) {
77 if (!in_array($function, $this->allowedFunctions)) {
90 $method = strtolower($method);
91 foreach ($this->allowedMethods as
$class => $methods) {
92 if ($obj instanceof
$class) {
93 $allowed = in_array($method, $methods);
100 throw new Twig_Sandbox_SecurityError(sprintf(
'Calling "%s" method on a "%s" object is not allowed.', $method, get_class($obj)));
107 foreach ($this->allowedProperties as
$class => $properties) {
108 if ($obj instanceof
$class) {
109 $allowed = in_array($property, is_array($properties) ? $properties : array($properties));
116 throw new Twig_Sandbox_SecurityError(sprintf(
'Calling "%s" property on a "%s" object is not allowed.', $property, get_class($obj)));
if($rub=fetch_assoc($rub_query)) if(check_if_module_active('url_rewriting')) $class
setAllowedMethods(array $methods)
checkPropertyAllowed($obj, $property)
Interface implemented by all compiled templates.
setAllowedFunctions(array $functions)
Interfaces that all security policy classes must implements.
checkSecurity($tags, $filters, $functions)
setAllowedProperties(array $properties)
setAllowedFilters(array $filters)
Represents a security policy which need to be enforced when sandbox mode is enabled.
__construct(array $allowedTags=array(), array $allowedFilters=array(), array $allowedMethods=array(), array $allowedProperties=array(), array $allowedFunctions=array())
checkMethodAllowed($obj, $method)
setAllowedTags(array $tags)
Exception thrown when a security error occurs at runtime.