function _access_unpublished_check_hash in Access unpublished 7
Check whether a hash is present in the current URL, and if so, verify that the hash is correct.
Parameters
int: The node id to check.
Return value
boolean TRUE if the hash is present and correct, otherwise FALSE.
2 calls to _access_unpublished_check_hash()
File
- ./
access_unpublished.module, line 168 - Drupal module: Access unpublished.
Code
function _access_unpublished_check_hash($nid) {
$au_url_key = variable_get('access_unpublished_url_key', 'hash');
// Check hash key in url.
$url_query = drupal_get_query_parameters();
if (isset($url_query[$au_url_key])) {
$url_hash = $url_query[$au_url_key];
// Generate reference hash.
$hash = _access_unpublished_get_hash_from_nodeid($nid);
// Check hash match and return access state.
if ($url_hash == $hash) {
return TRUE;
}
}
}