From 47cf9dd9fbb930ad2238ae131ae0fef60ce27a74 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Fri, 3 Mar 2006 08:46:09 +0000 Subject: [PATCH] - Patch #46746 by Matt: fixed inconsistent encoding of path aliases. Fixes broken URLs on profile pages. --- database/updates.inc | 9 +++++++++ modules/path.module | 2 ++ modules/path/path.module | 2 ++ modules/profile.module | 2 +- modules/profile/profile.module | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/database/updates.inc b/database/updates.inc index c4812c45acb8..07774956ab1b 100644 --- a/database/updates.inc +++ b/database/updates.inc @@ -1659,3 +1659,12 @@ function system_update_174() { } return array(); } + +function system_update_175() { + $result = db_query('SELECT * FROM {url_alias}'); + while ($path = db_fetch_object($result)) { + $path->src = urldecode($path->src); + $path->dst = urldecode($path->dst); + db_query("UPDATE {url_alias} SET dst = '%s', src = '%s' WHERE pid = %d", $path->dst, $path->src, $path->pid); + } +} diff --git a/modules/path.module b/modules/path.module index cce40f470cec..d93ca5cef734 100644 --- a/modules/path.module +++ b/modules/path.module @@ -144,7 +144,9 @@ function path_set_alias($path = NULL, $alias = NULL, $pid = NULL) { drupal_clear_path_cache(); } else if ($path && $alias) { + $path = urldecode($path); $path_count = db_result(db_query("SELECT COUNT(src) FROM {url_alias} WHERE src = '%s'", $path)); + $alias = urldecode($alias); $alias_count = db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s'", $alias)); // We have an insert: diff --git a/modules/path/path.module b/modules/path/path.module index cce40f470cec..d93ca5cef734 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -144,7 +144,9 @@ function path_set_alias($path = NULL, $alias = NULL, $pid = NULL) { drupal_clear_path_cache(); } else if ($path && $alias) { + $path = urldecode($path); $path_count = db_result(db_query("SELECT COUNT(src) FROM {url_alias} WHERE src = '%s'", $path)); + $alias = urldecode($alias); $alias_count = db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s'", $alias)); // We have an insert: diff --git a/modules/profile.module b/modules/profile.module index 8d9655657c3a..34fbb55f09bb 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -665,7 +665,7 @@ function _profile_field_form($type, $edit = array()) { $form['fields']['page'] = array('#type' => 'textfield', '#title' => t('Page title'), '#default_value' => $edit['page'], - '#description' => t('The title of the page showing all users with the specified field. The word <code>%value</code> will be substituted with the corresponding value. An example page title is "People whose favorite color is %value". Only applicable if the field is configured to be shown on member list pages.'), + '#description' => t('The title of the page showing all users with the specified field. The word <code>%value</code> will be substituted with the corresponding value. An example page title is "People whose favorite color is %value". This is only applicable for a public field.'), ); } else { diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 8d9655657c3a..34fbb55f09bb 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -665,7 +665,7 @@ function _profile_field_form($type, $edit = array()) { $form['fields']['page'] = array('#type' => 'textfield', '#title' => t('Page title'), '#default_value' => $edit['page'], - '#description' => t('The title of the page showing all users with the specified field. The word <code>%value</code> will be substituted with the corresponding value. An example page title is "People whose favorite color is %value". Only applicable if the field is configured to be shown on member list pages.'), + '#description' => t('The title of the page showing all users with the specified field. The word <code>%value</code> will be substituted with the corresponding value. An example page title is "People whose favorite color is %value". This is only applicable for a public field.'), ); } else { -- GitLab