From cc20eaf128d0d1c39aea9fee46d6519be2d55b95 Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 21 Jun 2005 20:39:29 +0000 Subject: - bug fixed when a language value contains a simple quote git-svn-id: http://piwigo.org/svn/trunk@795 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/template.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/template.php b/include/template.php index cc638c044..352914ef3 100644 --- a/include/template.php +++ b/include/template.php @@ -156,6 +156,11 @@ class Template { // Run the compiled code. $_str = ''; +// echo '
'.($this->compiled_code[$handle]).'
'; + $fp = @fopen( './log/debug.log', 'a+' ); + fwrite( $fp, "\n\n" ); + fwrite( $fp, $this->compiled_code[$handle] ); + fclose( $fp ); eval($this->compiled_code[$handle]); $this->output.= $_str; @@ -327,12 +332,12 @@ class Template { */ function compile($code, $do_not_echo = false, $retvar = '') { + // PWG specific : communication between template and $lang + $code = preg_replace('/\{lang:([^}]+)\}/e', "l10n('$1')", $code); + // replace \ with \\ and then ' with \'. $code = str_replace('\\', '\\\\', $code); $code = str_replace('\'', '\\\'', $code); - - // PWG specific : communication between template and $lang - $code = preg_replace('/\{lang:([^}]+)\}/e', "l10n('$1')", $code); // change template varrefs into PHP varrefs -- cgit v1.2.3