Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.476
diff -u -F^f -r1.476 common.inc
--- includes/common.inc	31 Aug 2005 18:37:30 -0000	1.476
+++ includes/common.inc	13 Sep 2005 18:45:44 -0000
@@ -136,14 +136,12 @@ function drupal_clear_path_cache() {
 function drupal_get_normal_path($path) {
   //drupal_get_path_alias($path);
   if ($src = drupal_lookup_path('alias', $path)) {
-    return $src;
+    $path = $src;
   }
-  elseif (function_exists('conf_url_rewrite')) {
-    return conf_url_rewrite($path, 'incoming');
-  }
-  else {
-    return $path;
+  foreach (array_reverse(module_implements('url_rewrite')) as $module) {
+    $path = module_invoke($module, 'url_rewrite', 'inccoming', $path);
   }
+  return $path;
 }
 
 /**
Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.66
diff -u -F^f -r1.66 bootstrap.inc
--- includes/bootstrap.inc	8 Sep 2005 19:17:34 -0000	1.66
+++ includes/bootstrap.inc	13 Sep 2005 18:45:44 -0000
@@ -530,15 +530,12 @@ function drupal_lookup_path($action, $pa
  */
 function drupal_get_path_alias($path) {
   if ($alias = drupal_lookup_path('source', $path)) {
-    return $alias;
+    $path = $alias;
   }
-  elseif (function_exists('conf_url_rewrite')) {
-    return conf_url_rewrite($path, 'outgoing');
-  }
-  else {
-    // No alias found. Return the normal path.
-    return $path;
+  foreach (module_implements('url_rewrite') as $module) {
+    $path = module_invoke($module, 'url_rewrite', 'outgoing', $path);
   }
+  return $path;
 }
 
 /**
@@ -682,6 +679,7 @@ function arg($index) {
 
   if (empty($arguments) || $q != $_GET['q']) {
     $arguments = explode('/', $_GET['q']);
+    $q = $_GET['q'];
   }
 
   if (isset($arguments[$index])) {
