Fixed an issue related to static includes
authorAlexander Ebert <ebert@woltlab.com>
Mon, 14 Jul 2014 10:52:26 +0000 (12:52 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 14 Jul 2014 10:52:26 +0000 (12:52 +0200)
wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php

index 0551e59261b9a0cc9e0c04c8be23f0991a25d6d1..16021b332835d3cc2409a47c29f3e36be3b86633 100644 (file)
@@ -759,7 +759,7 @@ class TemplateScriptingCompiler {
                $sandbox = ($sandbox === 'true' || $sandbox === true || $sandbox == 1);
                
                $staticInclude = true;
-               if ($sandbox || $assignVar === false || $once === false || !empty($args)) {
+               if ($sandbox || $assignVar !== false || $once !== false || strpos($application, '$') !== false) {
                        $staticInclude = false;
                }
                
@@ -823,7 +823,10 @@ class TemplateScriptingCompiler {
                        $phpCode .= "ob_start();\n";
                }
                
-               $phpCode .= '$this->includeTemplate('.$file.', \''.$application.'\', array('.$argString.'), '.($sandbox ? 1 : 0).');'."\n";
+               if (strpos($application, '$') === false) {
+                       $application = "'" . $application . "'";
+               }
+               $phpCode .= '$this->includeTemplate('.$file.', '.$application.', array('.$argString.'), '.($sandbox ? 1 : 0).');'."\n";
                
                if ($assignVar !== false) {
                        $phpCode .= '$this->'.($append ? 'append' : 'assign').'('.$assignVar.', ob_get_clean());'."\n";