function drupalchat_verify_access in DrupalChat 7
Same name and namespace in other branches
- 6.2 drupalchat.module \drupalchat_verify_access()
- 7.2 drupalchat.module \drupalchat_verify_access()
2 calls to drupalchat_verify_access()
- drupalchat_init in ./drupalchat.module
- @todo Please document this function.
- drupalchat_page_alter in ./drupalchat.module
File
- ./drupalchat.module, line 28
- Module code for DrupalChat.
Code
function drupalchat_verify_access() {
global $user;
$page_match = FALSE;
if (variable_get('drupalchat_path_pages', NULL)) {
$pages = drupal_strtolower(variable_get('drupalchat_path_pages', NULL));
if (variable_get('drupalchat_path_visibility', BLOCK_VISIBILITY_NOTLISTED) < BLOCK_VISIBILITY_PHP) {
$path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
$page_match = drupal_match_path($path, $pages);
if ($path != $_GET['q']) {
$page_match = $page_match || drupal_match_path($_GET['q'], $pages);
}
$page_match = !(variable_get('drupalchat_path_visibility', BLOCK_VISIBILITY_NOTLISTED) xor $page_match);
}
elseif (module_exists('php')) {
$page_match = php_eval(variable_get('drupalchat_path_pages', NULL));
}
else {
$page_match = FALSE;
}
}
else {
$page_match = TRUE;
}
$final = FALSE;
$final = (variable_get('drupalchat_rel', DRUPALCHAT_REL_AUTH) == DRUPALCHAT_REL_AUTH && $user->uid == 0 || $user->uid > 0) && $page_match && user_access('access drupalchat');
if (variable_get('drupalchat_polling_method', DRUPALCHAT_AJAX) != DRUPALCHAT_COMMERCIAL) {
$final = $final && _drupalchat_get_sid() != -1;
}
return $final;
}