-
-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-20206 Fix encoding in plain text checksum links #9917
Conversation
JKingsnorth
commented
Mar 2, 2017
•
edited by civicrm-builder
Loading
edited by civicrm-builder
- CRM-20206: & encoded to & in plain text email checksum links
@@ -1469,7 +1469,7 @@ private function getTokenData(&$token_a, $html = FALSE, &$contact, &$verp, &$url | |||
if ($type == 'embedded_url') { | |||
$embed_data = array(); | |||
foreach ($token as $t) { | |||
$embed_data[] = $this->getTokenData($t, $html = FALSE, $contact, $verp, $urls, $event_queue_id); | |||
$embed_data[] = $this->getTokenData($t, $html, $contact, $verp, $urls, $event_queue_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was always passing in true (because it was setting it to FALSE) - my brain hurts :P
CRM/Mailing/BAO/Mailing.php
Outdated
@@ -1488,6 +1488,9 @@ private function getTokenData(&$token_a, $html = FALSE, &$contact, &$verp, &$url | |||
$url .= '"'; | |||
} | |||
$data = $url; | |||
if (empty($html)) { | |||
$data = str_replace('&', '&', $data); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like the other tokens, we need to replace html entities in plain text emails
CRM/Mailing/BAO/Mailing.php
Outdated
@@ -1488,6 +1488,9 @@ private function getTokenData(&$token_a, $html = FALSE, &$contact, &$verp, &$url | |||
$url .= '"'; | |||
} | |||
$data = $url; | |||
if (empty($html)) { | |||
$data = str_replace('&', '&', $data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JKingsnorth John could we use this function here https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/String.php#L439 to do the same thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or this https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/String.php#L783 for that matter
Looking at the code the $html variable means 'encode for html', I would really prefer that the code comments for the variable were updated to clarify that, but, I agree that the fixes are correct & I'm going to merge. Thanks @seamuslee001 for digging out a pre-existing function. |
CRM-20206 Fix encoding in plain text checksum links