if (substr($url, 0, 4) !== 'http') {
//CRM-7656 --make sure to separate out url path from url params,
//as we'r going to validate url path across cross-site scripting.
- $urlParam = explode('?', $url);
- if (empty($urlParam[1])) {
- $urlParam[1] = NULL;
+ $parsedUrl = parse_url($url);
+ if (empty($parsedUrl['query'])) {
+ $parsedUrl['query'] = NULL;
}
- $url = CRM_Utils_System::url($urlParam[0], $urlParam[1], FALSE, NULL, TRUE);
+ if (empty($parsedUrl['fragment'])) {
+ $parsedUrl['fragment'] = NULL;
+ }
+ $url = CRM_Utils_System::url($parsedUrl['path'], $parsedUrl['query'], FALSE, $parsedUrl['fragment'], TRUE);
}
elseif (strpos($url, '&') === FALSE) {
$url = htmlspecialchars($url);