diff options
author | plegall <plg@piwigo.org> | 2005-06-21 20:39:29 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2005-06-21 20:39:29 +0000 |
commit | cc20eaf128d0d1c39aea9fee46d6519be2d55b95 (patch) | |
tree | bb3b6c433be687100a019ea9d2fa3736b8ec33f6 | |
parent | a86321eab598ad26b08e4ef72a777f7a5e477acc (diff) |
- bug fixed when a language value contains a simple quote
git-svn-id: http://piwigo.org/svn/trunk@795 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | include/template.php | 11 |
1 files changed, 8 insertions, 3 deletions
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 '<pre>'.($this->compiled_code[$handle]).'</pre>'; + $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 |