I've got a url in my newsletter:
http://www.example.com/smartsite.dws?ch=int&id=73822
When sending the email, the following page is loaded: http://www.purmerend.nl/smartsite.dws?ch=int
This is because the url is not htmlencoded.
I've changed the following code
function _simplenews_statistics_replace_url($match, $nid, $mail) {
if (substr($match, 0, 1) == "#")
return $match;
require_once drupal_get_path('module', 'simplenews_statistics') .'/rc4.inc';
$pars = 'nid='. $nid .'&mail='. $mail .'&url='.$match;
$pars = rc4Encrypt(simplenews_private_key(), $pars);
$pars_hash = md5($pars);
return url('simplenews/statistics/click', array('absolute' => TRUE, 'query' => array('p' => _simplenews_statistics_encode_parameter($pars),
'h' => _simplenews_statistics_encode_parameter($pars_hash))));
}
to
function _simplenews_statistics_replace_url($match, $nid, $mail) {
if (substr($match, 0, 1) == "#")
return $match;
require_once drupal_get_path('module', 'simplenews_statistics') .'/rc4.inc';
$pars = 'nid='. $nid .'&mail='. $mail .'&url='. urlencode($match);
$pars = rc4Encrypt(simplenews_private_key(), $pars);
$pars_hash = md5($pars);
return url('simplenews/statistics/click', array('absolute' => TRUE, 'query' => array('p' => _simplenews_statistics_encode_parameter($pars),
'h' => _simplenews_statistics_encode_parameter($pars_hash))));
}
As you can see, i've added a urlencode on the url. This solved the problem for me. Would be great if this would be added to the next release :)
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | simplenews_statistics.patch | 758 bytes | luksak |
| #2 | simplenews_statistics-644582.patch | 767 bytes | weseze |
Comments
Comment #1
Docc commentedtnx will review when i find the time
Comment #2
weseze commentedThe problem can also be solved when creating the url for the drupal_goto function in the simplenews_statistics_click() function. I think this would be a better place for a patch, because the full data of the url is stored and in this way the patch is bacwards compatible.
I haven't got much time to write a clean patch, but the one attached works.
Comment #3
luksakworks for me.
please apply this.
Comment #4
luksakyour patch had a little error.
here is the fixed patch.
Comment #5
Docc commentedCommited to 3.x