]> git.mxchange.org Git - shipsimu.git/commitdiff
TODO tag rewritten, first login action (empty for now) added
authorRoland Häder <roland@mxchange.org>
Wed, 18 Jun 2008 19:53:09 +0000 (19:53 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 18 Jun 2008 19:53:09 +0000 (19:53 +0000)
20 files changed:
.gitattributes
application/ship-simu/class_ApplicationHelper.php
application/ship-simu/config.php
application/ship-simu/main/actions/.htaccess [new file with mode: 0644]
application/ship-simu/main/actions/class_ShipSimuLoginAction.php [new file with mode: 0644]
application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php
application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php
application/ship-simu/main/ships/passenger/class_PassengerShip.php
application/ship-simu/templates/de/code/login_welcome.ctp [new file with mode: 0644]
db/news/.htaccess [new file with mode: 0644]
inc/classes/interfaces/response/class_Responseable.php
inc/classes/main/commands/web/class_WebLoginAreaCommand.php
inc/classes/main/controller/default/class_WebLoginController.php
inc/classes/main/database/databases/class_LocalFileDatabase.php
inc/classes/main/filter/news/class_NewsProcessFilter.php
inc/classes/main/helper/web/class_WebFormHelper.php
inc/classes/main/response/class_HttpResponse.php
inc/classes/main/rng/class_RandomNumberGenerator.php
inc/classes/main/template/class_TemplateEngine.php
inc/loader/class_ClassLoader.php

index eb798ccbc18d683b1a11d3953ae4e1433166d55d..05dd822db032d20d45311109a412ff8818d64a47 100644 (file)
@@ -54,6 +54,8 @@ application/ship-simu/interfaces/class_SignableContract.php -text
 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_ShipSimuLoginAction.php -text
 application/ship-simu/main/class_ -text
 application/ship-simu/main/class_BasePersonell.php -text
 application/ship-simu/main/class_BaseSimulator.php -text
@@ -132,12 +134,14 @@ application/ship-simu/templates/de/code/header.ctp -text
 application/ship-simu/templates/de/code/home.ctp -text
 application/ship-simu/templates/de/code/login_failed.ctp -text
 application/ship-simu/templates/de/code/login_form.ctp -text
+application/ship-simu/templates/de/code/login_welcome.ctp -text
 application/ship-simu/templates/de/code/register_form.ctp -text
 application/ship-simu/templates/de/code/shipsimu_main.ctp -text
 application/ship-simu/templates/de/html/.htaccess -text
 application/ship-simu/templates/de/html/nav_advert.tpl -text
 application/ship-simu/templates/de/html/selector_ship-simu.tpl -text
 db/.htaccess -text
+db/news/.htaccess -text
 db/user/.htaccess -text
 devel/.htaccess -text
 devel/class_Debug.php -text
index f499c4817cacc3493d79ee967f05a18229472fe4..ab372a5f8cb3a0a6cc27b4609ba38a86b4171108 100644 (file)
@@ -69,6 +69,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
         * An instance of this class
         */
        private static $thisInstance = null;
+
        /**
         * Protected constructor
         *
index 1abaffff152995cfd34b5195886110a9541eb9f4..0217b61309f08382b4db4a69d0eb16f3363163b6 100644 (file)
@@ -127,5 +127,8 @@ $cfg->setConfigEntry('guest_login_username', "guest");
 // CFG: GUEST-LOGIN-PASSWORD
 $cfg->setConfigEntry('guest_login_password', "guest");
 
+// CFG: LOGIN-WELCOME-ACTION-CLASS
+$cfg->setConfigEntry('login_welcome_action_class', "ShipSimuLoginAction");
+
 // [EOF]
 ?>
diff --git a/application/ship-simu/main/actions/.htaccess b/application/ship-simu/main/actions/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/actions/class_ShipSimuLoginAction.php b/application/ship-simu/main/actions/class_ShipSimuLoginAction.php
new file mode 100644 (file)
index 0000000..baf56a0
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/**
+ * An action class for the login welcome page
+ *
+ * @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 ShipSimuLoginAction extends BaseAction implements Commandable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set description
+               $this->setObjectDescription("Login welcome action");
+
+               // Generate unique key
+               $this->generateUniqueId();
+       }
+
+       /**
+        * Creates an instance of this action
+        *
+        * @return      $actionInstance         An instance of this action class
+        */
+       public final static function createShipSimuLoginAction () {
+               // Get a new instance
+               $actionInstance = new ShipSimuLoginAction();
+
+               // 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
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               /* @TODO Maybe we need to do something later here */
+       }
+}
+
+// [EOF]
+?>
index cc9b0b7193e4fa1902503f9917fa5c0f71196c1c..f7e50f7870ae8f734c0912780566bcd8041f6205 100644 (file)
@@ -58,7 +58,7 @@ class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
                // Get the controller instance from the resolver (breaks MVC pattern again)
                $controllerInstance = $resolverInstance->getControllerInstance();
 
