function domain_grant_all in Domain Access 7.3
Same name and namespace in other branches
- 5 domain.module \domain_grant_all()
- 6.2 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_admin_filter in ./
domain.module - Determines if node lists should be filtered for admins.
- domain_node_access_explain in ./
domain.module - Implements hook_node_access_explain().
- domain_node_grants in ./
domain.module - Implements hook_node_grants().
- domain_url_outbound_alter in ./
settings_custom_url.inc - Implements hook_url_outbound_alter().
2 string references to 'domain_grant_all'
- domain_configure_form in ./
domain.admin.inc - FormsAPI for configuring the domain module.
- domain_uninstall in ./
domain.install - Implements hook_uninstall().
File
- ./
domain.module, line 2839 - Core module functions for the Domain Access suite.
Code
function domain_grant_all($reset = FALSE) {
$grant =& drupal_static(__FUNCTION__);
$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);
// Note that cron can be invoked from services other than cron.php,
// so we check for that case and set the script variable manually.
if (variable_get('domain_cron_rule', 1) && domain_cron_status()) {
$options['script'] = 'cron.php';
$grant = TRUE;
}
elseif (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;
}