Skip to content

Commit

Permalink
feature 2816: {strip} smarty tag can introduce bugs in javascript + f…
Browse files Browse the repository at this point in the history
…ix picture.tpl

git-svn-id: http://piwigo.org/svn/trunk@19575 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
mistic100 committed Dec 26, 2012
1 parent 8188973 commit 9cc816d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/smarty/libs/Smarty_Compiler.class.php
Expand Up @@ -332,7 +332,7 @@ function _compile_file($resource_name, $source_content, &$compiled_content)
/* strip all $text_blocks before the next '/strip' */
for ($j = $i + 1; $j < $for_max; $j++) {
/* remove leading and trailing whitespaces of each line */
$text_blocks[$j] = preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $text_blocks[$j]);
$text_blocks[$j] = preg_replace('![\t ]*[\r\n]+[\t ]*!', ' ', $text_blocks[$j]);
if ($compiled_tags[$j] == '{/strip}') {
/* remove trailing whitespaces from the last text_block */
$text_blocks[$j] = rtrim($text_blocks[$j]);
Expand Down
5 changes: 3 additions & 2 deletions themes/default/template/picture.tpl
Expand Up @@ -258,10 +258,11 @@ y.callService(
if (e) e.innerHTML = rating.score;
e = document.getElementById("ratingCount");
if (e) {ldelim}
if (rating.count == 1)
if (rating.count == 1) {
e.innerHTML = "({'%d rate'|@translate|@escape:'javascript'})".replace( "%d", rating.count);
else
} else {
e.innerHTML = "({'%d rates'|@translate|@escape:'javascript'})".replace( "%d", rating.count);
}
{rdelim}
{rdelim}{rdelim} );
{/footer_script}
Expand Down

0 comments on commit 9cc816d

Please sign in to comment.