- bug fixed when a language value contains a simple quote

git-svn-id: http://piwigo.org/svn/trunk@795 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall
2005-06-21 20:39:29 +00:00
parent a86321eab5
commit cc20eaf128
+8 -3
View File
@@ -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