diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-09-18 10:32:05 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-09-18 10:32:05 +0000 |
commit | ceb9859d70080b67ab2a46ee93528f0813d734a2 (patch) | |
tree | 5d61eea920612faada9cbd0a9466d9ab6d7257d7 /includes/bootstrap.inc | |
parent | f0cc7b4efcc9a8b8a90bb76d5ad19f6db103cf34 (diff) | |
download | brdo-ceb9859d70080b67ab2a46ee93528f0813d734a2.tar.gz brdo-ceb9859d70080b67ab2a46ee93528f0813d734a2.tar.bz2 |
- Patch #29030 by Goba, chx, Jose, et al: reworked the URL rewrite hook so URLs can be rewritten dynamically.
Diffstat (limited to 'includes/bootstrap.inc')
-rw-r--r-- | includes/bootstrap.inc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index db111b428..d9754a0fc 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -476,8 +476,8 @@ function drupal_load($type, $name) { * @param $action * One of the following values: * - wipe: delete the alias cache. - * - source: indicates that given a Drupal system URL, return an alias if one exists. - * - alias: indicates that given an path alias, return the Drupal system URL if one exists. + * - alias: return an alias for a given Drupal system path (if one exists). + * - source: return the Drupal system URL for a path alias (if one exists). * @param $path * The path to investigate for corresponding aliases or system URLs. */ @@ -494,7 +494,7 @@ function drupal_lookup_path($action, $path = '') { $map = array(); } elseif ($count > 0 && $path != '') { - if ($action == 'source') { + if ($action == 'alias') { if (isset($map[$path])) { return $map[$path]; } @@ -506,7 +506,7 @@ function drupal_lookup_path($action, $path = '') { $map[$path] = $path; } } - elseif ($action == 'alias') { + elseif ($action == 'source') { if ($alias = array_search($path, $map)) { return $alias; } @@ -529,16 +529,14 @@ function drupal_lookup_path($action, $path = '') { * Given an internal Drupal path, return the alias set by the administrator. */ function drupal_get_path_alias($path) { - if ($alias = drupal_lookup_path('source', $path)) { - return $alias; + $result = $path; + if ($alias = drupal_lookup_path('alias', $path)) { + $result = $alias; } - elseif (function_exists('conf_url_rewrite')) { - return conf_url_rewrite($path, 'outgoing'); - } - else { - // No alias found. Return the normal path. - return $path; + if (function_exists('custom_url_rewrite')) { + $result = custom_url_rewrite('alias', $result, $path); } + return $result; } /** @@ -682,6 +680,7 @@ function arg($index) { if (empty($arguments) || $q != $_GET['q']) { $arguments = explode('/', $_GET['q']); + $q = $_GET['q']; } if (isset($arguments[$index])) { |