diff --git a/docroot/sites/all/modules/contrib/r4032login/r4032login.module b/docroot/sites/all/modules/contrib/r4032login/r4032login.module index f1aeb9a..8a6986a 100644 --- a/docroot/sites/all/modules/contrib/r4032login/r4032login.module +++ b/docroot/sites/all/modules/contrib/r4032login/r4032login.module @@ -91,17 +91,23 @@ function r4032login_form_system_site_information_settings_alter(&$form, &$form_s ); $form['error_page']['matching_paths'] = array( '#type' => 'fieldset', - '#title' => t('Skip redirect for matching pages'), + '#title' => t('Skip/Not skip redirect for matching pages'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 10, ); $form['error_page']['matching_paths']['r4032login_match_noredirect_pages'] = array( '#type' => 'textarea', - '#title' => '' . t('Only the listed pages') . '', + '#title' => t('Do not redirect on these paths'), '#default_value' => variable_get('r4032login_match_noredirect_pages', ''), '#description' => t('Instead of redirecting, the user will get an access deined response and see the standard login form. This may be useful when the response code is important - such as for removing outdated content from search engines. Use the path node/* for all content.') . ' ' . t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '')), ); + $form['error_page']['matching_paths']['r4032login_match_noredirect_but_redirect_pages'] = array( + '#type' => 'textarea', + '#title' => t('Redirect on these paths anyway'), + '#default_value' => variable_get('r4032login_match_noredirect_but_redirect_pages', ''), + '#description' => t('Since Drupal only allows all or nothing with the "*" placeholder, excluding "node/*" also excludes "node/add/*" which makes it difficult to differentiate those paths. Input paths that are excluded by the above rules, but should trigger a redirect anyway. Do NOT put in all paths for redirecting here.'), + ); $form['error_page']['matching_paths']['r4032login_show_access_denied_message_on_noredirect'] = array( '#type' => 'checkbox', '#title' => t("Show 'access denied' message if there is no redirect happening"), @@ -164,6 +170,30 @@ function r4032login_redirect() { if ($path != $_GET['destination']) { $page_match = $page_match || drupal_match_path($_GET['destination'], $pages); } + + // Check for pages, that maybe are not redirect, because Drupals '*' + // placeholder eats too much of the path. + if ($page_match) { + // Initiate redirect match. The end value of this variable is used to + // set $page_match later on. + $redirect_match = FALSE; + + // Get redirect page paths. + $redirect_pages = variable_get('r4032login_match_noredirect_but_redirect_pages', ''); + + if ($redirect_pages) { + // Compare to current path. + $redirect_match = drupal_match_path($path, $redirect_pages); + + // Compare with destination also if those differ from each other. + if ($path != $_GET['destination']) { + $redirect_match = $redirect_match || drupal_match_path($_GET['destination'], $redirect_pages); + } + } + + // Set page match. + $page_match = !$redirect_match; + } } if ($page_match) { // Add 'access denied' message, if so wanted.