From: Roland Häder Date: Wed, 19 Nov 2008 21:48:25 +0000 (+0000) Subject: A lot rewrites and fixes for weak redirect methods X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=commitdiff_plain;h=df33e264f3246f80756d7e2da55d7f7c40f9088c A lot rewrites and fixes for weak redirect methods - Explicit exit() function added after all redirect calls for weak implementations. But normally we have strong implementations... - All filters, actions and commands now have a BaseFilter|Action|Command class - Invalid 'company' entries removed from non-shipsimu templates - More missing classes and config enttries added (mainly to blog software) - Some other minor improvements/fixes --- diff --git a/.gitattributes b/.gitattributes index b6ece6d..2b2a543 100644 --- a/.gitattributes +++ b/.gitattributes @@ -68,6 +68,8 @@ application/blog/interfaces/.htaccess -text application/blog/loader.php -text application/blog/main/.htaccess -text application/blog/main/actions/.htaccess -text +application/blog/main/actions/class_ -text +application/blog/main/actions/class_BaseBlogAction.php -text application/blog/main/actions/web/.htaccess -text application/blog/main/actions/web/class_WebBlogLoginWelcomeAction.php -text application/blog/main/class_ -text @@ -75,6 +77,16 @@ application/blog/main/commands/.htaccess -text application/blog/main/commands/web/.htaccess -text application/blog/main/commands/web/class_WebBlogGuestLoginCommand.php -text application/blog/main/commands/web/class_WebBlogUserLoginCommand.php -text +application/blog/main/commands/web/failed/.htaccess -text +application/blog/main/commands/web/failed/class_WebBlogFailedCommand.php -text +application/blog/main/controller/.htaccess -text +application/blog/main/controller/web/.htaccess -text +application/blog/main/controller/web/class_WebBlogFailedController.php -text +application/blog/main/filter/.htaccess -text +application/blog/main/filter/blog/.htaccess -text +application/blog/main/filter/blog/class_BlogDataFetchFilter.php -text +application/blog/main/filter/class_ -text +application/blog/main/filter/class_BaseBlogFilter.php -text application/blog/main/login/.htaccess -text application/blog/main/login/class_BlogGuestLogin.php -text application/blog/main/login/class_BlogUserLogin.php -text @@ -171,6 +183,8 @@ application/ship-simu/interfaces/class_TradeableItem.php -text application/ship-simu/loader.php -text application/ship-simu/main/.htaccess -text application/ship-simu/main/actions/.htaccess -text +application/ship-simu/main/actions/class_ -text +application/ship-simu/main/actions/class_BaseShipSimuAction.php -text application/ship-simu/main/actions/ship-simu/.htaccess -text application/ship-simu/main/actions/ship-simu/class_ShipSimuLoginAction.php -text application/ship-simu/main/actions/ship-simu/class_ShipSimuProfileAction.php -text @@ -224,6 +238,8 @@ application/ship-simu/main/drives/motor/class_Motor.php -text application/ship-simu/main/factories/.htaccess -text application/ship-simu/main/factories/class_ShipSimuWebNewsFactory.php -text application/ship-simu/main/filter/.htaccess -text +application/ship-simu/main/filter/class_ -text +application/ship-simu/main/filter/class_BaseShipSimuFilter.php -text application/ship-simu/main/filter/goverment/.htaccess -text application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysStartupHelpFilter.php -text application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysTrainingFilter.php -text diff --git a/application/admin/main/commands/web/class_WebAdminUserLoginCommand.php b/application/admin/main/commands/web/class_WebAdminUserLoginCommand.php index c84d158..03fc485 100644 --- a/application/admin/main/commands/web/class_WebAdminUserLoginCommand.php +++ b/application/admin/main/commands/web/class_WebAdminUserLoginCommand.php @@ -77,7 +77,11 @@ class WebAdminUserLoginCommand extends BaseCommand implements Commandable { if ($loginInstance->ifLoginWasSuccessfull()) { // Try to redirect here try { + // Redirect... $responseInstance->redirectToConfiguredUrl('app_login_url'); + + // Exit here + exit(); } catch (FrameworkException $e) { // Something went wrong here! $responseInstance->addFatalMessage($e->getMessage()); @@ -100,23 +104,23 @@ class WebAdminUserLoginCommand extends BaseCommand implements Commandable { // Which login type do we have? switch ($this->getConfigInstance()->readConfig('login_type')) { case "username": // Login via username - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter', array($controllerInstance))); break; case "email": // Login via email - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter', array($controllerInstance))); break; default: // Wether username or email is set - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter', array($controllerInstance))); break; } // Password verifier filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter', array($controllerInstance))); // Add filter for CAPTCHA - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter', array($controllerInstance))); } } diff --git a/application/blog/config.php b/application/blog/config.php index 10b96ca..5117cb9 100644 --- a/application/blog/config.php +++ b/application/blog/config.php @@ -121,6 +121,9 @@ $cfg->setConfigEntry('confirm_code_invalid_url', "index.php?app={?app_short_name // CFG: USER-NOT-FOUND-URL $cfg->setConfigEntry('user_not_found_url', "index.php?app={?app_short_name?}&page=status&status=user_not_found"); +// CFG: LOGIN-BLOG-FAILED-USER-URL +$cfg->setConfigEntry('login_blog_failed_user_url', "index.php?app={?app_short_name?}&page=blog_failed&failed=user"); + // CFG: LOGIN-DEFAULT-ACTION $cfg->setConfigEntry('login_default_action', "welcome"); @@ -130,6 +133,9 @@ $cfg->setConfigEntry('news_reader_class', "DefaultNewsReader"); // CFG: NEWS-READER-LOGIN-AREA-CLASS $cfg->setConfigEntry('news_reader_login_area_class', "DefaultNewsReader"); +// CFG: NEWS-READER-BLOG-FAILED-CLASS +$cfg->setConfigEntry('news_reader_blog_failed_class', "DefaultNewsReader"); + // CFG: NEWS-DOWNLOAD-FILTER $cfg->setConfigEntry('news_download_filter', "NewsDownloadFilter"); @@ -142,6 +148,9 @@ $cfg->setConfigEntry('user_auth_filter', "UserAuthFilter"); // CFG: USER-UPDATE-FILTER $cfg->setConfigEntry('user_update_filter', "UserUpdateFilter"); +// CFG: BLOG-DATA-FILTER +$cfg->setConfigEntry('blog_data_filter', "BlogDataFetchFilter"); + // CFG: USER-STATUS-CONFIRMED-FILTER $cfg->setConfigEntry('user_status_confirmed_filter', "UserStatusConfimedUpdateFilter"); @@ -166,6 +175,9 @@ $cfg->setConfigEntry('news_home_limit', 10); // CFG: NEWS-LOGIN-AREA-LIMIT $cfg->setConfigEntry('news_login_area_limit', 15); +// CFG: NEWS-BLOG-FAILED-LIMIT +$cfg->setConfigEntry('news_blog_failed_limit', 15); + // CFG: LOGIN-ENABLED $cfg->setConfigEntry('login_enabled', "Y"); diff --git a/application/blog/main/actions/class_ b/application/blog/main/actions/class_ new file mode 100644 index 0000000..726285a --- /dev/null +++ b/application/blog/main/actions/class_ @@ -0,0 +1,82 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ???Action extends BaseBlogAction implements Commandable, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this action + * + * @param $resolverInstance An instance of an action resolver + * @return $actionInstance An instance of this action class + */ + public final static function create???Action (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new ???Action(); + + // Return the instance + return $actionInstance; + } + + /** + * Executes the command with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here + $this->partialStub("You have to implement me."); + } + + /** + * Adds extra filters to the given controller instance + * + * @param $controllerInstance A controller instance + * @param $requestInstance An instance of a class with an Requestable interface + * @return void + * @todo Add some filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Call parent addExtraFilters method + parent::addExtraFilters($controllerInstance, $requestInstance); + + // Unfinished method + } +} + +// [EOF] +?> diff --git a/application/blog/main/actions/class_BaseBlogAction.php b/application/blog/main/actions/class_BaseBlogAction.php new file mode 100644 index 0000000..d0c85bf --- /dev/null +++ b/application/blog/main/actions/class_BaseBlogAction.php @@ -0,0 +1,63 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BaseBlogAction extends BaseAction { + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * Executes the command with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Add code here executed with every action + } + + /** + * Adds extra filters to the given controller instance + * + * @param $controllerInstance A controller instance + * @param $requestInstance An instance of a class with an Requestable interface + * @return void + * @todo Add some filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Fetch some blog data + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('blog_data_filter', array($controllerInstance))); + } +} + +// [EOF] +?> diff --git a/application/blog/main/actions/web/class_WebBlogLoginWelcomeAction.php b/application/blog/main/actions/web/class_WebBlogLoginWelcomeAction.php index 2350912..cf73954 100644 --- a/application/blog/main/actions/web/class_WebBlogLoginWelcomeAction.php +++ b/application/blog/main/actions/web/class_WebBlogLoginWelcomeAction.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebBlogLoginWelcomeAction extends BaseAction implements Commandable, Registerable { +class WebBlogLoginWelcomeAction extends BaseBlogAction implements Commandable, Registerable { /** * Protected constructor * @@ -58,7 +58,10 @@ class WebBlogLoginWelcomeAction extends BaseAction implements Commandable, Regis * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Unfinished method + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Execute some code here } /** @@ -70,6 +73,9 @@ class WebBlogLoginWelcomeAction extends BaseAction implements Commandable, Regis * @todo Add some filters here */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Call parent addExtraFilters method + parent::addExtraFilters($controllerInstance, $requestInstance); + // Unfinished method } } diff --git a/application/blog/main/commands/web/class_WebBlogGuestLoginCommand.php b/application/blog/main/commands/web/class_WebBlogGuestLoginCommand.php index cb6d02c..ef0807f 100644 --- a/application/blog/main/commands/web/class_WebBlogGuestLoginCommand.php +++ b/application/blog/main/commands/web/class_WebBlogGuestLoginCommand.php @@ -77,7 +77,11 @@ class WebBlogGuestLoginCommand extends BaseCommand implements Commandable { if ($loginInstance->ifLoginWasSuccessfull()) { // Try to redirect here try { + // Redirect... $responseInstance->redirectToConfiguredUrl('app_login_url'); + + // Exit here + exit(); } catch (FrameworkException $e) { // Something went wrong here! $responseInstance->addFatalMessage($e->getMessage()); @@ -98,13 +102,13 @@ class WebBlogGuestLoginCommand extends BaseCommand implements Commandable { */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Add username verifier filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_guest_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_guest_verifier_filter', array($controllerInstance))); // Add password verifier filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('passwd_guest_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('passwd_guest_verifier_filter', array($controllerInstance))); // Add CAPTCHA verifier code - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_guest_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_guest_verifier_filter', array($controllerInstance))); } } diff --git a/application/blog/main/commands/web/class_WebBlogUserLoginCommand.php b/application/blog/main/commands/web/class_WebBlogUserLoginCommand.php index d9ccdaf..ad56dd9 100644 --- a/application/blog/main/commands/web/class_WebBlogUserLoginCommand.php +++ b/application/blog/main/commands/web/class_WebBlogUserLoginCommand.php @@ -77,7 +77,11 @@ class WebBlogUserLoginCommand extends BaseCommand implements Commandable { if ($loginInstance->ifLoginWasSuccessfull()) { // Try to redirect here try { + // Redirect... $responseInstance->redirectToConfiguredUrl('app_login_url'); + + // Exit here + exit(); } catch (FrameworkException $e) { // Something went wrong here! $responseInstance->addFatalMessage($e->getMessage()); @@ -100,23 +104,23 @@ class WebBlogUserLoginCommand extends BaseCommand implements Commandable { // Which login type do we have? switch ($this->getConfigInstance()->readConfig('login_type')) { case "username": // Login via username - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter', array($controllerInstance))); break; case "email": // Login via email - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter', array($controllerInstance))); break; default: // Wether username or email is set - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter', array($controllerInstance))); break; } // Password verifier filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter', array($controllerInstance))); // Add filter for CAPTCHA - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter', array($controllerInstance))); } } diff --git a/application/blog/main/commands/web/failed/.htaccess b/application/blog/main/commands/web/failed/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/blog/main/commands/web/failed/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/blog/main/commands/web/failed/class_WebBlogFailedCommand.php b/application/blog/main/commands/web/failed/class_WebBlogFailedCommand.php new file mode 100644 index 0000000..87cfaa8 --- /dev/null +++ b/application/blog/main/commands/web/failed/class_WebBlogFailedCommand.php @@ -0,0 +1,77 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class WebBlogFailedCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $commandInstance An instance a prepared command class + */ + public final static function createWebBlogFailedCommand (CommandResolver $resolverInstance) { + // Get new instance + $commandInstance = new WebBlogFailedCommand(); + + // Set the application instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * Executes the given command with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + $this->partialStub("Unfinished method."); + } + + /** + * Adds extra filters to the given controller instance + * + * @param $controllerInstance A controller instance + * @param $requestInstance An instance of a class with an Requestable interface + * @return void + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Empty for now + } +} + +// [EOF] +?> diff --git a/application/blog/main/controller/.htaccess b/application/blog/main/controller/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/blog/main/controller/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/blog/main/controller/web/.htaccess b/application/blog/main/controller/web/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/blog/main/controller/web/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/blog/main/controller/web/class_WebBlogFailedController.php b/application/blog/main/controller/web/class_WebBlogFailedController.php new file mode 100644 index 0000000..bbd33be --- /dev/null +++ b/application/blog/main/controller/web/class_WebBlogFailedController.php @@ -0,0 +1,106 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class WebBlogFailedController extends BaseController implements Controller { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $controllerInstance A prepared instance of this class + * @todo Add some filters to this controller + */ + public final static function createWebBlogFailedController (CommandResolver $resolverInstance) { + // Create the instance + $controllerInstance = new WebBlogFailedController(); + + // Set the command resolver + $controllerInstance->setResolverInstance($resolverInstance); + + // User auth filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter', array($controllerInstance))); + + // User update filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter', array($controllerInstance))); + + // News fetcher filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter', array($controllerInstance))); + + // News proccess/display-preparation + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter', array($controllerInstance))); + + // Return the prepared instance + return $controllerInstance; + } + + /** + * Handles the given request and response + * + * @param $requestInstance An instance of a request class + * @param $responseInstance An instance of a response class + * @return void + */ + public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Get the command instance from the resolver by sending a request instance to the resolver + $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); + + // Add more filters by the command + $commandInstance->addExtraFilters($this, $requestInstance); + + // Try to run the pre filters, if auth exceptions come through redirect here + try { + // Run the pre filters + $this->executePreFilters($requestInstance, $responseInstance); + } catch (UserAuthorizationException $e) { + // Redirect to main page + $responseInstance->redirectToConfiguredUrl('login_failed_url'); + + // Exit here + exit(); + } + + // This request was valid! :-D + $requestInstance->requestIsValid(); + + // Execute the command + $commandInstance->execute($requestInstance, $responseInstance); + + // Run the pre filters + $this->executePostFilters($requestInstance, $responseInstance); + + // Flush the response out + $responseInstance->flushBuffer(); + } +} + +// [EOF] +?> diff --git a/application/blog/main/filter/.htaccess b/application/blog/main/filter/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/blog/main/filter/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/blog/main/filter/blog/.htaccess b/application/blog/main/filter/blog/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/blog/main/filter/blog/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/blog/main/filter/blog/class_BlogDataFetchFilter.php b/application/blog/main/filter/blog/class_BlogDataFetchFilter.php new file mode 100644 index 0000000..e3cba61 --- /dev/null +++ b/application/blog/main/filter/blog/class_BlogDataFetchFilter.php @@ -0,0 +1,82 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BlogDataFetchFilter extends BaseBlogFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * 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 createBlogDataFetchFilter (Controller $controllerInstance) { + // Get a new instance + $filterInstance = new BlogDataFetchFilter(); + + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo Add code being executed in this filter + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + + // Get a user instance from registry + $userInstance = Registry::getRegistry()->getInstance('user'); + + // Is the user instance valid? + if (!$userInstance instanceof ManageableMember) { + // Request is invalid + $requestInstance->requestIsValid(false); + + // Redirect to configured URL + $responseInstance->redirectToConfiguredUrl('login_blog_failed_user_url'); + + // Stop processing here + exit(); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/blog/main/filter/class_ b/application/blog/main/filter/class_ new file mode 100644 index 0000000..3cf4789 --- /dev/null +++ b/application/blog/main/filter/class_ @@ -0,0 +1,69 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ???Filter extends BaseBlogFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * 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 create???Filter (Controller $controllerInstance) { + // Get a new instance + $filterInstance = new ???Filter(); + + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo Add code being executed in this filter + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + + $this->partialStub("Add code here for your specific filter."); + } +} + +// [EOF] +?> diff --git a/application/blog/main/filter/class_BaseBlogFilter.php b/application/blog/main/filter/class_BaseBlogFilter.php new file mode 100644 index 0000000..e1b430a --- /dev/null +++ b/application/blog/main/filter/class_BaseBlogFilter.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BaseBlogFilter extends BaseFilter { + /** + * Protected constructor + * + * @param $className Name of the filter class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * Executes the filter with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo 0% + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Add something to do on every filter + } +} + +// [EOF] +?> diff --git a/application/blog/templates/de/code/login_main.ctp b/application/blog/templates/de/code/login_main.ctp index abeacc7..03736cd 100644 --- a/application/blog/templates/de/code/login_main.ctp +++ b/application/blog/templates/de/code/login_main.ctp @@ -22,6 +22,15 @@ if ($blockInstance->ifIncludeRegistrationStamp()) { // Flush the content out to a template variable $blockInstance->flushContent(); +// Get a new instance for blog data +$blockInstance = ObjectFactory::createObjectByConfiguredName('web_block_helper', array($this, 'blog_data')); + +// Set the data source instance which must exist in registry +$blockInstance->prefetchValueInstance('blog'); + +// Flush the content out to a template variable +$blockInstance->flushContent(); + // Get helper instance $helper = ObjectFactory::createObjectByConfiguredName('web_link_helper', array($this, 'logout_action_link', 'index.php?app={?app_short_name?}&page=login_area')); @@ -50,6 +59,10 @@ $helper->flushContent(); {?persona_data?} +
+ {?blog_data?} +
+ diff --git a/application/selector/class_ApplicationSelector.php b/application/selector/class_ApplicationSelector.php index 3c4b256..071da88 100644 --- a/application/selector/class_ApplicationSelector.php +++ b/application/selector/class_ApplicationSelector.php @@ -2,9 +2,6 @@ /** * The application selector class. * - * Please remember that this include file is being loaded *before* the class - * loader is loading classes from "exceptions", "interfaces" and "main"! - * * @author Roland Haeder * @version 0.0.0 * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software diff --git a/application/ship-simu/main/actions/class_ b/application/ship-simu/main/actions/class_ new file mode 100644 index 0000000..cc939fb --- /dev/null +++ b/application/ship-simu/main/actions/class_ @@ -0,0 +1,82 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ???Action extends BaseShipSimuAction implements Commandable, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this action + * + * @param $resolverInstance An instance of an action resolver + * @return $actionInstance An instance of this action class + */ + public final static function create???Action (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new ???Action(); + + // Return the instance + return $actionInstance; + } + + /** + * Executes the command with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here + $this->partialStub("You have to implement me."); + } + + /** + * Adds extra filters to the given controller instance + * + * @param $controllerInstance A controller instance + * @param $requestInstance An instance of a class with an Requestable interface + * @return void + * @todo Add some filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Call parent addExtraFilters method + parent::addExtraFilters($controllerInstance, $requestInstance); + + // Unfinished method + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/actions/class_BaseShipSimuAction.php b/application/ship-simu/main/actions/class_BaseShipSimuAction.php new file mode 100644 index 0000000..a92291e --- /dev/null +++ b/application/ship-simu/main/actions/class_BaseShipSimuAction.php @@ -0,0 +1,62 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BaseShipSimuAction extends BaseAction { + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * Executes the command with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Add code here executed with every action + } + + /** + * Adds extra filters to the given controller instance + * + * @param $controllerInstance A controller instance + * @param $requestInstance An instance of a class with an Requestable interface + * @return void + * @todo Add some filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Unfinished method + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/actions/ship-simu/class_ShipSimuLoginAction.php b/application/ship-simu/main/actions/ship-simu/class_ShipSimuLoginAction.php index 26aa0e3..6290fb2 100644 --- a/application/ship-simu/main/actions/ship-simu/class_ShipSimuLoginAction.php +++ b/application/ship-simu/main/actions/ship-simu/class_ShipSimuLoginAction.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class ShipSimuLoginAction extends BaseAction implements PerformableAction { +class ShipSimuLoginAction extends BaseShipSimuAction implements PerformableAction { /** * Protected constructor * @@ -54,6 +54,10 @@ class ShipSimuLoginAction extends BaseAction implements PerformableAction { * @todo Maybe we need to do something later here */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here } } diff --git a/application/ship-simu/main/actions/ship-simu/class_ShipSimuProfileAction.php b/application/ship-simu/main/actions/ship-simu/class_ShipSimuProfileAction.php index d6a5649..f49cf35 100644 --- a/application/ship-simu/main/actions/ship-simu/class_ShipSimuProfileAction.php +++ b/application/ship-simu/main/actions/ship-simu/class_ShipSimuProfileAction.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class ShipSimuProfileAction extends BaseAction implements PerformableAction { +class ShipSimuProfileAction extends BaseShipSimuAction implements PerformableAction { /** * Protected constructor * @@ -54,7 +54,10 @@ class ShipSimuProfileAction extends BaseAction implements PerformableAction { * @todo Maybe we need to do something later here */ */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Empty for now + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... } } diff --git a/application/ship-simu/main/actions/web/class_WebShipSimuLoginCompanyAction.php b/application/ship-simu/main/actions/web/class_WebShipSimuLoginCompanyAction.php index 05fb35c..af4f88c 100644 --- a/application/ship-simu/main/actions/web/class_WebShipSimuLoginCompanyAction.php +++ b/application/ship-simu/main/actions/web/class_WebShipSimuLoginCompanyAction.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebShipSimuLoginCompanyAction extends BaseAction implements Commandable, Registerable { +class WebShipSimuLoginCompanyAction extends BaseShipSimuAction implements Commandable, Registerable { /** * Protected constructor * @@ -58,7 +58,10 @@ class WebShipSimuLoginCompanyAction extends BaseAction implements Commandable, R * @todo Maybe add fetching company list of current user here? */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Unfinished method + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... } /** @@ -71,7 +74,7 @@ class WebShipSimuLoginCompanyAction extends BaseAction implements Commandable, R */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Check for user status by default - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance))); } } diff --git a/application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentStartupHelpAction.php b/application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentStartupHelpAction.php index 5ecc924..283afa4 100644 --- a/application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentStartupHelpAction.php +++ b/application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentStartupHelpAction.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebShipSimuLoginGovermentStartupHelpAction extends BaseAction implements Commandable, Registerable { +class WebShipSimuLoginGovermentStartupHelpAction extends BaseShipSimuAction implements Commandable, Registerable { /** * Protected constructor * @@ -58,7 +58,10 @@ class WebShipSimuLoginGovermentStartupHelpAction extends BaseAction implements C * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Unfinished method + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... } /** @@ -71,10 +74,10 @@ class WebShipSimuLoginGovermentStartupHelpAction extends BaseAction implements C */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Check for user status by default - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance))); // Check if goverment can pay startup help - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('goverment_pays_startup_help_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('goverment_pays_startup_help_filter', array($controllerInstance))); } } diff --git a/application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentTrainingAction.php b/application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentTrainingAction.php index e41c61e..c11ca43 100644 --- a/application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentTrainingAction.php +++ b/application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentTrainingAction.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebShipSimuLoginGovermentTrainingAction extends BaseAction implements Commandable, Registerable { +class WebShipSimuLoginGovermentTrainingAction extends BaseShipSimuAction implements Commandable, Registerable { /** * Protected constructor * @@ -58,7 +58,10 @@ class WebShipSimuLoginGovermentTrainingAction extends BaseAction implements Comm * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Unfinished method + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... } /** @@ -71,10 +74,10 @@ class WebShipSimuLoginGovermentTrainingAction extends BaseAction implements Comm */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Check for user status by default - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance))); // Check if goverment can pay a training - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('goverment_pays_training_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('goverment_pays_training_filter', array($controllerInstance))); } } diff --git a/application/ship-simu/main/actions/web/class_WebShipSimuLoginLogoutAction.php b/application/ship-simu/main/actions/web/class_WebShipSimuLoginLogoutAction.php index 31464c8..3d6d5c3 100644 --- a/application/ship-simu/main/actions/web/class_WebShipSimuLoginLogoutAction.php +++ b/application/ship-simu/main/actions/web/class_WebShipSimuLoginLogoutAction.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebShipSimuLoginLogoutAction extends BaseAction implements Commandable, Registerable { +class WebShipSimuLoginLogoutAction extends BaseShipSimuAction implements Commandable, Registerable { /** * Protected constructor * @@ -58,7 +58,10 @@ class WebShipSimuLoginLogoutAction extends BaseAction implements Commandable, Re * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Unfinished method + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here } /** @@ -70,7 +73,7 @@ class WebShipSimuLoginLogoutAction extends BaseAction implements Commandable, Re */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Check for user status by default - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance))); } } diff --git a/application/ship-simu/main/actions/web/class_WebShipSimuLoginProfileAction.php b/application/ship-simu/main/actions/web/class_WebShipSimuLoginProfileAction.php index 532e47e..774b725 100644 --- a/application/ship-simu/main/actions/web/class_WebShipSimuLoginProfileAction.php +++ b/application/ship-simu/main/actions/web/class_WebShipSimuLoginProfileAction.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebShipSimuLoginProfileAction extends BaseAction implements Commandable, Registerable { +class WebShipSimuLoginProfileAction extends BaseShipSimuAction implements Commandable, Registerable { /** * Protected constructor * @@ -58,7 +58,10 @@ class WebShipSimuLoginProfileAction extends BaseAction implements Commandable, R * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Unfinished method + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... } /** @@ -71,7 +74,7 @@ class WebShipSimuLoginProfileAction extends BaseAction implements Commandable, R */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Check for user status by default - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance))); } } diff --git a/application/ship-simu/main/actions/web/class_WebShipSimuLoginRefillAction.php b/application/ship-simu/main/actions/web/class_WebShipSimuLoginRefillAction.php index 8c4c004..8119b3c 100644 --- a/application/ship-simu/main/actions/web/class_WebShipSimuLoginRefillAction.php +++ b/application/ship-simu/main/actions/web/class_WebShipSimuLoginRefillAction.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebShipSimuLoginRefillAction extends BaseAction implements Commandable, Registerable { +class WebShipSimuLoginRefillAction extends BaseShipSimuAction implements Commandable, Registerable { /** * Protected constructor * @@ -58,7 +58,10 @@ class WebShipSimuLoginRefillAction extends BaseAction implements Commandable, Re * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Unfinished method + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... } /** @@ -70,10 +73,10 @@ class WebShipSimuLoginRefillAction extends BaseAction implements Commandable, Re */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Check for user status by default - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance))); // Is the refill page active? - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_filter', array($controllerInstance))); // Add payment discovery filter $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('payment_discovery_filter', array($this))); diff --git a/application/ship-simu/main/actions/web/class_WebShipSimuLoginWelcomeAction.php b/application/ship-simu/main/actions/web/class_WebShipSimuLoginWelcomeAction.php index 64f60b9..2f778e2 100644 --- a/application/ship-simu/main/actions/web/class_WebShipSimuLoginWelcomeAction.php +++ b/application/ship-simu/main/actions/web/class_WebShipSimuLoginWelcomeAction.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class WebShipSimuLoginWelcomeAction extends BaseAction implements Commandable, Registerable { +class WebShipSimuLoginWelcomeAction extends BaseShipSimuAction implements Commandable, Registerable { /** * Protected constructor * @@ -58,7 +58,10 @@ class WebShipSimuLoginWelcomeAction extends BaseAction implements Commandable, R * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Unfinished method + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... } /** diff --git a/application/ship-simu/main/commands/web/class_WebRefillFormCommand.php b/application/ship-simu/main/commands/web/class_WebRefillFormCommand.php index 5cae379..4717e1e 100644 --- a/application/ship-simu/main/commands/web/class_WebRefillFormCommand.php +++ b/application/ship-simu/main/commands/web/class_WebRefillFormCommand.php @@ -74,22 +74,22 @@ class WebRefillFormCommand extends BaseCommand implements Commandable { */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Add user auth filter (we don't need an update of the user here because it will be redirected) - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter', array($controllerInstance))); // Add user status filter here - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance))); // Is the refill page active? - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_filter', array($controllerInstance))); // Verify password - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter', array($controllerInstance))); // Verify CAPTCHA code - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_filter', array($controllerInstance))); // Verify refill request - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_request_validator_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_request_validator_filter', array($controllerInstance))); // Prepare a filter based on the requested type we shall refill $filterName = sprintf("refill_request_%s_book_filter", $requestInstance->getRequestElement('type')); diff --git a/application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php b/application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php index 4a41fd9..39742f8 100644 --- a/application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php +++ b/application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php @@ -77,7 +77,11 @@ class WebShipsimuGuestLoginCommand extends BaseCommand implements Commandable { if ($loginInstance->ifLoginWasSuccessfull()) { // Try to redirect here try { + // Redirect... $responseInstance->redirectToConfiguredUrl('app_login_url'); + + // Exit here + exit(); } catch (FrameworkException $e) { // Something went wrong here! $responseInstance->addFatalMessage($e->getMessage()); @@ -98,13 +102,13 @@ class WebShipsimuGuestLoginCommand extends BaseCommand implements Commandable { */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Add username verifier filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_guest_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_guest_verifier_filter', array($controllerInstance))); // Add password verifier filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('passwd_guest_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('passwd_guest_verifier_filter', array($controllerInstance))); // Add CAPTCHA verifier code - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_guest_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_guest_verifier_filter', array($controllerInstance))); } } diff --git a/application/ship-simu/main/commands/web/class_WebShipsimuProfileCommand.php b/application/ship-simu/main/commands/web/class_WebShipsimuProfileCommand.php index 3d66614..417cee5 100644 --- a/application/ship-simu/main/commands/web/class_WebShipsimuProfileCommand.php +++ b/application/ship-simu/main/commands/web/class_WebShipsimuProfileCommand.php @@ -122,28 +122,28 @@ class WebShipsimuProfileCommand extends BaseCommand implements Commandable { */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Add user auth filter (we don't need an update of the user here because it will be redirected) - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter', array($controllerInstance))); // User status filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance))); // Updated rules accepted - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter', array($controllerInstance))); // Account password validation - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter', array($controllerInstance))); // Validate CAPTCHA input - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_profile_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_profile_verifier_filter', array($controllerInstance))); // Validate birthday input - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('birthday_profile_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('birthday_profile_verifier_filter', array($controllerInstance))); // Email changed - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_change_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_change_filter', array($controllerInstance))); // Password changed - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_change_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_change_filter', array($controllerInstance))); } } diff --git a/application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php b/application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php index c47c4a6..0f1822b 100644 --- a/application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php +++ b/application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php @@ -95,25 +95,25 @@ class WebShipsimuRegisterCommand extends BaseCommand implements Commandable { */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Validate email address (if configured: check on double email addresses) - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_filter', array($controllerInstance))); // Validate username and check if it does not exist - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_filter', array($controllerInstance))); // Validate if username is "guest" and not taken - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_is_guest_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_is_guest_filter', array($controllerInstance))); // Validate if password is set - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator_filter', array($controllerInstance))); // Check if rules where accepted - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter', array($controllerInstance))); // Validate CAPTCHA input - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_register_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_register_verifier_filter', array($controllerInstance))); // Validate birthday - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('birthday_register_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('birthday_register_verifier_filter', array($controllerInstance))); } } diff --git a/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php b/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php index 51e3bab..ffcc903 100644 --- a/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php +++ b/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php @@ -77,7 +77,11 @@ class WebShipsimuUserLoginCommand extends BaseCommand implements Commandable { if ($loginInstance->ifLoginWasSuccessfull()) { // Try to redirect here try { + // Redirect... $responseInstance->redirectToConfiguredUrl('app_login_url'); + + // Exit here + exit(); } catch (FrameworkException $e) { // Something went wrong here! $responseInstance->addFatalMessage($e->getMessage()); @@ -100,23 +104,23 @@ class WebShipsimuUserLoginCommand extends BaseCommand implements Commandable { // Which login type do we have? switch ($this->getConfigInstance()->readConfig('login_type')) { case "username": // Login via username - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter', array($controllerInstance))); break; case "email": // Login via email - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter', array($controllerInstance))); break; default: // Wether username or email is set - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter', array($controllerInstance))); break; } // Password verifier filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter', array($controllerInstance))); // Add filter for CAPTCHA - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter', array($controllerInstance))); } } diff --git a/application/ship-simu/main/commands/web/goverment/class_WebShipsimuGovermentStartupCommand.php b/application/ship-simu/main/commands/web/goverment/class_WebShipsimuGovermentStartupCommand.php index 18a3bc0..cd203e5 100644 --- a/application/ship-simu/main/commands/web/goverment/class_WebShipsimuGovermentStartupCommand.php +++ b/application/ship-simu/main/commands/web/goverment/class_WebShipsimuGovermentStartupCommand.php @@ -72,19 +72,19 @@ class WebShipsimuGovermentStartupCommand extends BaseCommand implements Commanda */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Add user auth filter (we don't need an update of the user here because it will be redirected) - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter', array($controllerInstance))); // Add user status filter here - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance))); // Check if goverment can pay startup help - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('goverment_pays_startup_help_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('goverment_pays_startup_help_filter', array($controllerInstance))); // Verify password - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter', array($controllerInstance))); // Verify CAPTCHA code - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_filter', array($controllerInstance))); } } diff --git a/application/ship-simu/main/controller/web/class_WebGovermentFailedController.php b/application/ship-simu/main/controller/web/class_WebGovermentFailedController.php index 79fe215..eb5882b 100644 --- a/application/ship-simu/main/controller/web/class_WebGovermentFailedController.php +++ b/application/ship-simu/main/controller/web/class_WebGovermentFailedController.php @@ -47,16 +47,16 @@ class WebGovermentFailedController extends BaseController implements Controller $controllerInstance->setResolverInstance($resolverInstance); // User auth filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter', array($controllerInstance))); // User update filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter', array($controllerInstance))); // News fetcher filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter', array($controllerInstance))); // News proccess/display-preparation - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter', array($controllerInstance))); // Return the prepared instance return $controllerInstance; @@ -83,6 +83,9 @@ class WebGovermentFailedController extends BaseController implements Controller } catch (UserAuthorizationException $e) { // Redirect to main page $responseInstance->redirectToConfiguredUrl('login_failed_url'); + + // Exit here + exit(); } // This request was valid! :-D diff --git a/application/ship-simu/main/filter/class_ b/application/ship-simu/main/filter/class_ new file mode 100644 index 0000000..bb35473 --- /dev/null +++ b/application/ship-simu/main/filter/class_ @@ -0,0 +1,69 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ???Filter extends BaseShipSimuFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * 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 create???Filter (Controller $controllerInstance) { + // Get a new instance + $filterInstance = new ???Filter(); + + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo Add code being executed in this filter + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + + $this->partialStub("Add code here for your specific filter."); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/filter/class_BaseShipSimuFilter.php b/application/ship-simu/main/filter/class_BaseShipSimuFilter.php new file mode 100644 index 0000000..6cc2830 --- /dev/null +++ b/application/ship-simu/main/filter/class_BaseShipSimuFilter.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BaseShipSimuFilter extends BaseFilter { + /** + * Protected constructor + * + * @param $className Name of the filter class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * Executes the filter with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo 0% + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Add something to do on every filter + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysStartupHelpFilter.php b/application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysStartupHelpFilter.php index 6917edc..74ef33d 100644 --- a/application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysStartupHelpFilter.php +++ b/application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysStartupHelpFilter.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class ShipSimuGovermentPaysStartupHelpFilter extends BaseFilter implements Filterable { +3class ShipSimuGovermentPaysStartupHelpFilter extends BaseShipSimuFilter implements Filterable { /** * Protected constructor * @@ -35,12 +35,16 @@ class ShipSimuGovermentPaysStartupHelpFilter extends BaseFilter implements Filte /** * Creates an instance of this filter class * - * @return $filterInstance 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 createShipSimuGovermentPaysStartupHelpFilter () { + public final static function createShipSimuGovermentPaysStartupHelpFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new ShipSimuGovermentPaysStartupHelpFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } @@ -54,6 +58,9 @@ class ShipSimuGovermentPaysStartupHelpFilter extends BaseFilter implements Filte * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + // Get the user instance from registry $userInstance = Registry::getRegistry()->getInstance('user'); diff --git a/application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysTrainingFilter.php b/application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysTrainingFilter.php index b8b8dd8..5b51ae3 100644 --- a/application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysTrainingFilter.php +++ b/application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysTrainingFilter.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class ShipSimuGovermentPaysTrainingFilter extends BaseFilter implements Filterable { +class ShipSimuGovermentPaysTrainingFilter extends BaseShipSimuFilter implements Filterable { /** * Protected constructor * @@ -35,12 +35,16 @@ class ShipSimuGovermentPaysTrainingFilter extends BaseFilter implements Filterab /** * Creates an instance of this filter class * - * @return $filterInstance 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 createShipSimuGovermentPaysTrainingFilter () { + public final static function createShipSimuGovermentPaysTrainingFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new ShipSimuGovermentPaysTrainingFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } @@ -54,6 +58,9 @@ class ShipSimuGovermentPaysTrainingFilter extends BaseFilter implements Filterab * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + // Get the user instance from registry $userInstance = Registry::getRegistry()->getInstance('user'); diff --git a/application/ship-simu/main/filter/page/class_RefillPageFilter.php b/application/ship-simu/main/filter/page/class_RefillPageFilter.php index c87f21e..d33661e 100644 --- a/application/ship-simu/main/filter/page/class_RefillPageFilter.php +++ b/application/ship-simu/main/filter/page/class_RefillPageFilter.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class RefillPageFilter extends BaseFilter implements Filterable { +class RefillPageFilter extends BaseShipSimuFilter implements Filterable { /** * Protected constructor * @@ -35,12 +35,16 @@ class RefillPageFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createRefillPageFilter () { + public final static function createRefillPageFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new RefillPageFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } @@ -53,6 +57,9 @@ class RefillPageFilter extends BaseFilter implements Filterable { * @return void */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + // Is the configuration variable set? if ($this->getConfigInstance()->readConfig('refill_page_active') === "N") { // Password is empty diff --git a/application/ship-simu/main/filter/validator/class_RefillRequestValidatorFilter.php b/application/ship-simu/main/filter/validator/class_RefillRequestValidatorFilter.php index c33f5e2..71e9b2d 100644 --- a/application/ship-simu/main/filter/validator/class_RefillRequestValidatorFilter.php +++ b/application/ship-simu/main/filter/validator/class_RefillRequestValidatorFilter.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class RefillRequestValidatorFilter extends BaseFilter implements Filterable { +class RefillRequestValidatorFilter extends BaseShipSimuFilter implements Filterable { /** * Protected constructor * @@ -35,12 +35,16 @@ class RefillRequestValidatorFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createRefillRequestValidatorFilter () { + public final static function createRefillRequestValidatorFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new RefillRequestValidatorFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } @@ -54,6 +58,9 @@ class RefillRequestValidatorFilter extends BaseFilter implements Filterable { * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + // Are all required request fields set? if (($requestInstance->isRequestElementSet('type') === false) || ($requestInstance->isRequestElementSet('amount') === false)) { // Something important is missing diff --git a/application/ship-simu/main/filter/verifier/class_BirthdayVerifierFilter.php b/application/ship-simu/main/filter/verifier/class_BirthdayVerifierFilter.php index cc15989..240b9a6 100644 --- a/application/ship-simu/main/filter/verifier/class_BirthdayVerifierFilter.php +++ b/application/ship-simu/main/filter/verifier/class_BirthdayVerifierFilter.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class BirthdayVerifierFilter extends BaseFilter implements Filterable { +class BirthdayVerifierFilter extends BaseShipSimuFilter implements Filterable { /** * Protected constructor * @@ -35,12 +35,16 @@ class BirthdayVerifierFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createBirthdayVerifierFilter () { + public final static function createBirthdayVerifierFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new BirthdayVerifierFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } @@ -54,6 +58,9 @@ class BirthdayVerifierFilter extends BaseFilter implements Filterable { * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + // Implement this! $this->partialStub("Please implement this method."); } diff --git a/application/shoutbox/templates/de/code/login_main.ctp b/application/shoutbox/templates/de/code/login_main.ctp index e9e25d9..abeacc7 100644 --- a/application/shoutbox/templates/de/code/login_main.ctp +++ b/application/shoutbox/templates/de/code/login_main.ctp @@ -22,46 +22,6 @@ if ($blockInstance->ifIncludeRegistrationStamp()) { // Flush the content out to a template variable $blockInstance->flushContent(); -////////////////////////////////////// -// Assign the shipping company data // -////////////////////////////////////// - -// Get a new instance for personal data -$blockInstance = ObjectFactory::createObjectByConfiguredName('web_block_helper', array($this, 'company_data')); - -// Set the data source instance -$blockInstance->prefetchValueInstance('company', 'user'); - -// Assign the company name -if ($blockInstance->getValueInstance()->ifUserIsFounder()) { - // User is the founder of the company - $blockInstance->assignMessageField('company_status', "user_is_company_founder"); - $blockInstance->assignLinkFieldWithAction('company_link' , "company_overview"); - $blockInstance->assignMessageField('company_link_text', "link_text_company_overview"); - $blockInstance->assignMessageField('company_link_title', "link_title_company_overview"); -} elseif ($blockInstance->getValueInstance()->ifUserIsOwner()) { - // User owns the company - $blockInstance->assignMessageField('company_status', "user_is_company_owner"); - $blockInstance->assignLinkFieldWithAction('company_link' , "company_overview"); - $blockInstance->assignMessageField('company_link_text', "link_text_company_overview"); - $blockInstance->assignMessageField('company_link_title', "link_title_company_overview"); -} elseif ($blockInstance->getValueInstance()->ifUserIsEmployee()) { - // User is employed in company - $blockInstance->assignMessageField('company_status', "user_is_employed_in_company"); - $blockInstance->assignLinkFieldWithAction('company_link' , "employee_overview"); - $blockInstance->assignMessageField('company_link_text', "link_text_employee_overview"); - $blockInstance->assignMessageField('company_link_title', "link_title_employee_overview"); -} else { - // No company participation! - $blockInstance->assignMessageField('company_status', "user_not_assigned_company"); - $blockInstance->assignLinkFieldWithAction('company_link' , "company"); - $blockInstance->assignMessageField('company_link_text', "link_text_company"); - $blockInstance->assignMessageField('company_link_title', "link_title_company"); -} - -// Flush the content out to a template variable -$blockInstance->flushContent(); - // Get helper instance $helper = ObjectFactory::createObjectByConfiguredName('web_link_helper', array($this, 'logout_action_link', 'index.php?app={?app_short_name?}&page=login_area')); diff --git a/application/todo/templates/de/code/login_main.ctp b/application/todo/templates/de/code/login_main.ctp index e9e25d9..abeacc7 100644 --- a/application/todo/templates/de/code/login_main.ctp +++ b/application/todo/templates/de/code/login_main.ctp @@ -22,46 +22,6 @@ if ($blockInstance->ifIncludeRegistrationStamp()) { // Flush the content out to a template variable $blockInstance->flushContent(); -////////////////////////////////////// -// Assign the shipping company data // -////////////////////////////////////// - -// Get a new instance for personal data -$blockInstance = ObjectFactory::createObjectByConfiguredName('web_block_helper', array($this, 'company_data')); - -// Set the data source instance -$blockInstance->prefetchValueInstance('company', 'user'); - -// Assign the company name -if ($blockInstance->getValueInstance()->ifUserIsFounder()) { - // User is the founder of the company - $blockInstance->assignMessageField('company_status', "user_is_company_founder"); - $blockInstance->assignLinkFieldWithAction('company_link' , "company_overview"); - $blockInstance->assignMessageField('company_link_text', "link_text_company_overview"); - $blockInstance->assignMessageField('company_link_title', "link_title_company_overview"); -} elseif ($blockInstance->getValueInstance()->ifUserIsOwner()) { - // User owns the company - $blockInstance->assignMessageField('company_status', "user_is_company_owner"); - $blockInstance->assignLinkFieldWithAction('company_link' , "company_overview"); - $blockInstance->assignMessageField('company_link_text', "link_text_company_overview"); - $blockInstance->assignMessageField('company_link_title', "link_title_company_overview"); -} elseif ($blockInstance->getValueInstance()->ifUserIsEmployee()) { - // User is employed in company - $blockInstance->assignMessageField('company_status', "user_is_employed_in_company"); - $blockInstance->assignLinkFieldWithAction('company_link' , "employee_overview"); - $blockInstance->assignMessageField('company_link_text', "link_text_employee_overview"); - $blockInstance->assignMessageField('company_link_title', "link_title_employee_overview"); -} else { - // No company participation! - $blockInstance->assignMessageField('company_status', "user_not_assigned_company"); - $blockInstance->assignLinkFieldWithAction('company_link' , "company"); - $blockInstance->assignMessageField('company_link_text', "link_text_company"); - $blockInstance->assignMessageField('company_link_title', "link_title_company"); -} - -// Flush the content out to a template variable -$blockInstance->flushContent(); - // Get helper instance $helper = ObjectFactory::createObjectByConfiguredName('web_link_helper', array($this, 'logout_action_link', 'index.php?app={?app_short_name?}&page=login_area')); diff --git a/inc/classes/exceptions/class_FrameworkException.php b/inc/classes/exceptions/class_FrameworkException.php index 31a7ba6..c3a2c1a 100644 --- a/inc/classes/exceptions/class_FrameworkException.php +++ b/inc/classes/exceptions/class_FrameworkException.php @@ -59,7 +59,7 @@ abstract class FrameworkException extends ReflectionException { ); // End here - exit; + exit(); } // END - if // Make sure everything is assigned properly parent::__construct($message, $code); diff --git a/inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php b/inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php index 068090e..15fd499 100644 --- a/inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php +++ b/inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php @@ -63,7 +63,11 @@ class LoginAfterRegistrationAction extends BaseAction implements PerformableActi if ($loginInstance->ifLoginWasSuccessfull()) { // Try to redirect here try { + // Redirect... $responseInstance->redirectToConfiguredUrl('app_login_url'); + + // Stop here + exit(); } catch (FrameworkException $e) { // Something went wrong here! $responseInstance->addFatalMessage($e->getMessage()); diff --git a/inc/classes/main/actions/web/class_WebLoginProfileAction.php b/inc/classes/main/actions/web/class_WebLoginProfileAction.php index a7de7e8..0999886 100644 --- a/inc/classes/main/actions/web/class_WebLoginProfileAction.php +++ b/inc/classes/main/actions/web/class_WebLoginProfileAction.php @@ -69,7 +69,7 @@ class WebLoginProfileAction extends BaseAction implements Commandable, Registera */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Add user status filter here - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance))); } } diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 0c490f1..d4eabd7 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -78,6 +78,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ private $userInstance = null; + /** + * A controller instance + */ + private $controllerInstance = null; + /** * The real class name */ @@ -829,7 +834,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { print("
\n");
 		debug_print_backtrace();
 		print("
"); - exit; + exit(); } /** @@ -1047,6 +1052,25 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { public final function getUserInstance () { return $this->userInstance; } + + /** + * Setter for controller instance (this surely breaks a bit the MVC patterm) + * + * @param $controllerInstance An instance of the controller + * @return void + */ + public final function setControllerInstance (Controller $controllerInstance) { + $this->controllerInstance = $controllerInstance; + } + + /** + * Getter for controller instance (this surely breaks a bit the MVC patterm) + * + * @return $controllerInstance An instance of the controller + */ + public final function getControllerInstance () { + return $this->controllerInstance; + } } // [EOF] diff --git a/inc/classes/main/commands/web/class_WebLogoutCommand.php b/inc/classes/main/commands/web/class_WebLogoutCommand.php index e220c51..91a9d51 100644 --- a/inc/classes/main/commands/web/class_WebLogoutCommand.php +++ b/inc/classes/main/commands/web/class_WebLogoutCommand.php @@ -68,6 +68,9 @@ class WebLogoutCommand extends BaseCommand implements Commandable { // Redirect to "logout done" page $responseInstance->redirectToConfiguredUrl('logout_done_url'); + + // Exit here + exit(); } /** diff --git a/inc/classes/main/commands/web/class_WebResendLinkCommand.php b/inc/classes/main/commands/web/class_WebResendLinkCommand.php index 596bf89..c66a39b 100644 --- a/inc/classes/main/commands/web/class_WebResendLinkCommand.php +++ b/inc/classes/main/commands/web/class_WebResendLinkCommand.php @@ -134,7 +134,7 @@ class WebResendLinkCommand extends BaseCommand implements Commandable { */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Filter for checking if account is unconfirmed - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_filter', array($controllerInstance))); } } diff --git a/inc/classes/main/controller/captcha/class_ImageCodeCaptchaController.php b/inc/classes/main/controller/captcha/class_ImageCodeCaptchaController.php index a671745..64e1a1a 100644 --- a/inc/classes/main/controller/captcha/class_ImageCodeCaptchaController.php +++ b/inc/classes/main/controller/captcha/class_ImageCodeCaptchaController.php @@ -46,7 +46,7 @@ class ImageCodeCaptchaController extends BaseController implements Controller { $controllerInstance->setResolverInstance($resolverInstance); // Add filter for checking the "encrypt" string - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_encrypt_validator_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_encrypt_validator_filter', array($controllerInstance))); // Return the prepared instance return $controllerInstance; diff --git a/inc/classes/main/controller/form/class_WebDoFormController.php b/inc/classes/main/controller/form/class_WebDoFormController.php index 021057b..8691c3d 100644 --- a/inc/classes/main/controller/form/class_WebDoFormController.php +++ b/inc/classes/main/controller/form/class_WebDoFormController.php @@ -76,6 +76,9 @@ class WebDoFormController extends BaseController implements Controller { } catch (UserAuthorizationException $e) { // Redirect to main page $responseInstance->redirectToConfiguredUrl('login_failed_url'); + + // Exit here + exit(); } // Is the request still valid? Post filters shall only be executed of diff --git a/inc/classes/main/controller/login/class_WebLoginAreaController.php b/inc/classes/main/controller/login/class_WebLoginAreaController.php index 67b388a..0ad97f0 100644 --- a/inc/classes/main/controller/login/class_WebLoginAreaController.php +++ b/inc/classes/main/controller/login/class_WebLoginAreaController.php @@ -47,16 +47,16 @@ class WebLoginAreaController extends BaseController implements Controller { $controllerInstance->setResolverInstance($resolverInstance); // User auth filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter', array($controllerInstance))); // User update filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter', array($controllerInstance))); // News fetcher filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter', array($controllerInstance))); // News proccess/display-preparation - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter', array($controllerInstance))); // Return the prepared instance return $controllerInstance; @@ -83,6 +83,9 @@ class WebLoginAreaController extends BaseController implements Controller { } catch (UserAuthorizationException $e) { // Redirect to main page $responseInstance->redirectToConfiguredUrl('login_failed_url'); + + // Exit here + exit(); } // This request was valid! :-D diff --git a/inc/classes/main/controller/web/class_WebConfirmController.php b/inc/classes/main/controller/web/class_WebConfirmController.php index 411c59b..ebdd150 100644 --- a/inc/classes/main/controller/web/class_WebConfirmController.php +++ b/inc/classes/main/controller/web/class_WebConfirmController.php @@ -47,10 +47,10 @@ class WebConfirmController extends BaseController implements Controller { $controllerInstance->setResolverInstance($resolverInstance); // Add filters for handling confirmation code and username - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter')); - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_filter')); - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('confirm_code_verifier_filter')); - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_confirmed_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter', array($controllerInstance))); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_filter', array($controllerInstance))); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('confirm_code_verifier_filter', array($controllerInstance))); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_confirmed_filter', array($controllerInstance))); // Return the prepared instance return $controllerInstance; diff --git a/inc/classes/main/controller/web/class_WebDefaultNewsController.php b/inc/classes/main/controller/web/class_WebDefaultNewsController.php index d5769e9..8d7255d 100644 --- a/inc/classes/main/controller/web/class_WebDefaultNewsController.php +++ b/inc/classes/main/controller/web/class_WebDefaultNewsController.php @@ -46,8 +46,8 @@ class WebDefaultNewsController extends BaseController implements Controller { $controllerInstance->setResolverInstance($resolverInstance); // Add news filters to this controller - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter')); - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter', array($controllerInstance))); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter', array($controllerInstance))); // Return the prepared instance return $controllerInstance; diff --git a/inc/classes/main/controller/web/class_WebLogoutController.php b/inc/classes/main/controller/web/class_WebLogoutController.php index 7d8a9ae..258d199 100644 --- a/inc/classes/main/controller/web/class_WebLogoutController.php +++ b/inc/classes/main/controller/web/class_WebLogoutController.php @@ -47,10 +47,10 @@ class WebLogoutController extends BaseController implements Controller { $controllerInstance->setResolverInstance($resolverInstance); // Add user auth filter (we don't need an update of the user here because it will be redirected) - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter', array($controllerInstance))); // User status filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance))); // Return the prepared instance return $controllerInstance; diff --git a/inc/classes/main/filter/auth/class_UserAuthFilter.php b/inc/classes/main/filter/auth/class_UserAuthFilter.php index b08d0c2..c2b0ac4 100644 --- a/inc/classes/main/filter/auth/class_UserAuthFilter.php +++ b/inc/classes/main/filter/auth/class_UserAuthFilter.php @@ -43,12 +43,16 @@ class UserAuthFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createUserAuthFilter () { + public final static function createUserAuthFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new UserAuthFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Set default auth method $filterInstance->setDefaultAuthMethod(); diff --git a/inc/classes/main/filter/change/class_EmailChangeFilter.php b/inc/classes/main/filter/change/class_EmailChangeFilter.php index 276119c..bc481dd 100644 --- a/inc/classes/main/filter/change/class_EmailChangeFilter.php +++ b/inc/classes/main/filter/change/class_EmailChangeFilter.php @@ -35,12 +35,16 @@ class EmailChangeFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createEmailChangeFilter () { + public final static function createEmailChangeFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new EmailChangeFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/change/class_PasswordChangeFilter.php b/inc/classes/main/filter/change/class_PasswordChangeFilter.php index d1da065..e7b8b50 100644 --- a/inc/classes/main/filter/change/class_PasswordChangeFilter.php +++ b/inc/classes/main/filter/change/class_PasswordChangeFilter.php @@ -35,12 +35,16 @@ class PasswordChangeFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createPasswordChangeFilter () { + public final static function createPasswordChangeFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new PasswordChangeFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php b/inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php index 85e945e..03b769a 100644 --- a/inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php +++ b/inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php @@ -37,12 +37,16 @@ class RulesAcceptedFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createRulesAcceptedFilter () { + public final static function createRulesAcceptedFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new RulesAcceptedFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/class_ b/inc/classes/main/filter/class_ index c249762..bd14a20 100644 --- a/inc/classes/main/filter/class_ +++ b/inc/classes/main/filter/class_ @@ -35,12 +35,16 @@ class ???Filter extends BaseFrameworkSystem implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 create???Filter () { + public final static function create???Filter (Controller $controllerInstance) { // Get a new instance $filterInstance = new ???Filter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/crypto/class_CaptchaEncryptFilter.php b/inc/classes/main/filter/crypto/class_CaptchaEncryptFilter.php index 6abe368..3a20eb2 100644 --- a/inc/classes/main/filter/crypto/class_CaptchaEncryptFilter.php +++ b/inc/classes/main/filter/crypto/class_CaptchaEncryptFilter.php @@ -35,12 +35,16 @@ class CaptchaEncryptFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createCaptchaEncryptFilter () { + public final static function createCaptchaEncryptFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new CaptchaEncryptFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/guest/class_UserNameIsGuestFilter.php b/inc/classes/main/filter/guest/class_UserNameIsGuestFilter.php index e40f1e3..20155ac 100644 --- a/inc/classes/main/filter/guest/class_UserNameIsGuestFilter.php +++ b/inc/classes/main/filter/guest/class_UserNameIsGuestFilter.php @@ -36,12 +36,16 @@ class UserNameIsGuestFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createUserNameIsGuestFilter () { + public final static function createUserNameIsGuestFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new UserNameIsGuestFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/news/class_NewsDownloadFilter.php b/inc/classes/main/filter/news/class_NewsDownloadFilter.php index 1b57940..8799398 100644 --- a/inc/classes/main/filter/news/class_NewsDownloadFilter.php +++ b/inc/classes/main/filter/news/class_NewsDownloadFilter.php @@ -37,12 +37,16 @@ class NewsDownloadFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createNewsDownloadFilter () { + public final static function createNewsDownloadFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new NewsDownloadFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/news/class_NewsProcessFilter.php b/inc/classes/main/filter/news/class_NewsProcessFilter.php index 76ebf3d..5ecb096 100644 --- a/inc/classes/main/filter/news/class_NewsProcessFilter.php +++ b/inc/classes/main/filter/news/class_NewsProcessFilter.php @@ -36,12 +36,16 @@ class NewsProcessFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createNewsProcessFilter () { + public final static function createNewsProcessFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new NewsProcessFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/null/class_NullFilter.php b/inc/classes/main/filter/null/class_NullFilter.php index 9b145ba..3dd8382 100644 --- a/inc/classes/main/filter/null/class_NullFilter.php +++ b/inc/classes/main/filter/null/class_NullFilter.php @@ -36,12 +36,16 @@ class NullFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createNullFilter () { + public final static function createNullFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new NullFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/update/class_UserStatusConfimedUpdateFilter.php b/inc/classes/main/filter/update/class_UserStatusConfimedUpdateFilter.php index b9ac082..a7e409b 100644 --- a/inc/classes/main/filter/update/class_UserStatusConfimedUpdateFilter.php +++ b/inc/classes/main/filter/update/class_UserStatusConfimedUpdateFilter.php @@ -35,12 +35,16 @@ class UserStatusConfimedUpdateFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createUserStatusConfimedUpdateFilter () { + public final static function createUserStatusConfimedUpdateFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new UserStatusConfimedUpdateFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/update/class_UserUpdateFilter.php b/inc/classes/main/filter/update/class_UserUpdateFilter.php index c55989c..69c62d8 100644 --- a/inc/classes/main/filter/update/class_UserUpdateFilter.php +++ b/inc/classes/main/filter/update/class_UserUpdateFilter.php @@ -36,12 +36,16 @@ class UserUpdateFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createUserUpdateFilter () { + public final static function createUserUpdateFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new UserUpdateFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/validator/class_EmailValidatorFilter.php b/inc/classes/main/filter/validator/class_EmailValidatorFilter.php index 819ec89..6183b33 100644 --- a/inc/classes/main/filter/validator/class_EmailValidatorFilter.php +++ b/inc/classes/main/filter/validator/class_EmailValidatorFilter.php @@ -38,12 +38,16 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createEmailValidatorFilter () { + public final static function createEmailValidatorFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new EmailValidatorFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/validator/class_PasswordValidatorFilter.php b/inc/classes/main/filter/validator/class_PasswordValidatorFilter.php index 8944f35..2591f1e 100644 --- a/inc/classes/main/filter/validator/class_PasswordValidatorFilter.php +++ b/inc/classes/main/filter/validator/class_PasswordValidatorFilter.php @@ -36,12 +36,16 @@ class PasswordValidatorFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createPasswordValidatorFilter () { + public final static function createPasswordValidatorFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new PasswordValidatorFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php b/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php index 534823b..8d0445f 100644 --- a/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php +++ b/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php @@ -37,12 +37,16 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createUserNameValidatorFilter () { + public final static function createUserNameValidatorFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new UserNameValidatorFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php b/inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php index 5ea625d..44fdcfc 100644 --- a/inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php @@ -36,12 +36,16 @@ class AccountPasswordVerifierFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createAccountPasswordVerifierFilter () { + public final static function createAccountPasswordVerifierFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new AccountPasswordVerifierFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/verifier/class_ConfirmCodeVerifierFilter.php b/inc/classes/main/filter/verifier/class_ConfirmCodeVerifierFilter.php index eb6ca97..09a13d0 100644 --- a/inc/classes/main/filter/verifier/class_ConfirmCodeVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_ConfirmCodeVerifierFilter.php @@ -35,12 +35,16 @@ class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createConfirmCodeVerifierFilter () { + public final static function createConfirmCodeVerifierFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new ConfirmCodeVerifierFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } @@ -99,7 +103,7 @@ class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable { $responseInstance->redirectToConfiguredUrl('confirm_code_invalid_url'); // Stop processing here - exit; + exit(); } // END - if } } diff --git a/inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php b/inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php index 8bb65a4..27fe8a3 100644 --- a/inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php @@ -35,12 +35,16 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl /** * Creates an instance of this filter class * - * @return $filterInstance 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 createGraphicalCodeCaptchaVerifierFilter () { + public final static function createGraphicalCodeCaptchaVerifierFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new GraphicalCodeCaptchaVerifierFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/verifier/class_PasswordGuestVerifierFilter.php b/inc/classes/main/filter/verifier/class_PasswordGuestVerifierFilter.php index f2a1520..abe338d 100644 --- a/inc/classes/main/filter/verifier/class_PasswordGuestVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_PasswordGuestVerifierFilter.php @@ -36,12 +36,16 @@ class PasswordGuestVerifierFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createPasswordGuestVerifierFilter () { + public final static function createPasswordGuestVerifierFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new PasswordGuestVerifierFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/verifier/class_PasswordVerifierFilter.php b/inc/classes/main/filter/verifier/class_PasswordVerifierFilter.php index 0bd5cce..cea7d21 100644 --- a/inc/classes/main/filter/verifier/class_PasswordVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_PasswordVerifierFilter.php @@ -36,12 +36,16 @@ class PasswordVerifierFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createPasswordVerifierFilter () { + public final static function createPasswordVerifierFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new PasswordVerifierFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php b/inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php index 4506a28..8e2b952 100644 --- a/inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php @@ -37,12 +37,16 @@ class UserGuestVerifierFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createUserGuestVerifierFilter () { + public final static function createUserGuestVerifierFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new UserGuestVerifierFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php b/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php index b61db66..a3b12a9 100644 --- a/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php @@ -37,12 +37,16 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 () { + public final static function createUserNameVerifierFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new UserNameVerifierFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/verifier/class_UserStatusVerifierFilter.php b/inc/classes/main/filter/verifier/class_UserStatusVerifierFilter.php index 6722d52..a058aa0 100644 --- a/inc/classes/main/filter/verifier/class_UserStatusVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_UserStatusVerifierFilter.php @@ -35,12 +35,16 @@ class UserStatusVerifierFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createUserStatusVerifierFilter () { + public final static function createUserStatusVerifierFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new UserStatusVerifierFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/filter/verifier/class_UserUnconfirmedVerifierFilter.php b/inc/classes/main/filter/verifier/class_UserUnconfirmedVerifierFilter.php index f2982ed..0845c85 100644 --- a/inc/classes/main/filter/verifier/class_UserUnconfirmedVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_UserUnconfirmedVerifierFilter.php @@ -35,12 +35,16 @@ class UserUnconfirmedVerifierFilter extends BaseFilter implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance 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 createUserUnconfirmedVerifierFilter () { + public final static function createUserUnconfirmedVerifierFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new UserUnconfirmedVerifierFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } diff --git a/inc/classes/main/resolver/command/class_BaseCommandResolver.php b/inc/classes/main/resolver/command/class_BaseCommandResolver.php index 465ee5c..4900c61 100644 --- a/inc/classes/main/resolver/command/class_BaseCommandResolver.php +++ b/inc/classes/main/resolver/command/class_BaseCommandResolver.php @@ -32,11 +32,6 @@ class BaseCommandResolver extends BaseResolver { */ private $commandName = ""; - /** - * A controller instance - */ - private $controllerInstance = null; - /** * Protected constructor * @@ -77,25 +72,6 @@ class BaseCommandResolver extends BaseResolver { return $this->commandName; } - /** - * Setter for controller instance (this surely breaks a bit the MVC patterm) - * - * @param $controllerInstance An instance of the controller - * @return void - */ - public final function setControllerInstance (Controller $controllerInstance) { - $this->controllerInstance = $controllerInstance; - } - - /** - * Getter for controller instance (this surely breaks a bit the MVC patterm) - * - * @return $controllerInstance An instance of the controller - */ - public final function getControllerInstance () { - return $this->controllerInstance; - } - /** * Checks wether the given command is valid *