/** * Post process (never return) * */ private static function abort($validate, $settings, $exist) { $context = IP_Geo_Block::get_instance(); // mark as malicious $validate['result'] = 'blocked'; //'malice'; // (1) blocked, unknown, (3) unauthenticated, (5) all if ((int) $settings['validation']['reclogs'] & 1) { require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-logs.php'; IP_Geo_Block_Logs::record_log('admin', $validate, $settings); } // update statistics if ($settings['save_statistics']) { $context->update_statistics('admin', $validate); } // send response code to refuse $context->send_response('admin', $exist ? $settings['response_code'] : 404); }
/** * Auxiliary validation functions * */ public function auth_fail($something = NULL) { require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-apis.php'; // Count up a number of fails when authentication is failed if ($cache = IP_Geo_Block_API_Cache::get_cache($this->remote_addr)) { $validate = self::make_validation($this->remote_addr, array('code' => $cache['code'], 'fail' => TRUE, 'result' => 'failed')); $settings = self::get_option('settings'); IP_Geo_Block_API_Cache::update_cache($cache['hook'], $validate, $settings); // (1) blocked, (3) unauthenticated, (5) all if ((int) $settings['validation']['reclogs'] & 1) { require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-logs.php'; IP_Geo_Block_Logs::record_log($cache['hook'], $validate, $settings); } } return $something; // pass through }