From 8c186d97c6a43f3fb71c2c5acb9fdd08f0c573e2 Mon Sep 17 00:00:00 2001 From: "Marek A. R" Date: Mon, 28 Jul 2008 15:01:06 +0000 Subject: [PATCH] - Make " and again. git-svn-id: file:///svn/phpbb/trunk@8699 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_template.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 31cee929b2..7d9e37ff0d 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -74,11 +74,14 @@ class template_filter extends php_user_filter private function compile($data) { + $data = preg_replace('#<(?:[\\?%]|script)#s', '', $data); return str_replace('?>regex, array($this, 'replace'), $data)); } private function replace($matches) { + global $config; + if (isset($matches[3])) { return $this->compile_var_tags($matches[0]); @@ -129,14 +132,18 @@ class template_filter extends php_user_filter return 'compile_tag_include($matches[2]) . ' ?>'; break; -/* case 'INCLUDEPHP': - $this->compile_blocks[] = ($config['tpl_allow_php']) ? 'compile_tag_include_php(array_shift($includephp_blocks)) . ' ?>' : ''; + case 'INCLUDEPHP': + return ($config['tpl_allow_php']) ? 'compile_tag_include_php($matches[2]) . ' ?>' : ''; break; case 'PHP': - $this->compile_blocks[] = ($config['tpl_allow_php']) ? '' : ''; + return ($config['tpl_allow_php']) ? '' : ' -->'; + break; + default: return $matches[0]; break; @@ -737,9 +744,9 @@ class template_compile return false; } - stream_filter_append($source_handle, 'template'); + @flock($destination_handle, LOCK_EX); - @flock($destination_handle); + stream_filter_append($source_handle, 'template'); stream_copy_to_stream($source_handle, $destination_handle); @fclose($source_handle); @@ -775,4 +782,4 @@ class template_compile } } -?> +?> \ No newline at end of file