From daaeef0e8c39ebd28a865526702870b1e7733804 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 5 Jan 2004 18:23:21 +0000 Subject: - Partial patch #4927: mass URL aliasing by Goba. --- includes/common.inc | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index b631288b9..2de172c89 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -801,10 +801,14 @@ function form_allowed_tags_text() { * Given an old url, return the alias. */ function drupal_get_path_alias($path) { - $map = drupal_get_path_map(); - - if ($map) { - return array_search($path, $map); + if (($map = drupal_get_path_map()) && ($newpath = array_search($path, $map))) { + return $newpath; + } + elseif (function_exists("conf_url_rewrite")) { + return conf_url_rewrite($path, 'outgoing'); + } + else { + return $path; } } @@ -812,9 +816,15 @@ function drupal_get_path_alias($path) { * Given an alias, return the default url. */ function drupal_get_normal_path($path) { - $map = drupal_get_path_map(); - - return $map[$path] ? $map[$path] : $path; + if (($map = drupal_get_path_map()) && isset($map[$path])) { + return $map[$path]; + } + elseif (function_exists("conf_url_rewrite")) { + return conf_url_rewrite($path, 'incoming'); + } + else { + return $path; + } } function url($url = NULL, $query = NULL, $fragment = NULL) { -- cgit v1.2.3