? .svn ? gr_d5_working.2.diff.txt ? gr_d5_working.diff.txt ? po/.svn Index: globalredirect.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/globalredirect/globalredirect.module,v retrieving revision 1.1.2.4.2.7 diff -u -p -r1.1.2.4.2.7 globalredirect.module --- globalredirect.module 29 Dec 2007 15:19:53 -0000 1.1.2.4.2.7 +++ globalredirect.module 29 Mar 2008 10:54:05 -0000 @@ -16,38 +16,48 @@ function globalredirect_help($section) { * Implementation of hook_init(). */ function globalredirect_init() { - 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 - $query_string = drupal_query_string_encode($_GET, array('q')); - if (empty($query_string)) { - $query_string = NULL; - } - + + if(isset($_REQUEST['q']) && function_exists('drupal_get_path_alias') && !isset($_REQUEST['destination'])) { // If current path is also the frontpage, redirect to http://www.example.com. if (!empty($_REQUEST['q']) && drupal_is_front_page()) { - drupal_goto('', $query_string, NULL, 301); + if (!in_array($_REQUEST['q'], array_keys(i18n_language_list()))) { + drupal_goto('', $query_string, NULL, 301); + } } - + // Trim any trailing slash off the end (eg, 'node/1/' to 'node/1') $request = trim($_REQUEST['q'], '/'); + + if(function_exists('i18n_get_normal_path')) { + $path = i18n_get_normal_path($request); + $alias = drupal_get_path_alias($path); + $reqalias = drupal_get_path_alias($request); + if($alias && $alias != $request) { + if (i18n_get_lang_prefix($request) && i18n_get_lang_prefix($request) != i18n_get_lang()) { + $alias = i18n_path($path,i18n_get_lang_prefix($request)); + drupal_goto($alias, $query_string, NULL, 301); + return; + } + drupal_goto($alias, $query_string, NULL, 301); + return; + } + } - // 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) { - drupal_goto($alias, $query_string, NULL, 301); + drupal_goto($alias, $query_string, NULL, 301); + return; } - - // If the trimmed request differs to the request then redirect (basically, de-slash the source path) + if ($request != $_REQUEST['q']) { drupal_goto($request, $query_string, NULL, 301); + return; } //If no alias was returned, the final check is to direct non-clean to clean - if clean is enabled. if ((bool)variable_get('clean_url', 0) && strpos(request_uri(), '?q=')) { - drupal_goto($request, $query_string, NULL, 301); - } - } + drupal_goto($request, $query_string, NULL, 301); + return; + } + } }