-               // @TODO Add some more pre/post filters to the controller
+               /* @TODO Add some more pre/post filters to the controller */
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_class'));
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_class'));
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator_class'));
index afab4466997f227fe88ceaa1ca1197e4d05dc959..6a2ab504c3d6151643f56c378dcf52d2983f851c 100644 (file)
@@ -71,7 +71,8 @@ class WebShipsimuUserLoginCommand extends BaseCommand implements Commandable {
                                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_class'));
                                break;
                }
-               // @TODO Add more filters
+
+               /* @TODO Add more filters */
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_class'));
 
                // Return the prepared instance
index b78f7dd3f50b1cbe7d51ef101f8d903fefc36b44..cbe0a2225b5cc20dbd45bbeaaa1e5cde606a5941 100644 (file)
@@ -49,7 +49,7 @@ class PassengerShip extends BaseShip implements ConstructableShip, LimitableObje
                                __CLASS__,
                                __LINE__
                        ));
-               }
+               } // END - if
 
                // Set ship's name
                $passInstance->setShipName($shipName);
@@ -66,7 +66,7 @@ class PassengerShip extends BaseShip implements ConstructableShip, LimitableObje
                if (is_null($struct)) {
                        // Empty structures list!
                        throw new EmptyStructuresListException($this, self::EXCEPTION_EMPTY_STRUCTURES_ARRAY);
-               }
+               } // END - if
 
                // Anzahl Betten auf 0 setzen
                $numBeds = 0;
@@ -108,7 +108,7 @@ class PassengerShip extends BaseShip implements ConstructableShip, LimitableObje
                                        $el->getObjectDescription()
                                ));
                        }
-               }
+               } // END - for
 
                if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das <strong>%s</strong> mit dem Namen <strong>%s</strong> hat <strong>%d</strong> Betten.<br />\n",
                        __CLASS__,
