reverted: --- b/includes/webform.pages.inc +++ a/includes/webform.pages.inc @@ -64,7 +64,7 @@ '#type' => 'item', '#title' => t('Redirection location'), '#theme' => 'webform_advanced_redirection_form', + '#description' => t('Choose where to redirect the user upon successful submission.') . ' ' . t('The Custom URL option supports Webform token replacements.') . ' ' . theme('webform_token_help', array('groups' => array('node', 'submission'))), - '#description' => t('Choose where to redirect the user upon successful submission.') . ' ' . t('The Custom URL option supports token replacements for query string values.') . ' ' . theme('webform_token_help', array('groups' => array('node', 'submission'))), ); $form['submission']['redirection']['redirect']= array( '#type' => 'radios', diff -u b/webform.module b/webform.module --- b/webform.module +++ b/webform.module @@ -3066,7 +3066,7 @@ else { // Clean up the redirect URL, filter it for tokens and remove the domain name. $redirect_url = trim($node->webform['redirect_url']); - $redirect_url = webform_replace_query_string_tokens($redirect_url, $node, $submission); + $redirect_url = webform_replace_url_tokens($redirect_url, $node, $submission); $redirect_url = preg_replace('/^' . preg_quote($GLOBALS['base_url'], '/') . '\//', '', $redirect_url); // $redirect_url is an absolute, external URL @@ -3558,34 +3558,27 @@ } /** - * Replace tokens entered as query string values in a URL. + * Replace tokens within a URL, encoding the parts within the query string. * * @param string $redirect_url - * The redirect URL, with everything other than tokens already url encoded. + * The redirect URL, with everything other than tokens already URL encoded. * @param $node * If replacing node-level tokens, the node for which tokens will be created. * @param $submission * If replacing submission-level tokens, the submission for which tokens will * be created. * @return string - * The parsed and url encoded URL + * The parsed and URL-encoded URL. */ -function webform_replace_query_string_tokens($redirect_url, $node = NULL, $submission = NULL) { - $token_data = array(); - if ($node) { - $token_data['node'] = $node; - } - if ($submission) { - $token_data['webform-submission'] = $submission; - } - +function webform_replace_url_tokens($redirect_url, $node = NULL, $submission = NULL) { $parsed_redirect_url = drupal_parse_url($redirect_url); + $parsed_redirect_url['path'] = webform_replace_tokens($parsed_redirect_url['path'], $node, $submission); if (!empty($parsed_redirect_url['query'])) { foreach ($parsed_redirect_url['query'] as $key => $value) { - $parsed_redirect_url['query'][$key] = token_replace($value, $token_data, array('clear' => true, 'sanitize' => FALSE)); + $parsed_redirect_url['query'][$key] = webform_replace_tokens($value, $node, $submission);; } - $redirect_url = url($parsed_redirect_url['path'], $parsed_redirect_url); } + $redirect_url = url($parsed_redirect_url['path'], $parsed_redirect_url); return $redirect_url; }