You are here

function _pages_restriction_unset_sections_with_path in Pages Restriction Access 7

Implements OneTouch Restriction Access.

Parameters

string $path_alias: String current URL Path Alias that users access.

2 calls to _pages_restriction_unset_sections_with_path()
pages_restriction_page_alter in ./pages_restriction.module
Implements hook_page_alter().
_pages_restriction_restrict_access in includes/pages_restriction.helpers.inc
Restriction rules feature for Pages Restriction.

File

includes/pages_restriction.helpers.inc, line 260
Contains the helpers functions for the Pages Restriction.

Code

function _pages_restriction_unset_sections_with_path($path_alias) {
  module_load_include('inc', 'pages_restriction', 'includes/pages_restriction.cache');
  $watchdog_message = t('Session @session ended on @$path_alias');
  $watchdog_values = array(
    '@$path_alias' => $path_alias,
  );
  $rules = _pages_restriction_get_rules_by_path($path_alias);
  foreach ($rules as $key => $rule) {
    foreach ($rule as $page) {
      if (preg_match('@^' . str_replace('%', '\\w*', trim($page)) . '$@', trim($path_alias))) {
        if (isset($_SESSION['pages_restriction_id_session_' . $key])) {
          $watchdog_values['@session'] = $_SESSION['pages_restriction_id_session_' . $key];
          _pages_restriction_debug_info($watchdog_message, $watchdog_values);
          _pages_restriction_delete_cached_data($_SESSION['pages_restriction_id_session_' . $key], $key);
          unset($_SESSION['pages_restriction_id_session_' . $key]);
        }
      }
    }
  }
}