Fixed static includes
authorAlexander Ebert <ebert@woltlab.com>
Sun, 29 Jun 2014 10:27:19 +0000 (12:27 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 29 Jun 2014 10:27:19 +0000 (12:27 +0200)
wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php

index 8d9ba1d616acf632d45c5972a757368166e3b447..0551e59261b9a0cc9e0c04c8be23f0991a25d6d1 100644 (file)
@@ -757,14 +757,16 @@ class TemplateScriptingCompiler {
                }
                
                $sandbox = ($sandbox === 'true' || $sandbox === true || $sandbox == 1);
-               if (!$sandbox && !empty($args)) {
-                       $sandbox = true;
+               
+               $staticInclude = true;
+               if ($sandbox || $assignVar === false || $once === false || !empty($args)) {
+                       $staticInclude = false;
                }
                
                $templateName = substr($file, 1, -1);
                
                // check for static includes
-               if (!$sandbox && $assignVar === false && $once === false) {
+               if ($staticInclude) {
                        $phpCode = '';
                        if (!isset($this->staticIncludes[$application])) {
                                $this->staticIncludes[$application] = array();
@@ -821,7 +823,7 @@ class TemplateScriptingCompiler {
                        $phpCode .= "ob_start();\n";
                }
                
-               $phpCode .= '$this->includeTemplate('.$file.', \''.$application.'\', array('.$argString.'), ('.$sandbox.' ? 1 : 0));'."\n";
+               $phpCode .= '$this->includeTemplate('.$file.', \''.$application.'\', array('.$argString.'), '.($sandbox ? 1 : 0).');'."\n";
                
                if ($assignVar !== false) {
                        $phpCode .= '$this->'.($append ? 'append' : 'assign').'('.$assignVar.', ob_get_clean());'."\n";