X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Ffilter%2Fverifier%2Fclass_UserNameVerifierFilter.php;h=f24b0bc422801721966878337d2029e63e6c30e2;hp=a3b12a985d918ab261529d3060d17b3108504296;hb=4b88c118b615335d06bd74e444173d21aef4406c;hpb=c6d73b0e3246efc824cb98338d4be7ee5bc9f308 diff --git a/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php b/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php index a3b12a98..f24b0bc4 100644 --- a/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php @@ -6,7 +6,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -37,16 +37,12 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @param $controllerInstance An instance of a Controller class * @return $filterInstance An instance of this filter class */ - public final static function createUserNameVerifierFilter (Controller $controllerInstance) { + public static final function createUserNameVerifierFilter () { // Get a new instance $filterInstance = new UserNameVerifierFilter(); - // Set the controller - $filterInstance->setControllerInstance($controllerInstance); - // Return the instance return $filterInstance; } @@ -57,6 +53,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { * @param $requestInstance An instance of a class with an Requestable interface * @param $responseInstance An instance of a class with an Responseable interface * @return void + * @throws FilterChainException If this filter fails to operate */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get username from request @@ -71,7 +68,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { $responseInstance->addFatalMessage('username_unset'); // Abort here - return false; + throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($userName)) { // Empty field! $requestInstance->requestIsValid(false); @@ -80,7 +77,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { $responseInstance->addFatalMessage('username_empty'); // Abort here - return false; + throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ($this->ifUserNameIsTaken($userName) === false) { // Username is already taken $requestInstance->requestIsValid(false); @@ -89,7 +86,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { $responseInstance->addFatalMessage('username_not_found'); // Abort here - return false; + throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } } @@ -118,7 +115,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { // If this instance is created then the username *does* exist try { // Get a new instance - $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), 'createMemberByUsername'), array($userName)); + $userInstance = call_user_func_array(array($this->getConfigInstance()->getConfigEntry('user_class'), 'createMemberByUsername'), array($userName)); // Remember this user instance in our registry for later usage $registry->addInstance('user', $userInstance);