@@ -125,10 +125,10 @@ class PassengerShip extends BaseShip implements ConstructableShip, LimitableObje
        /**
         * Reduces the volume of a processed object.
         *
-        * @param               $limitInstance          An instance to ObjectLimits which holds
-        *                              attribute names that we want to include in the processing
-        *                              phase. Other attributes except $uniqueID and $realClass will
-        *                              be ignored and keept out.
+        * @param       $limitInstance  An instance to ObjectLimits which holds
+        *                      attribute names that we want to include in the processing phase.
+        *                      Other attributes except $uniqueID and $realClass will be ignored
+        *                      and keept out.
         * @return      void
         */
        function limitObject (ObjectLimits $limitInstance) {
diff --git a/application/ship-simu/templates/de/code/login_welcome.ctp b/application/ship-simu/templates/de/code/login_welcome.ctp
new file mode 100644 (file)
index 0000000..7d3df54
--- /dev/null
@@ -0,0 +1,7 @@
+<div id="content_header">
+       Willkommen im Loginbereich  von {?app_full_name?}
+</div>
+
+<div id="news_frame">
+       {?ship_simu_login_news?}
+</div>
diff --git a/db/news/.htaccess b/db/news/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
index a1fabde81d9b02364c040ec7fdbf6f860b3d6a9b..1904b14dfdb5abca6ca2173d4261986264001cfc 100644 (file)
@@ -50,7 +50,7 @@ interface Responseable extends FrameworkInterface {
        /**
         * Flushs the cached HTTP response to the outer world
         *
-        * @param       $foce   Wether we shall force the output or abort if headers are
+        * @param       $force  Wether we shall force the output or abort if headers are
         *                                      already sent with an exception
         * @return      void
         * @throws      ResponseHeadersAlreadySentException             Thrown if headers are
index 8b73b2ba1367bcc14cd744d528110c331d8e2fff..9908233fe20c68c4bd98d57e47c4bb98c18a6916 100644 (file)
@@ -54,10 +54,22 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
                // Set the application instance
                $commandInstance->setResolverInstance($resolverInstance);
 
+               // Load general data like user status and such
+               $commandInstance->prepareCommand();
+
                // Return the prepared instance
                return $commandInstance;
        }
 
+       /**
+        * Prepares some general data which shall be displayed on every page
+        *
+        * @return      void
+        */
+       protected function prepareCommand () {
+               /* @TODO Add some stuff here: Some personal data, app/game related data */
+       }
+
        /**
         * Executes the given command with given request and response objects
         *
@@ -67,14 +79,34 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Default action is the one from configuration
+               $actionClass = sprintf("login_%s_action_class", $this->getConfigInstance()->readConfig('login_default_action'));
                $action = sprintf("login_%s", $this->getConfigInstance()->readConfig('login_default_action'));
 
+               // Get "action" from request
+               $actReq = $requestInstance->getRequestElement('action');
+
+               // Do we have a "action" parameter set?
+               if (is_string($actReq)) {
+                       // Then use it with prefix
+                       $actionClass = sprintf("login_%s_action_class", $actReq);
+                       $action = sprintf("login_%s", $actReq);
+               } // END - if
+
+               // Get an action instance
+               $actionInstance = ObjectFactory::createObjectByConfiguredName($actionClass);
+
+               // Execute the action (shall not output anything, see below why)
+               $actionInstance->execute($requestInstance, $responseInstance);
+
                // Get the application instance
                $appInstance = $this->getResolverInstance()->getApplicationInstance();
 
                // Prepare a template instance
                $templateInstance = $this->prepareTemplateEngine($appInstance);
 
+               // Assign all the application's data with template variables
+               $templateInstance->assignApplicationData($appInstance);
+
                // Load the master template
                $masterTemplate = $appInstance->getMasterTemplate();
 
@@ -92,17 +124,6 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
                $templateInstance->compileTemplate();
                $templateInstance->assignTemplateWithVariable("footer", "footer");
 
-               // Get "action" from request
-               $actReq = $requestInstance->getRequestElement("action");
-
-               // Do we have a "action" parameter set?
-               if (is_string($actReq)) {
-                       // Then use it with prefix
-                       $action = sprintf("login_%s", $actReq);
-               } // END - if
-
-               // @TODO Do the action somewhere here
-
                // Load the matching template
                $templateInstance->loadCodeTemplate($action);
 
@@ -113,7 +134,7 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
                $templateInstance->loadCodeTemplate($masterTemplate);
 
                // Set title
-               $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('login_{$action}_title'));
+               $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage("login_{$action}_title"));
 
                // ... and all variables. This should be merged together in a pattern
                // to make things easier. A cache mechanism should be added between
index 1758c8a891ec9cec0447965995a77da509aba58c..5c8f9f4214e1e09bd9db22eaf5eea52d09349e77 100644 (file)
@@ -52,7 +52,7 @@ class WebLoginController extends BaseController implements Controller {
                // Set the command resolver
                $controllerInstance->setResolverInstance($resolverInstance);
 
-               // @TODO Add some filters to this controller
+               /* @TODO Add some filters to this controller */
 
                // Return the prepared instance
                return $controllerInstance;
index 220ad14d2888bdb84e28054e84aff41e455f5d04..610843a60effe7a6c8620bd13fbd6703d3f58f41 100644 (file)
@@ -479,7 +479,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         * @return      void
         */
        public function connectToDatabase () {
-               // @TODO Do some checks on the database directory and files here
+               /* @TODO Do some checks on the database directory and files here */
        }
 
        /**
index 8df6a0f011b1d20d083d29fe5cd6eb90ab89892a..b6be041a851e2de5b0c59580afb1e656e84955a4 100644 (file)
@@ -60,7 +60,7 @@ class NewsProcessFilter extends BaseFilter implements Filterable {
         * @return      void
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               $this->partialStub("Unfinished work.");
+               /* @TODO Unfinished stub, add functionality here */
        }
 }
 
index 6dbffb5c01a33ed1c02b32856b2140420e875b68..293a6fc34c14efaeb9a4f85a00cee7e5026d3727 100644 (file)
@@ -151,7 +151,7 @@ class WebFormHelper extends BaseHelper {
                                $this->addFormGroup("", "");
                        }
 
