From b613781d3af6d7c5e5d9d0fa1592e78b54647c0f Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 21 Jul 2009 10:58:31 +0000 Subject: [PATCH] Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9811 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_template.php | 11 +++++++++-- phpBB/includes/template.php | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 2e81cb13ce..a0cc54f308 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -168,6 +168,7 @@
  • [Fix] Allow changing forum from select box under certain circumstances. (Bug #37525)
  • [Fix] Display required fields notice on registration above the custom profile fields. (Bug #39665)
  • [Fix] Copy poll options properly when copying topic. (Bug #39065)
  • +
  • [Fix] Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index a951579db5..1d3a4d74f8 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -251,15 +251,22 @@ class template_compile $template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : ''); } + // Remove unused opening/closing tags + $template_php = str_replace(' ?>([\r\n])#', '?>\1\1', $template_php); + // There will be a number of occasions where we switch into and out of // PHP mode instantaneously. Rather than "burden" the parser with this // we'll strip out such occurences, minimising such switching if ($no_echo) { - return "\$$echo_var .= '" . str_replace(' ?>root = $template_path; $this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_'; + $this->_rootref = &$this->_tpldata['.'][0]; + return true; }