function domain_grant_all in Domain Access 6.2
Same name and namespace in other branches
- 5 domain.module \domain_grant_all()
- 7.3 domain.module \domain_grant_all()
- 7.2 domain.module \domain_grant_all()
Activate the hidden grant for searches.
Parameters
$reset: A boolean flag indicating whether to reset the static variable or not.
Return value
TRUE or FALSE, depending on whether the grants should be executed for this page.
4 calls to domain_grant_all()
- domain_db_rewrite_sql in ./
domain.module - Implement hook_db_rewrite_sql().
- domain_node_access_explain in ./
domain.module - Implement hook_node_access_explain for devel.module
- domain_node_grants in ./
domain.module - Implement hook_node_grants.
- domain_url_outbound_alter in ./
settings_custom_url.inc - Implement hook_url_outbound_alter().
1 string reference to 'domain_grant_all'
- domain_configure_form in ./
domain.admin.inc - FormsAPI for configuring the domain module.
File
- ./
domain.module, line 2152 - Core module functions for the Domain Access suite.
Code
function domain_grant_all($reset = FALSE) {
static $grant;
$options = array();
if (!isset($grant) || $reset) {
$grant = FALSE;
// Search is the easy case, so we check it first.
if (variable_get('domain_search', 0) && arg(0) == 'search') {
$options['search'] = TRUE;
$grant = TRUE;
}
// On cron runs, we normally have to disable Domain Access. See http://drupal.org/node/197488.
// We also check XMLRPC. See http://drupal.org/node/775028.
if (!$grant) {
$ref = explode('/', request_uri());
$script = array_pop($ref);
if (variable_get('domain_cron_rule', 1) && $script == 'cron.php') {
$options['script'] = $script;
$grant = TRUE;
}
else {
if (variable_get('domain_xmlrpc_rule', 0) && $script == 'xmlrpc.php') {
$options['script'] = $script;
$grant = TRUE;
}
}
}
if (!$grant) {
// We check the paths registered by the special pages setting.
$pages = variable_get('domain_grant_all', "user/*/track");
$options['pages'] = $pages;
$regexp = '/^(' . preg_replace(array(
'/(\\r\\n?|\\n)/',
'/\\\\\\*/',
'/(^|\\|)\\\\<front\\\\>($|\\|)/',
), array(
'|',
'.*',
'\\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\\2',
), preg_quote($pages, '/')) . ')$/';
// Compare with the internal and path alias (if any).
$page_match = preg_match($regexp, $_GET['q']);
if (!$page_match && function_exists('drupal_get_path_alias')) {
$path = drupal_get_path_alias($_GET['q']);
if ($path != $_GET['q']) {
$page_match = preg_match($regexp, $path);
}
}
if ($page_match) {
$options['page_match'] = TRUE;
$grant = TRUE;
}
}
}
// Allow other modules to change the defaults.
drupal_alter('domain_grant_all', $grant, $options);
return $grant;
}