You are here

function _persistent_login_match in Persistent Login 5

Same name and namespace in other branches
  1. 6 persistent_login.module \_persistent_login_match()
  2. 7 persistent_login.module \_persistent_login_match()

_persistent_login_match()

check the page past and see if it should be secure or insecure.

@ @

Parameters

$path: the page of the page to check.

Return value

0 - page should be insecure. 1 - page should be secure.

1 call to _persistent_login_match()
_persistent_login_check in ./persistent_login.module
_persistent_login_check(). Do the real work. Note that we may be in BOOTSTRAP_PAGE_CACHE mode with few modules loaded.

File

./persistent_login.module, line 403

Code

function _persistent_login_match($path) {
  $secure = variable_get('persistent_login_secure', 1);
  $pages = trim(variable_get('persistent_login_pages', PERSISTENT_LOGIN_SECURE_PATHS));
  if ($pages) {
    $front = variable_get('site_frontpage', 'node');
    $regexp = '/^(?:' . preg_replace(array(
      '/(\\r\\n?|\\n)/',
      '/\\\\\\*/',
      '/(^|\\|)\\\\<front\\\\>($|\\|)/',
    ), array(
      '|',
      '.*',
      '\\1' . preg_quote($front, '/') . '\\2',
    ), preg_quote($pages, '/')) . ')$/';
    return !($secure xor preg_match($regexp, $path));
  }
  else {
    return 0;
  }
}