diff options
author | Neil Drumm <drumm@3064.no-reply.drupal.org> | 2006-07-02 01:20:19 +0000 |
---|---|---|
committer | Neil Drumm <drumm@3064.no-reply.drupal.org> | 2006-07-02 01:20:19 +0000 |
commit | bd61d17db4f990b773b0f58e42c16c8e7a69645c (patch) | |
tree | e8505c09000540459a30c9b9da9b833a12503621 /includes/common.inc | |
parent | 685be2ffcefb686a903f9192343dd4477450029b (diff) | |
download | brdo-bd61d17db4f990b773b0f58e42c16c8e7a69645c.tar.gz brdo-bd61d17db4f990b773b0f58e42c16c8e7a69645c.tar.bz2 |
#68886 by myself and Steven, Handle ampersands in search queries and other URLs when clean URLs are on
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc index 3a13bdba6..79a1d8286 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1284,11 +1284,25 @@ function drupal_to_js($var) { * are urlencoded() when passed through url() and do not require urlencoding() * of individual components. * + * Notes: + * - For esthetic reasons, we do not escape slashes. This also avoids a 'feature' + * in Apache where it 404s on any path containing '%2F'. + * - mod_rewrite's unescapes %-encoded ampersands and hashes when clean URLs + * are used, which are interpreted as delimiters by PHP. These characters are + * double escaped so PHP will still see the encoded version. + * * @param $text * String to encode */ function drupal_urlencode($text) { - return str_replace('%2F', '/', urlencode($text)); + if (variable_get('clean_url', '0')) { + return str_replace(array('%2F', '%26', '%23'), + array('/', '%2526', '%2523'), + urlencode($text)); + } + else { + return str_replace('%2F', '/', urlencode($text)); + } } /** |