public static function Path2ban::destinationCheck in path2ban 7.2
This function compare real path and restricted, and takes action if necessary.
Return value
bool whether path2ban action was taken.
2 calls to Path2ban::destinationCheck()
- path2ban_menu_callback in includes/
menu.inc - This menu_callback arrives from either the 403 or 404 responses, so it doesn't have to check if the path is valid.
- path2ban_page_build in ./
path2ban.module - Implements hook_page_build().
File
- src/
Path2ban.php, line 20 - path2ban core functionality file.
Class
- Path2ban
- @class Path2ban The Path2ban class contains the core functionality to assess and block visitors who violate rules.
Code
public static function destinationCheck() {
// Convert the Drupal path to lowercase.
$destination = '';
if (array_key_exists('destination', $_GET)) {
$destination = drupal_strtolower($_GET['destination']);
}
// Don't accidentally error because of an empty string.
if (empty($destination)) {
return FALSE;
}
// Compare the lowercase paths.
$pages = drupal_strtolower(variable_get('path2ban_list', ''));
$page_match = drupal_match_path($destination, $pages);
if (!$page_match) {
return FALSE;
}
$should_block_user = self::shouldBlockUser();
if (!$should_block_user) {
return FALSE;
}
self::blockUser();
return TRUE;
}