Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
*6052* Ensure all variables are properly escaped in PDF view javascri…
…pt; Fixed some W3C validation errors
  • Loading branch information
mcrider committed Oct 26, 2010
1 parent 3284a9c commit 149adc3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
10 changes: 5 additions & 5 deletions templates/article/article.tpl
Expand Up @@ -16,27 +16,27 @@
{elseif $galley->isPdfGalley()}
{url|assign:"pdfUrl" op="viewFile" path=$articleId|to_array:$galley->getBestGalleyId($currentJournal)}
{translate|assign:"noPluginText" key='article.pdf.pluginMissing'}
<script type="text/javascript">{literal}
<script type="text/javascript"><!--{literal}
$(document).ready(function(){
if ($.browser.webkit) { // PDFObject does not correctly work with safari's built-in PDF viewer
var embedCode = "<object id='pdfObject' type='application/pdf' data='{/literal}{$pdfUrl}{literal}' width='99%' height='99%'><div id='pluginMissing'>{/literal}{$noPluginText|escape}{literal}</div></object>";
var embedCode = "<object id='pdfObject' type='application/pdf' data='{/literal}{$pdfUrl}{literal}' width='99%' height='99%'><div id='pluginMissing'>{/literal}{$noPluginText|escape:'javascript'}{literal}</div></object>";
$("#articlePdf").html(embedCode);
if($("#pluginMissing").is(":hidden")) {
$('#fullscreenShow').show();
$("#articlePdf").resizable({ containment: 'parent', handles: 'se' });
} else { // Chrome Mac hides the embed object, obscuring the text. Reinsert.
$("#articlePdf").html('{/literal}{$noPluginText}{literal}');
$("#articlePdf").html('{/literal}{$noPluginText|escape:"javascript"}{literal}');
}
} else {
var success = new PDFObject({ url: "{/literal}{$pdfUrl}{literal}" }).embed("articlePdf");
var success = new PDFObject({ url: "{/literal}{$pdfUrl|escape:'javascript'}{literal}" }).embed("articlePdf");
if (success) {
// PDF was embedded; enbale fullscreen mode and the resizable widget
$('#fullscreenShow').show();
$("#articlePdfResizer").resizable({ containment: 'parent', handles: 'se' });
}
}
});
{/literal}</script>
{/literal}--></script>
<div id="articlePdfResizer">
<div id="articlePdf" class="ui-widget-content">
{translate key="article.pdf.pluginMissing"}
Expand Down
1 change: 0 additions & 1 deletion templates/article/footer.tpl
Expand Up @@ -50,7 +50,6 @@
{call_hook name="Templates::Article::Footer::PageFooter"}
</div>

</div>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion templates/article/header.tpl
Expand Up @@ -44,7 +44,7 @@
{/foreach}

<!-- Base Jquery -->
{if $allowCDN}<script src="http://www.google.com/jsapi"></script>
{if $allowCDN}<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">{literal}
// Provide a local fallback if the CDN cannot be reached
if (typeof google == 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion templates/rt/header.tpl
Expand Up @@ -25,7 +25,7 @@
{/foreach}

<!-- Base Jquery -->
{if $allowCDN}<script src="http://www.google.com/jsapi"></script>
{if $allowCDN}<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">{literal}
// Provide a local fallback if the CDN cannot be reached
if (typeof google == 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion templates/submission/comment/header.tpl
Expand Up @@ -25,7 +25,7 @@
{/foreach}

<!-- Base Jquery -->
{if $allowCDN}<script src="http://www.google.com/jsapi"></script>
{if $allowCDN}<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">{literal}
// Provide a local fallback if the CDN cannot be reached
if (typeof google == 'undefined') {
Expand Down

0 comments on commit 149adc3

Please sign in to comment.