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/actions/class_ShipSimuLogoutAction.php -text
application/ship-simu/main/class_ -text
application/ship-simu/main/class_BasePersonell.php -text
application/ship-simu/main/class_BaseSimulator.php -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_logout.ctp -text
+application/ship-simu/templates/de/code/login_main.ctp -text
application/ship-simu/templates/de/code/login_welcome.ctp -text
+application/ship-simu/templates/de/code/logout_done.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
inc/classes/main/commands/web/class_WebLoginAreaCommand.php -text
inc/classes/main/commands/web/class_WebLoginCommand.php -text
inc/classes/main/commands/web/class_WebLoginFailedCommand.php -text
+inc/classes/main/commands/web/class_WebLogoutDoneCommand.php -text
inc/classes/main/commands/web/class_WebRegisterCommand.php -text
inc/classes/main/compressor/.htaccess -text
inc/classes/main/compressor/class_Bzip2Compressor.php -text
* @throws NullPointerException If $curr is null
* @throws NoArrayException If $curr is not an array
* @throws InvalidArrayCountException If $curr contains an
- * unexpected count of elements
+ * unexpected count of elements
* @throws MissingArrayElementsException If $curr is missing expected
- * array elements
+ * array elements
*/
public function insertApplicationTemplates () {
// First prepare the instance
// CFG: LOGIN-FAILED-URL
$cfg->setConfigEntry('login_failed_url', "index.php?app=ship-simu&page=login_failed");
+// CFG: LOGOUT-DONE-URL
+$cfg->setConfigEntry('logout_done_url', "index.php?app=ship-simu&page=logout_done");
+
// CFG: LOGIN-DEFAULT-ACTION
$cfg->setConfigEntry('login_default_action', "welcome");
// CFG: LOGIN-WELCOME-ACTION-CLASS
$cfg->setConfigEntry('login_welcome_action_class', "ShipSimuLoginAction");
+// CFG: LOGIN-LOGOUT-ACTION-CLASS
+$cfg->setConfigEntry('login_logout_action_class', "ShipSimuLogoutAction");
+
+// CFG: LOGOUT-IMMEDIATE
+$cfg->setConfigEntry('logout_immediate', "N");
+
// [EOF]
?>
--- /dev/null
+<?php
+/**
+ * An action class for the logout 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 ShipSimuLogoutAction extends BaseAction implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set description
+ $this->setObjectDescription("Logout action");
+
+ // Generate unique key
+ $this->generateUniqueId();
+ }
+
+ /**
+ * Creates an instance of this action
+ *
+ * @return $actionInstance An instance of this action class
+ */
+ public final static function createShipSimuLogoutAction () {
+ // Get a new instance
+ $actionInstance = new ShipSimuLogoutAction();
+
+ // 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) {
+ // Shall we logout or display logout page or logout immediately?
+ if (($this->getConfigInstance()->readConfig('logout_immediate') == "Y") || ($requestInstance->isRequestElementSet('logout'))) {
+ // Get an auth instance for checking and updating the auth cookies
+ $authInstance = ObjectFactory::createObjectByConfiguredName('auth_method_class', array($responseInstance));
+
+ // Set request instance
+ $authInstance->setRequestInstance($requestInstance);
+
+ // Destroy the auth data
+ $authInstance->destroyAuthData();
+
+ // Redirect to "logout done" page
+ $responseInstance->redirectToConfiguredUrl('logout_done_url');
+ } // END - if
+ }
+}
+
+// [EOF]
+?>
</div>
<div id="content_footer">
+ [<a href="$config[base_url]/index.php?app=ship-simu&page=login">Login erneut probieren</a>]
Vielen Dank für deine Mitarbeit! :-)
</div>
--- /dev/null
+<div id="logout_box">
+ <div id="logout_header">
+ Willst du dich wirklich aus dem Spiel aussloggen?
+ </div>
+ <div id="logout_links">
+ [<a href="$config[base_url]/index.php?app=ship-simu&page=login_area&action=logout&logout=1">Ja</a>] | [<a href="$config[base_url]/index.php?app=ship-simu&page=login_area">Nein</a>]
+ </div>
+</div>
--- /dev/null
+<div id="content_header">
+ Willkommen im Loginbereich von {?app_full_name?}!
+</div>
+
+<div id="content_body">
+ {?login_content?}
+</div>
+
+<div id="persona_data" title="Informationen zu Deinem Spieleaccount">
+ <div id="persona_header">
+ Account-Infos:
+ </div>
+ {?persona_data?}
+ <div id="logout_link">
+ [<a href="$config[base_url]/index.php?app=ship-simu&page=login_area&action=logout"
+ title="Aus dem Spiel ausloggen">Ausloggen</a>]
+ </div>
+</div>
+
+<div id="company_data" title="Informationen zu der aktuell ausgewählten Reederei">
+ <div id="company_header">
+ Reederei-Infos:
+ </div>
+ {?company_data?}
+</div>
-<div id="content_header">
- Willkommen im Loginbereich von {?app_full_name?}
-</div>
-
<div id="news_frame">
{?ship_simu_login_news?}
</div>
--- /dev/null
+<div id="content_header">
+ Du bist jetzt aus dem Spiel ausgeloggt!
+</div>
+
+<div id="content_body">
+ Du kannst dich nun [<a href="$config[base_url]/index.php?app=ship-simu&page=login">erneut einloggen</a>] oder weiter auf unseren Seiten bleiben. ;-)
+</div>
<?php
/**
- * A command for the "home" page
+ * A command for the form processor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
parent::__construct(__CLASS__);
// Set special description
- $this->setObjectDescription("Command for the "home" page");
+ $this->setObjectDescription("Command for the "login area" page");
// Create unique ID number
$this->generateUniqueId();
$templateInstance->loadCodeTemplate($action);
// Assign the template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable($action, "content");
+ $templateInstance->assignTemplateWithVariable($action, "login_content");
+
+ // Load main template
+ $templateInstance->loadCodeTemplate("login_main");
+
+ // Assign the main template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable("login_main", "content");
// Load the master template
$templateInstance->loadCodeTemplate($masterTemplate);
// Set title
- $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage("login_{$action}_title"));
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($action."_title"));
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
// ... and all variables. This should be merged together in a pattern
// to make things easier. A cache mechanism should be added between
parent::__construct(__CLASS__);
// Set special description
- $this->setObjectDescription("Command for the "home" page");
+ $this->setObjectDescription("Command for the login form page");
// Create unique ID number
$this->generateUniqueId();
parent::__construct(__CLASS__);
// Set special description
- $this->setObjectDescription("Command for the "home" page");
+ $this->setObjectDescription("Command for the "login failed" page");
// Create unique ID number
$this->generateUniqueId();
// Set title
$templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('login_failed_title'));
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
// ... and all variables. This should be merged together in a pattern
// to make things easier. A cache mechanism should be added between
// these two calls to cache compiled templates.
--- /dev/null
+<?php
+/**
+ * A command for the login failed 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 WebLogoutDoneCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set special description
+ $this->setObjectDescription("Command for the "logout done" page");
+
+ // Create unique ID number
+ $this->generateUniqueId();
+
+ // Clean up a little
+ $this->removeSystemArray();
+ }
+
+ /**
+ * 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 createWebLogoutDoneCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebLogoutDoneCommand();
+
+ // 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
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the application instance
+ $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateEngine($appInstance);
+
+ // Load the master template
+ $masterTemplate = $appInstance->getMasterTemplate();
+
+ // Load header template
+ $templateInstance->loadCodeTemplate("header");
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable("header", "header");
+
+ // Load footer template
+ $templateInstance->loadCodeTemplate("footer");
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable("footer", "footer");
+
+ // Load the logout_done template
+ $templateInstance->loadCodeTemplate("logout_done");
+
+ // Assign the logout_done template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable("logout_done", "content");
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('logout_done_title'));
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // ... and all variables. This should be merged together in a pattern
+ // to make things easier. A cache mechanism should be added between
+ // these two calls to cache compiled templates.
+ $templateInstance->compileVariables();
+
+ // Get the content back from the template engine and put it in the response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+}
+
+// [EOF]
+?>
* Checks wether a request element is set
* @param $element Name of the request element we want to check
* @return $isSet Wether the request element is set
- * @throws MissingArrayElementsException Thrown if a request element is not set
*/
public function isRequestElementSet ($element) {
// Is this element found?
if (!isset($this->requestData[$element])) {
- // Then throw an exception
- throw new MissingArrayElementsException(array($this, 'requestData', $element), self::EXCEPTION_MISSING_ELEMENT);
+ // Then return false
+ return false;
} // END - if
// All clear
// Initialize value
$value = null;
- try {
- if ($this->isRequestElementSet($element)) {
+ if ($this->isRequestElementSet($element)) {
$value = $this->requestData[$element];
- } // END - if
- } catch (MissingArrayElementsException $e) {
- // Do nothing here
- }
+ } // END - if
// Return the element's value
return $value;
/**
* Returns an command instance for a given request class or null if
- * MissingArrayElementsException was thrown
+ * it was not found
*
* @param $requestInstance An instance of a request class
* @return $commandInstance An instance of the resolved command
$commandName = "";
$commandInstance = null;
- // Test if the required parameter is set
- try {
- // This goes fine so let's resolv the command
- $commandName = $requestInstance->getRequestElement("page");
+ // This goes fine so let's resolv the command
+ $commandName = $requestInstance->getRequestElement("page");
- // Is the command empty? Then fall back to default command
- if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_command');
+ // Is the command empty? Then fall back to default command
+ if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_command');
- // Check if the command is valid
- if (!$this->isCommandValid($commandName)) {
- // This command is invalid!
- throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
- }
+ // Check if the command is valid
+ if (!$this->isCommandValid($commandName)) {
+ // This command is invalid!
+ throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
- // Get the command
- $commandInstance = $this->loadCommand($commandName);
+ // Get the command
+ $commandInstance = $this->loadCommand($commandName);
- // And validate it
- if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) {
- // This command has an invalid instance!
- throw new InvalidCommandInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
- }
+ // And validate it
+ if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) {
+ // This command has an invalid instance!
+ throw new InvalidCommandInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
- // Set last command
- $this->lastCommandInstance = $commandInstance;
- } catch (MissingArrayElementsException $e) {
- // Just catch it here...
- }
+ // Set last command
+ $this->lastCommandInstance = $commandInstance;
// Return the resolved command instance
return $commandInstance;
$commandName = "";
$controllerInstance = null;
- // Try to resolv the command
- try {
- // Get the command name
- $commandName = $this->getCommandName();
-
- // Check if the command is valid
- if (!$this->isCommandValid($commandName)) {
- // This command is invalid!
- throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
- }
+ // Get the command name
+ $commandName = $this->getCommandName();
- // Get the command
- $controllerInstance = $this->loadController($commandName);
+ // Check if the command is valid
+ if (!$this->isCommandValid($commandName)) {
+ // This command is invalid!
+ throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
- // And validate it
- if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
- // This command has an invalid instance!
- throw new InvalidControllerInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_CONTROLLER);
- }
+ // Get the command
+ $controllerInstance = $this->loadController($commandName);
- // Set last controller
- $this->lastControllerInstance = $controllerInstance;
- } catch (MissingArrayElementsException $e) {
- // Just catch it here...
- }
+ // And validate it
+ if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
+ // This command has an invalid instance!
+ throw new InvalidControllerInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_CONTROLLER);
+ } // END - if
+
+ // Set last controller
+ $this->lastControllerInstance = $controllerInstance;
// Return the maybe resolved instance
return $controllerInstance;
return $this->lastTemplate;
}
- /**
- * Assign a given congfiguration variable with a value
- *
- * @param $var The configuration variable we want to assign
- * @return void
- */
- private final function assignConfigVariable ($var) {
- // Sweet and simple...
- $this->configVariables[$var] = $this->getConfigInstance()->readConfig($var);
- }
-
/**
* Initialize the variable stack. This holds all variables for later
* compilation.
* @param $template The template we shall load
* @return void
*/
- private final function loadTemplate ($template) {
+ private function loadTemplate ($template) {
// Cast it to string
$template = (string) $template;
* located in "html" by default
* @return void
*/
- public final function loadWebTemplate ($template) {
+ public function loadWebTemplate ($template) {
// Set template type
$this->setTemplateType($this->getConfigInstance()->readConfig('web_template_type'));
$this->loadTemplate($template);
}
+ /**
+ * Assign a given congfiguration variable with a value
+ *
+ * @param $var The configuration variable we want to assign
+ * @return void
+ */
+ public function assignConfigVariable ($var) {
+ // Sweet and simple...
+ $this->configVariables[$var] = $this->getConfigInstance()->readConfig($var);
+ }
+
/**
* Load a specified email template into the engine
*
* located in "emails" by default
* @return void
*/
- public final function loadEmailTemplate ($template) {
+ public function loadEmailTemplate ($template) {
// Set template type
$this->setTemplateType($this->getConfigInstance()->readConfig('email_template_type'));
* located in "code" by default
* @return void
*/
- public final function loadCodeTemplate ($template) {
+ public function loadCodeTemplate ($template) {
// Set template type
$this->setTemplateType($this->getConfigInstance()->readConfig('code_template_type'));