From 8838f818ecd00ca7db210f3f4bf99b3be2dff87c Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 25 Apr 2018 10:53:36 -0400 Subject: [PATCH] Escape js strings in smarty templates --- templates/CRM/Batch/Form/Entry.tpl | 2 +- templates/CRM/Case/Audit/Audit.tpl | 2 +- templates/CRM/Contact/Form/Contact.tpl | 2 +- templates/CRM/Contact/Form/CustomData.tpl | 8 +- templates/CRM/Contact/Form/Merge.tpl | 2 +- .../CRM/Contact/Import/Form/MapTable.tpl | 2 +- .../CRM/Contribute/Form/AdditionalPayment.tpl | 2 +- .../CRM/Contribute/Form/Contribution.tpl | 6 +- templates/CRM/Contribute/Page/PaymentInfo.tpl | 2 +- templates/CRM/Custom/Form/ChangeFieldType.tpl | 2 +- templates/CRM/Custom/Form/Group.tpl | 2 +- templates/CRM/Event/Form/Participant.tpl | 2 +- templates/CRM/Member/Form/Membership.tpl | 87 +++++++++---------- templates/CRM/Profile/Form/GreetingType.tpl | 2 +- .../CRM/common/deferredFinancialType.tpl | 4 +- templates/CRM/common/importProgress.tpl | 2 +- templates/CRM/common/paymentBlock.tpl | 2 +- 17 files changed, 63 insertions(+), 68 deletions(-) diff --git a/templates/CRM/Batch/Form/Entry.tpl b/templates/CRM/Batch/Form/Entry.tpl index f2104f0d6c..fe7ebcde7e 100644 --- a/templates/CRM/Batch/Form/Entry.tpl +++ b/templates/CRM/Batch/Form/Entry.tpl @@ -341,7 +341,7 @@ function updateContactInfo(blockNo, prefix) { {/literal} {if $contactFields} {foreach from=$contactFields item=val key=fldName} - var fldName = "{$fldName}"; + var fldName = {$fldName|@json_encode}; {literal} if (returnProperties) { returnProperties = returnProperties + ','; diff --git a/templates/CRM/Case/Audit/Audit.tpl b/templates/CRM/Case/Audit/Audit.tpl index 0a39bfb6f2..af6770c2d2 100644 --- a/templates/CRM/Case/Audit/Audit.tpl +++ b/templates/CRM/Case/Audit/Audit.tpl @@ -154,7 +154,7 @@ There's the potential for collisions (two different labels having the same short if ( button.name == 'case_report' ) { var dataUrl = {/literal}"{crmURL p='civicrm/case/report/print' h=0 q='caseID='}"{literal}+id; - dataUrl = dataUrl + '&cid={/literal}{$clientID}{literal}'+'&asn={/literal}{$activitySetName}{literal}'; + dataUrl = dataUrl + '&cid={/literal}{$clientID}{literal}&asn=' + {/literal}{$activitySetName|@json_encode}{literal}; var redact = '{/literal}{$_isRedact}{literal}' var isRedact = 1; diff --git a/templates/CRM/Contact/Form/Contact.tpl b/templates/CRM/Contact/Form/Contact.tpl index b56ccc653e..7c0302360c 100644 --- a/templates/CRM/Contact/Form/Contact.tpl +++ b/templates/CRM/Contact/Form/Contact.tpl @@ -112,7 +112,7 @@