public function ProtectedPagesSubscriber::protectedPagesIsPageLocked in Protected Pages 8
Returns protected page id.
Parameters
string $current_path: Current path alias.
string $normal_path: Current normal path.
Return value
int The protected page id.
1 call to ProtectedPagesSubscriber::protectedPagesIsPageLocked()
- ProtectedPagesSubscriber::checkProtectedPage in src/
EventSubscriber/ ProtectedPagesSubscriber.php - Redirects user to protected page login screen.
File
- src/
EventSubscriber/ ProtectedPagesSubscriber.php, line 167
Class
- ProtectedPagesSubscriber
- Redirects user to protected page login screen.
Namespace
Drupal\protected_pages\EventSubscriberCode
public function protectedPagesIsPageLocked(string $current_path, string $normal_path) {
$fields = [
'pid',
];
$conditions = [];
$conditions['or'][] = [
'field' => 'path',
'value' => $normal_path,
'operator' => '=',
];
$conditions['or'][] = [
'field' => 'path',
'value' => $current_path,
'operator' => '=',
];
$pid = $this->protectedPagesStorage
->loadProtectedPage($fields, $conditions, TRUE);
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;
}