-                       // @TODO Add some unique PIN here to bypass problems with some browser and/or extensions
+                       /* @TODO Add some unique PIN here to bypass problems with some browser and/or extensions */
                        // Simply close it
                        $this->formOpened = false;
                }
index b3cbd0bdc3b92fff5e4c306bcab1eba5b58f16f6..57e4eb7eca2d5220a466fa4185c259e39262f6be 100644 (file)
@@ -148,7 +148,7 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
        /**
         * Flushs the cached HTTP response to the outer world
         *
-        * @param       $foce   Wether we shall force the output or abort if headers are
+        * @param       $force  Wether we shall force the output or abort if headers are
         *                                      already sent with an exception
         * @return      void
         * @throws      ResponseHeadersAlreadySentException             Thrown if headers are
@@ -256,7 +256,7 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
 
                // Shall we encrypt the cookie?
                if ($encrypted === true) {
-                       // @TODO Encryption of cookie data not yet supported
+                       /* @TODO Encryption of cookie data not yet supported */
                } // END - if
 
                // For slow browsers set the cookie array element first
@@ -271,15 +271,15 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
                $domain = $this->getConfigInstance()->readConfig('cookie_domain');
 
                setcookie($cookieName, $cookieValue, $expires);
-               // @TODO Why are these parameters conflicting?
+               /* @TODO Why are these parameters conflicting? */
                //, $path, $domain, (isset($_SERVER['HTTPS']))
                return;
-               // @TODO This will send only one cookie out, the first one.
+               /* @TODO This will send only one cookie out, the first one. */
 
                // Now construct the full header
                $cookieString = $cookieName . "=" . $cookieValue . "; ";
                $cookieString .= "expires=" . date("D, d-F-Y H:i:s", $expires) . " GMT";
-               // @TODO Why are these parameters conflicting?
+               /* @TODO Why are these parameters conflicting? */
                // $cookieString .= "; path=".$path."; domain=".$domain;
 
                // Set the cookie as a header
index a72e13a9e03fa74f023750b3c1be27fd15b9a57f..12e1c01820925c40bc87efe88f383c6881d8044a 100644 (file)
@@ -105,7 +105,7 @@ class RandomNumberGenerator extends BaseFrameworkSystem {
                }
 
                // One-way data we need for "extra-salting" the random number
-               // @TODO Add site key for stronger salt!
+               /* @TODO Add site key for stronger salt! */
                $this->extraSalt = sha1($serverIp . ":" . getenv('SERVER_SOFTWARE') . ":" . $this->getConfigInstance()->readConfig('date_key') . ":" . serialize($this->getDatabaseInstance()->getConnectionData()));
 
                // Get config entry for max salt length
@@ -143,7 +143,7 @@ class RandomNumberGenerator extends BaseFrameworkSystem {
         * @return      $num    Pseudo-random number
         */
        public function randomNumnber ($min, $max) {
-               // @TODO I had a better random number generator here
+               /* @TODO I had a better random number generator here */
                return mt_rand($min, $max);
        }
 
index 7fada106d4501510690254e537f3d9fb6742a4ef..7378a40722fc389bb1e1ad1f9b93b3d00f7f29e9 100644 (file)
@@ -793,7 +793,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                                $this->assignVariable($var, $varMatches[3][$key]);
                        } elseif (!empty($varMatches[2][$key])) {
                                // Non-string found so we need some deeper analysis...
-                               // @TODO Unfinished work or don't die here.
+                               /* @TODO Unfinished work or don't die here. */
                                die("Deeper analysis not yet implemented!");
                        }
 
@@ -986,7 +986,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                        );
 
                        // This loop does remove the backslashes (\) in PHP parameters
-                       // @TODO Make this some nicer...
+                       /* @TODO Make this some nicer... */
                        while (strpos($eval, "<?") !== false) {
                                // Get left part before "<?"
                                $evalLeft = substr($eval, 0, strpos($eval, "<?"));
index 5e9ac7ba6b968b06ec60e0d250c545e6a717eac1..06b8fd82c07e666f9d9e63aecd22e9c2958ed738 100644 (file)
@@ -240,7 +240,7 @@ class ClassLoader {
 
                // If the basePath is false it is invalid
                if ($basePath2 === false) {
-                       // @TODO: Do not die here.
+                       /* @TODO: Do not die here. */
                        die("Cannot read {$basePath} !");
                } else {
                        // Set base path