public function AntiFlood::_die in Anti Spam by CleanTalk 8.4
Same name and namespace in other branches
- 9.1.x src/lib/Cleantalk/Common/Firewall/Modules/AntiFlood.php \Cleantalk\Common\Firewall\Modules\AntiFlood::_die()
Default die page for blocked requests.
Parameters
array $result:
Overrides FirewallModule::_die
File
- src/
lib/ Cleantalk/ Common/ Firewall/ Modules/ AntiFlood.php, line 210
Class
Namespace
Cleantalk\Common\Firewall\ModulesCode
public function _die($result) {
parent::_die($result);
// File exists?
if (file_exists(__DIR__ . '/die_page_antiflood.html')) {
$die_page = file_get_contents(__DIR__ . '/die_page_antiflood.html');
$net_count = $this->db
->fetch('SELECT COUNT(*) as net_count FROM ' . $this->db__table__ac_logs)['net_count'];
// Translation
$replaces = array(
'{SFW_DIE_NOTICE_IP}' => $this
->__('Anti-Flood is activated for your IP', 'cleantalk-spam-protect'),
'{SFW_DIE_MAKE_SURE_JS_ENABLED}' => $this
->__('To continue working with the web site, please make sure that you have enabled JavaScript.', 'cleantalk-spam-protect'),
'{SFW_DIE_YOU_WILL_BE_REDIRECTED}' => sprintf($this
->__('You will be automatically redirected to the requested page after %d seconds.', 'cleantalk-spam-protect'), 30),
'{CLEANTALK_TITLE}' => $this
->__('Antispam by CleanTalk', 'cleantalk-spam-protect'),
'{REMOTE_ADDRESS}' => $result['ip'],
'{REQUEST_URI}' => Server::get('REQUEST_URI'),
'{SERVICE_ID}' => $net_count,
'{HOST}' => '',
'{GENERATED}' => '<p>The page was generated at ' . date('D, d M Y H:i:s') . "</p>",
'{COOKIE_ANTIFLOOD_PASSED}' => md5($result['ip'] . $this->api_key),
'{USE_ALT_COOKIES}' => \Drupal::config('cleantalk.settings')
->get('cleantalk_alternative_cookies_session') ? 1 : 0,
);
foreach ($replaces as $place_holder => $replace) {
$die_page = str_replace($place_holder, $replace, $die_page);
}
die($die_page);
}
die("IP BLACKLISTED. Blocked by AntiFlood " . $result['ip']);
}