### Eclipse Workspace Patch 1.0
#P drupal-contrib-5
Index: modules/globalredirect/globalredirect.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/globalredirect/globalredirect.module,v
retrieving revision 1.1.2.4.2.2
diff -u -r1.1.2.4.2.2 globalredirect.module
--- modules/globalredirect/globalredirect.module	6 Feb 2007 01:09:28 -0000	1.1.2.4.2.2
+++ modules/globalredirect/globalredirect.module	25 Apr 2007 14:39:27 -0000
@@ -17,36 +17,29 @@
  * Implementation of hook_init().
  */
 function globalredirect_init() {
-  if(isset($_REQUEST['q']) && function_exists('drupal_get_path_alias') && !isset($_REQUEST['destination'])) {
+  if (isset($_REQUEST['q']) && function_exists('drupal_get_path_alias') && !isset($_REQUEST['destination'])) {
     
-    //Get the Query String (minus the 'q'). If none set, set to NULL
+    // Get the query string (minus the 'q'). If none set, set to NULL.
     if (($query_string = drupal_query_string_encode($_GET, array('q'))) == '') {
       $query_string = NULL;
     }
 
-
-
-    //Lets do a check to compare the current url to the site's frontpage.
-    //  If matches, redirect to the frontpage (eg, http://www.mysite.com/)
-    if(drupal_is_front_page()) {
+    // Lets do a check to compare the current url to the site's frontpage.
+    // If matches, redirect to the frontpage (e.g. http://www.example.com/).
+    if ($_REQUEST['q'] == variable_get('site_frontpage', 'node')) {
       drupal_goto('', $query_string, NULL, 301);
     }
-
     
-    
-    //Check the current url (eg, node/123) for an alias... If set, redirect to it
-    $alias = drupal_get_path_alias($_REQUEST['q']);
-    if ($alias != $_REQUEST['q']) {
+    // Check the current url (eg, node/123) for an alias. If set, redirect to it.
+    if ($_REQUEST['q'] != drupal_get_path_alias($_REQUEST['q'])) {
       drupal_goto($alias, $query_string, NULL, 301);
     }
     
-    
-    //Check if the current url ends in a slash (eg, node/123/)
-    if(substr($_REQUEST['q'], -1) == "/") {
-      //Ok - it does. Seeing as it didn't have an exact match WITH the slash in the above test, lets try without...
-      $alias = drupal_get_path_alias(substr($_REQUEST['q'], 0, -1));
-      if ($alias != $_REQUEST['q']) {
-        //We matched an alias for the current URL with no slash - redirect to that...
+    // Check if the current url ends in a slash (eg, node/123/).
+    if (substr($_REQUEST['q'], -1) == "/") {
+      // Ok - it does. Seeing as it didn't have an exact match WITH the slash in the above test, lets try without...
+      if ($_REQUEST['q'] != drupal_get_path_alias(substr($_REQUEST['q'], 0, -1))) {
+        // We matched an alias for the current URL with no slash - redirect to that...
         drupal_goto($alias, $query_string, NULL, 301);
       }
     }
