function protected_pages_is_page_locked in Protected Pages 7
Same name and namespace in other branches
- 7.2 protected_pages.module \protected_pages_is_page_locked()
Helper function to check whether the path is protected or not.
1 call to protected_pages_is_page_locked()
- protected_pages_init in ./
protected_pages.module - Implements hook_init().
File
- ./
protected_pages.module, line 134 - This module allows you to protect any page of your website by secure password. You can enter urls of pages to protect and set password per page. Admin (uid = 1) or user with bypass protection permission can view page.
Code
function protected_pages_is_page_locked($current_path, $normal_path) {
$pid = db_select('protected_pages')
->fields('protected_pages', array(
'pid',
))
->condition(db_or()
->condition('path', $current_path)
->condition('path', $normal_path))
->range(0, 1)
->execute()
->fetchField();
if (isset($_SESSION['_protected_page']['passwords'][$pid]['expire_time'])) {
if (time() >= $_SESSION['_protected_page']['passwords'][$pid]['expire_time']) {
unset($_SESSION['_protected_page']['passwords'][$pid]['request_time']);
unset($_SESSION['_protected_page']['passwords'][$pid]['expire_time']);
}
}
if (isset($_SESSION['_protected_page']['passwords'][$pid]['request_time'])) {
return FALSE;
}
return $pid;
}