]> git.mxchange.org Git - shipsimu.git/commitdiff
Registration class added with stubs
authorRoland Häder <roland@mxchange.org>
Fri, 6 Jun 2008 21:38:03 +0000 (21:38 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 6 Jun 2008 21:38:03 +0000 (21:38 +0000)
.gitattributes
application/selector/templates/de/code/selector_main.ctp
application/ship-simu/config.php
application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php
application/ship-simu/main/registration/.htaccess [new file with mode: 0644]
application/ship-simu/main/registration/class_ShipSimuRegistration.php [new file with mode: 0644]
application/ship-simu/templates/de/code/shipsimu_main.ctp
inc/classes/interfaces/registration/.htaccess [new file with mode: 0644]
inc/classes/interfaces/registration/class_UserRegister.php [new file with mode: 0644]
inc/classes/main/registration/.htaccess [new file with mode: 0644]
inc/classes/main/registration/class_BaseRegistration.php [new file with mode: 0644]

index a5d64e95b9c54113b3ec905f5de3c7eeff5967b8..3f3f717017125c3b5a5529de65e2e1440e224cfc 100644 (file)
@@ -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
index c18c4a98fe1231a3d82f2efa292629afbc1463d0..d1e9c2280bb837680073bf89159c0db362ec6653 100644 (file)
@@ -3,7 +3,7 @@
 {?navigation?}
 
 <div id="main_header">
-{app_selector_header}
+{?app_selector_header?}
 </div>
 
 <div id="main_content">
@@ -11,7 +11,7 @@
 </div>
 
 <div id="main_footer">
-{app_selector_footer}
+{?app_selector_footer?}
 </div>
 
 {?footer?}
index 57c81c0e33ec8ec8fa22f94f909f26dbfc53ed3f..c1d4890f5481f3a61e4d20fa07c49a0837810928 100644 (file)
@@ -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]
 ?>
index e926dbf80450f91321cd9bf38ab6815f9d0fce5d..4fbfdcc5bd8b8100f1c418952168dc4e2dcf5038 100644 (file)
@@ -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 (file)
index 0000000..3a42882
--- /dev/null
@@ -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 (file)
index 0000000..dd5ef73
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/**
+ * A user registration specially for Ship-Simu
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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();
+       }
+}
+
+//
+?>
index 793fd8e6f273a782bf456541ef18804097c054e4..ff1ab2c6339b9145b4ef3242bd1b8cf6e4f1dc43 100644 (file)
@@ -1,7 +1,7 @@
 {?header?}
 
 <div id="main_header">
-{ship_simu_header]
+{?ship_simu_header?}
 </div>
 
 <div id="navigation">
@@ -17,7 +17,7 @@
 </div>
 
 <div id="main_footer">
-{ship_simu_footer}
+{?ship_simu_footer?}
 </div>
 
 {?footer?}
diff --git a/inc/classes/interfaces/registration/.htaccess b/inc/classes/interfaces/registration/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -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 (file)
index 0000000..cb83c18
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+/**
+ * A class for user registration
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 (file)
index 0000000..3a42882
--- /dev/null
@@ -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 (file)
index 0000000..e2cd781
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+/**
+ * A general registration class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>