From: Roland Häder Date: Fri, 6 Jun 2008 21:38:03 +0000 (+0000) Subject: Registration class added with stubs X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=36dfbfe39c864c7a426573df03c8ab59ff968737;p=shipsimu.git Registration class added with stubs --- diff --git a/.gitattributes b/.gitattributes index a5d64e9..3f3f717 100644 --- a/.gitattributes +++ b/.gitattributes @@ -90,6 +90,8 @@ application/ship-simu/main/personell/.htaccess -text application/ship-simu/main/personell/class_SimulatorPersonell.php -text application/ship-simu/main/personell/company/.htaccess -text application/ship-simu/main/personell/company/class_CompanyEmployee.php -text +application/ship-simu/main/registration/.htaccess -text +application/ship-simu/main/registration/class_ShipSimuRegistration.php -text application/ship-simu/main/ships/.htaccess -text application/ship-simu/main/ships/class_BaseShip.php -text application/ship-simu/main/ships/passenger/.htaccess -text @@ -256,6 +258,8 @@ inc/classes/interfaces/io/output/.htaccess -text inc/classes/interfaces/io/output/class_OutputStreamer.php -text inc/classes/interfaces/language/.htaccess -text inc/classes/interfaces/language/class_ManageableLanguage.php -text +inc/classes/interfaces/registration/.htaccess -text +inc/classes/interfaces/registration/class_UserRegister.php -text inc/classes/interfaces/registry/.htaccess -text inc/classes/interfaces/registry/class_Register.php -text inc/classes/interfaces/registry/class_Registerable.php -text @@ -351,6 +355,8 @@ inc/classes/main/language/class_LanguageSystem.php -text inc/classes/main/output/.htaccess -text inc/classes/main/output/class_ConsoleOutput.php -text inc/classes/main/output/class_WebOutput.php -text +inc/classes/main/registration/.htaccess -text +inc/classes/main/registration/class_BaseRegistration.php -text inc/classes/main/registry/.htaccess -text inc/classes/main/registry/class_Registry.php -text inc/classes/main/request/.htaccess -text diff --git a/application/selector/templates/de/code/selector_main.ctp b/application/selector/templates/de/code/selector_main.ctp index c18c4a9..d1e9c22 100644 --- a/application/selector/templates/de/code/selector_main.ctp +++ b/application/selector/templates/de/code/selector_main.ctp @@ -3,7 +3,7 @@ {?navigation?}
-{app_selector_header} +{?app_selector_header?}
@@ -11,7 +11,7 @@
{?footer?} diff --git a/application/ship-simu/config.php b/application/ship-simu/config.php index 57c81c0..c1d4890 100644 --- a/application/ship-simu/config.php +++ b/application/ship-simu/config.php @@ -70,5 +70,8 @@ $cfg->setConfigEntry('chat_enabled_msn', "Y"); // CFG: COMMAND-PARAMETER $cfg->setConfigEntry('command_parameter', "page"); +// CFG: USER-REGISTRATION +$cfg->setConfigEntry('user_registration', "ShipSimuRegistration"); + // [EOF] ?> diff --git a/application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php b/application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php index e926dbf..4fbfdcc 100644 --- a/application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php +++ b/application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php @@ -76,7 +76,28 @@ class WebShipsimuRegisterCommand extends BaseCommand implements Commandable { * @return void */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - $this->partialStub(); + // First get a UserRegistration instance + $registerInstance = ObjectFactory::createObjectByConfiguredName('user_registration'); + + // First set request and response instance + $registerInstance->setRequestInstance($requestInstance); + $registerInstance->setResponseInstance($responseInstance); + + // Encrypt the password + $registerInstance->encryptPassword('pass1'); + + // Do things before registration + $registerInstance->doPreRegistration(); + + // Register the new user + $registerInstance->registerNewUser(); + + // Do things after registration like notifying partner pages or queueing + // them for notification + $registerInstance->doPostRegistration(); + + // Redirect or login after registration + $registerInstance->doPostAction(); } } diff --git a/application/ship-simu/main/registration/.htaccess b/application/ship-simu/main/registration/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/registration/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/registration/class_ShipSimuRegistration.php b/application/ship-simu/main/registration/class_ShipSimuRegistration.php new file mode 100644 index 0000000..dd5ef73 --- /dev/null +++ b/application/ship-simu/main/registration/class_ShipSimuRegistration.php @@ -0,0 +1,107 @@ + + * @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 ShipSimuRegistration extends BaseRegistration { + /** + * Private constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set part description + $this->setObjectDescription("Ship-Simu registration class"); + + // Create unique ID number + $this->createUniqueID(); + } + + /** + * Create a new instance + * + * @return $registrationInstance An instance of this registration class + */ + public final static function createShipSimuRegistration () { + // Get a new instance + $registrationInstance = new ShipSimuRegistration(); + + // And return it + return $registrationInstance; + } + + /** + * Encrypt the given request key or throws an exception if the key was not + * found in the request + * + * @param $requestKey Key in request class + * @return void + */ + public function encryptPassword ($requestKey) { + $this->partialStub(sprintf("requestKey=%s", $requestKey)); + } + + /** + * Perform things like informing assigned affilates about new registration + * before registration + * + * @return void + */ + public function doPreRegistration () { + $this->partialStub(); + } + + /** + * Registers the new user account by insterting the request data into the + * database and paying some start credits or throw exceptions if this fails + * + * @return void + */ + public function registerNewUser () { + $this->partialStub(); + } + + /** + * Perform things like notifying partner websites after registration is done + * + * @return void + */ + public function doPostRegistration () { + $this->partialStub(); + } + + /** + * Do the action which is required after all registration steps are done. + * This can be a simple redirect to another webpage or displaying a message + * to the user. Or this can be a login step into the newly created account. + * + * @return void + */ + public function doPostAction () { + $this->partialStub(); + } +} + +// +?> diff --git a/application/ship-simu/templates/de/code/shipsimu_main.ctp b/application/ship-simu/templates/de/code/shipsimu_main.ctp index 793fd8e..ff1ab2c 100644 --- a/application/ship-simu/templates/de/code/shipsimu_main.ctp +++ b/application/ship-simu/templates/de/code/shipsimu_main.ctp @@ -1,7 +1,7 @@ {?header?}
-{ship_simu_header] +{?ship_simu_header?}
{?footer?} diff --git a/inc/classes/interfaces/registration/.htaccess b/inc/classes/interfaces/registration/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/registration/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/registration/class_UserRegister.php b/inc/classes/interfaces/registration/class_UserRegister.php new file mode 100644 index 0000000..cb83c18 --- /dev/null +++ b/inc/classes/interfaces/registration/class_UserRegister.php @@ -0,0 +1,68 @@ + + * @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 . + */ +interface UserRegister extends FrameworkInterface { + /** + * Encrypt the given request key or throws an exception if the key was not + * found in the request + * + * @param $requestKey Key in request class + * @return void + */ + function encryptPassword ($requestKey); + + /** + * Perform things like informing assigned affilates about new registration + * before registration + * + * @return void + */ + function doPreRegistration (); + + /** + * Registers the new user account by insterting the request data into the + * database and paying some start credits or throw exceptions if this fails + * + * @return void + */ + function registerNewUser (); + + /** + * Perform things like notifying partner websites after registration is done + * + * @return void + */ + function doPostRegistration (); + + /** + * Do the action which is required after all registration steps are done. + * This can be a simple redirect to another webpage or displaying a message + * to the user. Or this can be a login step into the newly created account. + * + * @return void + */ + function doPostAction (); +} + +// +?> diff --git a/inc/classes/main/registration/.htaccess b/inc/classes/main/registration/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/registration/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/registration/class_BaseRegistration.php b/inc/classes/main/registration/class_BaseRegistration.php new file mode 100644 index 0000000..e2cd781 --- /dev/null +++ b/inc/classes/main/registration/class_BaseRegistration.php @@ -0,0 +1,90 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.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 . + */ +abstract class BaseRegistration extends BaseFrameworkSystem implements UserRegister { + /** + * Instance of a request class + */ + private $requestInstance = null; + + /** + * Instance of a response class + */ + private $responseInstance = null; + + /** + * Private constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + } + + /** + * Setter for request instance + * + * @param $requestInstance An instance of a Requestable class + * @return void + */ + public final function setRequestInstance (Requestable $requestInstance) { + $this->requestInstance = $requestInstance; + } + + /** + * Getter for request instance + * + * @return $requestInstance An instance of a Requestable class + */ + public final function getRequestInstance () { + return $this->requestInstance; + } + + /** + * Setter for response instance + * + * @param $responseInstance An instance of a Responseable class + * @return void + */ + public final function setResponseInstance (Responseable $responseInstance) { + $this->responseInstance = $responseInstance; + } + + /** + * Getter for response instance + * + * @return $responseInstance An instance of a Responseable class + */ + public final function getResponseInstance () { + return $this->responseInstance; + } +} + +// [EOF] +?>