EventHandler
[ class tree: EventHandler ] [ index: EventHandler ] [ all elements ]

Source for file IpBlockHandler.php

Documentation is available at IpBlockHandler.php

  1. <?php
  2. /**
  3.  * MVClasses
  4.  *
  5.  * LICENSE
  6.  *
  7.  * "THE BEER-WARE LICENSE" (Revision 42):
  8.  * "Sven Strittmatter" <ausserirdisch@sven-space.de> wrote this file.
  9.  * As long as you retain this notice you can do whatever you want with
  10.  * this stuff. If we meet some day, and you think this stuff is worth it,
  11.  * you can buy me a beer in return.
  12.  *
  13.  * @category    MVClasses
  14.  * @package     EventHandler
  15.  * @copyright   Copyright (c) 2007 Sven Strittmatter
  16.  */
  17.  
  18. /**
  19.  * @see EventHandler
  20.  */
  21. require_once dirname(__FILE__)."/EventHandler.php";
  22. /**
  23.  * @see Registry
  24.  */
  25. require_once dirname(__FILE__)."/../../Registry/Registry.php";
  26.  
  27. /**
  28.  * Enter description here...
  29.  *
  30.  * Longdesc
  31.  *
  32.  * @todo complete description
  33.  *
  34.  * @category    MVClasses
  35.  * @package     EventHandler
  36.  * @uses        Registry
  37.  * @copyright     Copyright (c) 2007 Sven Strittmatter
  38.  * @author    "Sven Strittmatter" <ausserirdisch@sven-space.de>
  39.  * @version     1.0
  40.  * @link        http://www.sven-space.de/code/php/MVClasses
  41.  */
  42. class IpBlockHandler implements EventHandler {
  43.     protected $_ips;
  44.     
  45.     public function __construct($blocked_ips{
  46.         $this->_ips = $blocked_ips;
  47.     }
  48.     
  49.     public function handle(Event $e{
  50.         $request Registry::getInstance()->getRequest();
  51.         
  52.         if (in_array($request->getRemoteAdress$this->_ips)) {
  53.             $e->cancel();
  54.         }
  55.     }
  56. }
  57. ?>

Documentation generated on Sun, 02 Aug 2009 17:15:02 +0200 by phpDocumentor 1.4.2