--- common.inc 2009-01-17 04:26:09.000000000 +0900 +++ /www/d5.org/includes/common.inc 2009-04-03 16:29:40.000000000 +0900 @@ -1298,11 +1298,25 @@ function url($path = NULL, $query = NULL $clean_url = (bool)variable_get('clean_url', '0'); } - $base = ($absolute ? $base_url . '/' : base_path()); + // Preserve the original path before aliasing. + $original_path = $path; // The special path '' links to the default front page. - if (!empty($path) && $path != '') { + if ($path == '') { + $path = ''; + } + elseif (!empty($path)) { $path = drupal_get_path_alias($path); + } + + if (function_exists('custom_url_rewrite_outbound')) { + // Modules may alter outbound links by reference. + custom_url_rewrite_outbound($path, $query, $fragment, $absolute, $base_url, $original_path); + } + + $base = ($absolute ? $base_url . '/' : base_path()); + + if (!empty($path)) { $path = drupal_urlencode($path); if (!$clean_url) { if (isset($query)) {