summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2005-12-22 22:58:12 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2005-12-22 22:58:12 +0000
commitb43fa0f9dad586617b6577f72523e78a0b99ea3d (patch)
treecb3c34b7631d8e795328feb7cda0256cf0c964ac
parent3783e6304c0984d32453d02a4690e8e70080c857 (diff)
downloadbrdo-b43fa0f9dad586617b6577f72523e78a0b99ea3d.tar.gz
brdo-b43fa0f9dad586617b6577f72523e78a0b99ea3d.tar.bz2
- #41744: global urlencode() for menu paths
-rw-r--r--includes/common.inc7
-rw-r--r--includes/locale.inc2
-rw-r--r--modules/profile.module6
-rw-r--r--modules/profile/profile.module6
-rw-r--r--modules/search.module6
-rw-r--r--modules/search/search.module6
-rw-r--r--modules/taxonomy.module7
-rw-r--r--modules/taxonomy/taxonomy.module7
8 files changed, 22 insertions, 25 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 22b93767a..cf194cbc5 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -963,6 +963,7 @@ function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
}
$path = drupal_get_path_alias($path);
+ $path = drupal_urlencode($path);
if (isset($fragment)) {
$fragment = '#'. $fragment;
@@ -1251,13 +1252,15 @@ function drupal_implode_autocomplete($array) {
/**
* Wrapper around urlencode() which avoids Apache quirks.
*
- * Should be used when placing arbitrary data inside the path of a clean URL.
+ * Should be used when placing arbitrary data in an URL. Note that Drupal paths
+ * are urlencoded() when passed through url() and do not require urlencoding()
+ * of individual components.
*
* @param $text
* String to encode
*/
function drupal_urlencode($text) {
- return variable_get('clean_url', '0') ? str_replace('%2F', '/', urlencode($text)) : urlencode($text);
+ return str_replace('%2F', '/', urlencode($text));
}
/**
diff --git a/includes/locale.inc b/includes/locale.inc
index 2f986820d..c817e8673 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -74,7 +74,7 @@ function theme__locale_admin_manage_screen($form) {
foreach ($form['name'] as $key => $element) {
// Don't take form control structures
if (is_array($element) && element_child($key)) {
- $rows[] = array(check_plain($key), form_render($form['name'][$key]), form_render($form['enabled'][$key]), form_render($form['sitedefault'][$key]), ($key != 'en' ? form_render($form['translation'][$key]) : message_na()), ($key != 'en' ? l(t('delete'), 'admin/locale/language/delete/'. drupal_urlencode($key)) : ''));
+ $rows[] = array(check_plain($key), form_render($form['name'][$key]), form_render($form['enabled'][$key]), form_render($form['sitedefault'][$key]), ($key != 'en' ? form_render($form['translation'][$key]) : message_na()), ($key != 'en' ? l(t('delete'), 'admin/locale/language/delete/'. $key) : ''));
}
}
$header = array(array('data' => t('Code')), array('data' => t('English name')), array('data' => t('Enabled')), array('data' => t('Default')), array('data' => t('Translated')), array('data' => t('Operations')));
diff --git a/modules/profile.module b/modules/profile.module
index 4b9401776..ea2279cf5 100644
--- a/modules/profile.module
+++ b/modules/profile.module
@@ -146,7 +146,7 @@ function profile_menu($may_cache) {
function profile_browse() {
$name = arg(1);
- $value = arg(2);
+ list(,,$value) = explode('/', $_GET['q'], 3);
$field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page, visibility FROM {profile_fields} WHERE name = '%s'", $name));
@@ -276,9 +276,9 @@ function profile_view_field($user, $field) {
case 'textarea':
return check_markup($value);
case 'selection':
- return $browse ? l($value, 'profile/'. drupal_urlencode($field->name) .'/'. drupal_urlencode($value)) : check_plain($value);
+ return $browse ? l($value, 'profile/'. $field->name .'/'. $value) : check_plain($value);
case 'checkbox':
- return $browse ? l($field->title, 'profile/'. drupal_urlencode($field->name)) : check_plain($field->title);
+ return $browse ? l($field->title, 'profile/'. $field->name) : check_plain($field->title);
case 'url':
return '<a href="'. check_url($value) .'">'. check_plain($value) .'</a>';
case 'date':
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index 4b9401776..ea2279cf5 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -146,7 +146,7 @@ function profile_menu($may_cache) {
function profile_browse() {
$name = arg(1);
- $value = arg(2);
+ list(,,$value) = explode('/', $_GET['q'], 3);
$field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page, visibility FROM {profile_fields} WHERE name = '%s'", $name));
@@ -276,9 +276,9 @@ function profile_view_field($user, $field) {
case 'textarea':
return check_markup($value);
case 'selection':
- return $browse ? l($value, 'profile/'. drupal_urlencode($field->name) .'/'. drupal_urlencode($value)) : check_plain($value);
+ return $browse ? l($value, 'profile/'. $field->name .'/'. $value) : check_plain($value);
case 'checkbox':
- return $browse ? l($field->title, 'profile/'. drupal_urlencode($field->name)) : check_plain($field->title);
+ return $browse ? l($field->title, 'profile/'. $field->name) : check_plain($field->title);
case 'url':
return '<a href="'. check_url($value) .'">'. check_plain($value) .'</a>';
case 'date':
diff --git a/modules/search.module b/modules/search.module
index 05cca24d1..1401e2420 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -165,7 +165,7 @@ function search_menu($may_cache) {
// To remember the user's search keywords when switching across tabs,
// we dynamically add the keywords to the search tabs' paths.
$keys = search_get_keys();
- $keys = strlen($keys) ? '/'. drupal_urlencode($keys) : '';
+ $keys = strlen($keys) ? '/'. $keys : '';
foreach (module_list() as $name) {
if (module_hook($name, 'search') && $title = module_invoke($name, 'search', 'name')) {
$items[] = array('path' => 'search/'. $name . $keys, 'title' => $title,
@@ -881,7 +881,7 @@ function search_view() {
$type = 'node';
}
$keys = module_invoke($type, 'search', 'post', $_POST['edit']['keys']);
- drupal_goto('search/'. drupal_urlencode($type) .'/'. drupal_urlencode(is_null($keys) ? $_POST['edit']['keys'] : $keys));
+ drupal_goto('search/'. $type .'/'. (is_null($keys) ? $_POST['edit']['keys'] : $keys));
}
else if ($type == '') {
// Note: search/node can not be a default tab because it would take on the
@@ -898,7 +898,7 @@ function search_view() {
watchdog('search',
t('Search: %keys (%type).', array('%keys' => theme('placeholder', $keys), '%type' => module_invoke($type, 'search', 'name'))),
WATCHDOG_NOTICE,
- l(t('results'), 'search/'. drupal_urlencode($type) .'/'. drupal_urlencode($keys))
+ l(t('results'), 'search/'. $type .'/'. $keys)
);
// Collect the search results:
diff --git a/modules/search/search.module b/modules/search/search.module
index 05cca24d1..1401e2420 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -165,7 +165,7 @@ function search_menu($may_cache) {
// To remember the user's search keywords when switching across tabs,
// we dynamically add the keywords to the search tabs' paths.
$keys = search_get_keys();
- $keys = strlen($keys) ? '/'. drupal_urlencode($keys) : '';
+ $keys = strlen($keys) ? '/'. $keys : '';
foreach (module_list() as $name) {
if (module_hook($name, 'search') && $title = module_invoke($name, 'search', 'name')) {
$items[] = array('path' => 'search/'. $name . $keys, 'title' => $title,
@@ -881,7 +881,7 @@ function search_view() {
$type = 'node';
}
$keys = module_invoke($type, 'search', 'post', $_POST['edit']['keys']);
- drupal_goto('search/'. drupal_urlencode($type) .'/'. drupal_urlencode(is_null($keys) ? $_POST['edit']['keys'] : $keys));
+ drupal_goto('search/'. $type .'/'. (is_null($keys) ? $_POST['edit']['keys'] : $keys));
}
else if ($type == '') {
// Note: search/node can not be a default tab because it would take on the
@@ -898,7 +898,7 @@ function search_view() {
watchdog('search',
t('Search: %keys (%type).', array('%keys' => theme('placeholder', $keys), '%type' => module_invoke($type, 'search', 'name'))),
WATCHDOG_NOTICE,
- l(t('results'), 'search/'. drupal_urlencode($type) .'/'. drupal_urlencode($keys))
+ l(t('results'), 'search/'. $type .'/'. $keys)
);
// Collect the search results:
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index 97a069488..10a593e3d 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -1044,9 +1044,6 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
drupal_not_found();
}
- // Needed for '+' to show up in RSS discovery URLs
- $rss_tids = urlencode($str_tids);
-
if ($tids) {
$result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {term_data} t WHERE t.tid IN (%s)', 't', 'tid'), implode(',', $tids));
$tids = array(); // we rebuild the $tids-array so it only contains terms the user has access to.
@@ -1074,10 +1071,10 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
drupal_add_link(array('rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => 'RSS - '. $title,
- 'href' => url('taxonomy/term/'. $rss_tids .'/'. $depth .'/feed')));
+ 'href' => url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed')));
$output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
- $output .= theme('xml_icon', url("taxonomy/term/$rss_tids/$depth/feed"));
+ $output .= theme('xml_icon', url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'));
return $output;
break;
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 97a069488..10a593e3d 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -1044,9 +1044,6 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
drupal_not_found();
}
- // Needed for '+' to show up in RSS discovery URLs
- $rss_tids = urlencode($str_tids);
-
if ($tids) {
$result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {term_data} t WHERE t.tid IN (%s)', 't', 'tid'), implode(',', $tids));
$tids = array(); // we rebuild the $tids-array so it only contains terms the user has access to.
@@ -1074,10 +1071,10 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
drupal_add_link(array('rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => 'RSS - '. $title,
- 'href' => url('taxonomy/term/'. $rss_tids .'/'. $depth .'/feed')));
+ 'href' => url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed')));
$output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
- $output .= theme('xml_icon', url("taxonomy/term/$rss_tids/$depth/feed"));
+ $output .= theme('xml_icon', url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'));
return $output;
break;