diff -Naur globalredirect/globalredirect.admin.inc globalredirect.webdav/globalredirect.admin.inc --- globalredirect/globalredirect.admin.inc 1969-12-31 19:00:00.000000000 -0500 +++ globalredirect.webdav/globalredirect.admin.inc 2008-09-25 03:37:56.000000000 -0400 @@ -0,0 +1,30 @@ + 'fieldset', + '#title' => t('URL settings'), + '#weight' => -2, + '#collapsible' => TRUE, + '#collapsed' => FALSE + ); + $form['url_settings']['globalredirect_redirect_exceptions'] = array ( + '#type' => 'textfield', + '#title' => t("Redirection exceptions"), + '#default_value' => globalredirect_redirect_exceptions(), + '#description' => t("A list of path info separated by commas, that should not be redirected. Each element will be compared with the start of user URL so /my_protected_url/ will match /my_protected_url/my_folder and also /my_protected_url/my_file.html.") + ); + return system_settings_form($form); +} \ Pas de fin de ligne à la fin du fichier. diff -Naur globalredirect/globalredirect.module globalredirect.webdav/globalredirect.module --- globalredirect/globalredirect.module 2008-09-25 03:27:46.000000000 -0400 +++ globalredirect.webdav/globalredirect.module 2008-09-25 03:56:14.000000000 -0400 @@ -74,6 +74,22 @@ // Trim any trailing slash off the end (eg, 'node/1/' to 'node/1') $request = trim($_GET['q'], '/'); + + // Make some exceptions + $exceptions=strtolower(globalredirect_redirect_exceptions()); + if (strlen($exceptions)!=0) { + $exceptions=explode(",",$exceptions); + $tmp=strtolower($request); + foreach($exceptions as $exception) { + $exception=trim($exception, "/ \t"); + $exception_size=strlen($exception); + if ($exception_size>0) { + if (substr($request,0,$exception_size) == $exception) { + return; + } + } + } + } // Check the path (eg, node/123) for the request $alias = drupal_get_path_alias($request); @@ -92,3 +108,32 @@ if (isset($destination)) $_REQUEST['destination'] = $destination; } } + + +/** + * Implementation of hook_menu + */ +function globalredirect_menu() { + $items = array ( + 'admin/settings/globalredirect' => array ( + 'title' => 'GlobalRedirect Settings', + 'description' => 'Configure GlobalRedirect.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array ('globalredirect_admin_settings'), + 'access arguments' => array ('administer site configuration'), + 'file' => 'globalredirect.admin.inc', + ), + + ); + return $items; +} + + +/** + * Get admon settings about exceptions. + * + * @return a string of url separated by commas. + */ +function globalredirect_redirect_exceptions() { + return variable_get('globalredirect_redirect_exceptions', ''); +}