Index: globalredirect.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/globalredirect/Attic/globalredirect.install,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.1
diff -c -u -p -r1.1.2.2 -r1.1.2.1
--- globalredirect.install	30 Jul 2008 15:00:51 -0000	1.1.2.2
+++ globalredirect.install	8 Jul 2008 11:09:18 -0000	1.1.2.1
@@ -1,5 +1,5 @@
 <?php
-// $Id: globalredirect.install,v 1.1.2.2 2008/07/30 15:00:51 njt1982 Exp $
+// $Id: globalredirect.install,v 1.1.2.1 2008/07/08 11:09:18 njt1982 Exp $
 
 /**
  * @file
@@ -8,8 +8,8 @@
 
 
 /**
- * Implementation of hook_install().
- * Configures the site - currently only changing the weight of the module to be the last to run.
+ *  Implementation of hook_install.
+ *  Configures the site - currently only changing the weight of the module to be the last to run.
  */
 function globalredirect_install() {
   db_query("UPDATE {system} SET weight = 1500 WHERE name = 'globalredirect'");
Index: globalredirect.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/globalredirect/globalredirect.module,v
retrieving revision 1.1.2.4.2.11
retrieving revision 1.1.2.4.2.10
diff -c -u -p -r1.1.2.4.2.11 -r1.1.2.4.2.10
--- globalredirect.module	30 Jul 2008 15:00:51 -0000	1.1.2.4.2.11
+++ globalredirect.module	8 Jul 2008 11:09:18 -0000	1.1.2.4.2.10
@@ -1,5 +1,5 @@
 <?php
-// $Id: globalredirect.module,v 1.1.2.4.2.11 2008/07/30 15:00:51 njt1982 Exp $
+// $Id: globalredirect.module,v 1.1.2.4.2.10 2008/07/08 11:09:18 njt1982 Exp $
 /**
  * @file
  * The Global Redirect module redirects for all paths which have aliases but are not using the aliases which reduces the risk of duplicate content
@@ -19,12 +19,10 @@ function globalredirect_help($section) {
  * Implementation of hook_init().
  */
 function globalredirect_init() {
-  /**
-   * We need to do a test to make sure we only clean up URL's for the main request. This stops modules such as
-   * the Ad Module which had its own script in its folder doing a bootstrap which invoked hook_init and caused some banners to get "cleaned up"
-   * See issues: http://drupal.org/node/205810 and http://drupal.org/node/278615
-   */
-  if ($_SERVER['SCRIPT_NAME'] != $GLOBALS['base_path'] .'index.php') return FALSE;
+  //We need to do a test to make sure we only clean up URL's for the main request. This stops modules such as
+  //  the Ad Module which had its own script in its folder doing a bootstrap which invoked hook_init and caused some banners to get "cleaned up"
+  //  See issue: http://drupal.org/node/205810
+  if ($_SERVER['SCRIPT_NAME'] != '/index.php') return false;
 
   /**
    * We need to make sure this hook only fires in certain conditions:
@@ -35,7 +33,6 @@ function globalredirect_init() {
    */
 
   if (function_exists('drupal_get_path_alias') &&
-      function_exists('_menu_item_is_accessible') &&
       _menu_item_is_accessible(menu_get_active_item()) &&
       isset($_REQUEST['q']) &&
       empty($_POST)) {
@@ -46,9 +43,6 @@ function globalredirect_init() {
       unset($_REQUEST['destination']);
     }
 
-    // Use drupal_get_normal_path() to allow custom_url_reqwrite to effect $q
-    $q = drupal_get_normal_path($_REQUEST['q']);
-
     // Get the Query String (minus the 'q'). If none set, set to NULL
     $query_string = drupal_query_string_encode($_GET, array('q'));
     if (empty($query_string)) {
@@ -56,23 +50,23 @@ function globalredirect_init() {
     }
 
     // If current path is also the frontpage, redirect to http://www.example.com.
-    if (!empty($q) && drupal_is_front_page()) {
+    if (!empty($_REQUEST['q']) && drupal_is_front_page()) {
       drupal_goto('', $query_string, NULL, 301);
     }
 
     // Trim any trailing slash off the end (eg, 'node/1/' to 'node/1')
-    $request = trim($q, '/');
+    $request = trim($_REQUEST['q'], '/');
 
     // Check the path (eg, node/123) for an request.
     $alias = drupal_get_path_alias($request);
 
     // If alias is different to the request, redirect...
-    if ($alias != $_REQUEST['q']) {
+    if ($alias != $request) {
       drupal_goto($alias, $query_string, NULL, 301);
     }
 
     // If the trimmed request differs to the request then redirect (basically, de-slash the source path)
-    if ($request != $q) {
+    if ($request != $_REQUEST['q']) {
       drupal_goto($request, $query_string, NULL, 301);
     }
 
