--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command for ??? page
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @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 Html???Command 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 createHtml???Command (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new Html???Command();
+
+ // 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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for the confirmation link handling
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 WebConfirmCommand 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 static final function createWebConfirmCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebConfirmCommand();
+
+ // 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
+ $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+ // Assign application data with template engine
+ $templateInstance->assignApplicationData($applicationInstance);
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // Load the master template
+ $masterTemplate = $applicationInstance->buildMasterTemplateName();
+
+ // 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 home template
+ $templateInstance->loadCodeTemplate('confirm_link');
+
+ // Assign the home template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable('confirm_link', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_confirm_link_title'));
+
+ // Get user instance
+ try {
+ $userInstance = Registry::getRegistry()->getInstance('user');
+ } catch (NullPointerException $e) {
+ // Not found user, e.g. when the user is somehow invalid
+ $responseInstance->redirectToConfiguredUrl('html_cmd_user_is_null');
+ }
+
+ // Set username
+ $templateInstance->assignVariable('username', $userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USERNAME));
+
+ // Construct the menu in every command. We could do this in BaseCommand class. But this means
+ // *every* command has a navigation system and that is want we don't want.
+ $menuInstance = ObjectFactory::createObjectByConfiguredName('confirm_menu_class', array($applicationInstance));
+
+ // Render the menu
+ $menuInstance->renderMenu();
+
+ // Transfer it to the template engine instance
+ $menuInstance->transferContentToTemplateEngine($templateInstance);
+
+ /*
+ * ... 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 response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * 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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for the form processor
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 WebDoFormCommand 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 static final function createWebDoFormCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebDoFormCommand();
+
+ // 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) {
+ // Should never be reached...
+ $this->debugBackTrace('This should never be reached.');
+ }
+
+ /**
+ * 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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for the home page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 WebHomeCommand 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 static final function createWebHomeCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebHomeCommand();
+
+ // 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
+ $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+ // Transfer application data
+ $templateInstance->assignApplicationData($applicationInstance);
+
+ // Load the master template
+ $masterTemplate = $applicationInstance->buildMasterTemplateName();
+
+ // 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 home template
+ $templateInstance->loadCodeTemplate('home');
+
+ // Assign the home template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable('home', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_home_title'));
+
+ // Construct the menu in every command. We could do this in BaseCommand class. But this means
+ // *every* command has a navigation system and that is want we don't want.
+ $menuInstance = ObjectFactory::createObjectByConfiguredName('home_menu_class', array($applicationInstance));
+
+ // Render the menu
+ $menuInstance->renderMenu();
+
+ // Transfer it to the template engine instance
+ $menuInstance->transferContentToTemplateEngine($templateInstance);
+
+ /*
+ * ... 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 response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * 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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for the login area (member/gamer area)
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 WebLoginAreaCommand extends BaseCommand implements Commandable {
+ /**
+ * Name of the action
+ */
+ private $actionName = '';
+
+ /**
+ * 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 static final function createWebLoginAreaCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebLoginAreaCommand();
+
+ // 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
+ * @todo Add some stuff here: Some personal data, app/game related data
+ */
+ protected function prepareCommand () {
+ }
+
+ /**
+ * 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 action instance from registry
+ $actionInstance = Registry::getRegistry()->getInstance('action');
+
+ // Do we have an action here?
+ if ($actionInstance instanceof PerformableAction) {
+ // Execute the action (shall not output anything, see below why)
+ $actionInstance->execute($requestInstance, $responseInstance);
+ } // END - if
+
+ // Get the application instance
+ $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // Assign all the application's data with template variables
+ $templateInstance->assignApplicationData($applicationInstance);
+
+ // Load the master template
+ $masterTemplate = $applicationInstance->buildMasterTemplateName();
+
+ // 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 matching template
+ $templateInstance->loadCodeTemplate('action_' . $this->actionName);
+
+ // Assign the template with the master template as a content ... ;)
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('action_' . $this->actionName, 'login_content');
+
+ // Load main template
+ $templateInstance->loadCodeTemplate('login_main');
+
+ // Assign the main template with the master template as a content ... ;)
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('login_main', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($this->actionName . '_title'));
+
+ // Construct the menu in every command. We could do this in BaseCommand class. But this means
+ // *every* command has a navigation system and that is want we don't want.
+ $menuInstance = ObjectFactory::createObjectByConfiguredName('login_area_menu_class', array($applicationInstance));
+
+ // Render the menu
+ $menuInstance->renderMenu();
+
+ // Transfer it to the template engine instance
+ $menuInstance->transferContentToTemplateEngine($templateInstance);
+
+ /*
+ * ... 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 response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * Adds extra filters to the given controller instance. An corresponding action class must now exist!
+ *
+ * @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) {
+ // Default is no action
+ $actionInstance = NULL;
+
+ // Get registry
+ $registryInstance = Registry::getRegistry();
+
+ // Get our application instance from the registry
+ $applicationInstance = $registryInstance->getInstance('application');
+
+ // Default action is the one from configuration
+ $this->actionName = $this->convertDashesToUnderscores($applicationInstance->getAppShortName()) . '_login_' . $this->getConfigInstance()->getConfigEntry('login_default_action');
+
+ // Get "action" from request
+ $actReq = $requestInstance->getRequestElement('action');
+
+ // Do we have a "action" parameter set?
+ if ((is_string($actReq)) && (!empty($actReq))) {
+ // Then use it with prefix
+ $this->actionName = $this->convertDashesToUnderscores($applicationInstance->getAppShortName()) . '_login_' . $actReq;
+ } // END - if
+
+ // Get application instance
+ $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Get a resolver
+ $actionResolver = WebActionResolver::createWebActionResolver($this->actionName, $applicationInstance);
+
+ // Resolve the action
+ $actionInstance = $actionResolver->resolveAction();
+
+ // Add more action-specific filters
+ $actionInstance->addExtraFilters($controllerInstance, $requestInstance);
+
+ // Remember this action in registry
+ Registry::getRegistry()->addInstance('action', $actionInstance);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A command for the login form
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 WebLoginCommand extends BaseCommand implements Commandable, Registerable {
+ /**
+ * 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 static final function createWebLoginCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebLoginCommand();
+
+ // 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) {
+ // Set request instance as extra instance
+ Registry::getRegistry()->addInstance('extra', $this);
+
+ // Get the application instance
+ $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+ // Assign application data with template engine
+ $templateInstance->assignApplicationData($applicationInstance);
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // Load the master template
+ $masterTemplate = $applicationInstance->buildMasterTemplateName();
+
+ // 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 home template
+ $templateInstance->loadCodeTemplate('login_form');
+
+ // Assign the home template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable('login_form', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_login_title'));
+
+ // Construct the menu in every command. We could do this in BaseCommand class. But this means
+ // *every* command has a navigation system and that is want we don't want.
+ $menuInstance = ObjectFactory::createObjectByConfiguredName('login_menu_class', array($applicationInstance));
+
+ // Render the menu
+ $menuInstance->renderMenu();
+
+ // Transfer it to the template engine instance
+ $menuInstance->transferContentToTemplateEngine($templateInstance);
+
+ /*
+ * ... 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 response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * 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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for the login failed page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 WebLoginFailedCommand 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 static final function createWebLoginFailedCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebLoginFailedCommand();
+
+ // 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
+ $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+ // Assign application data with template engine
+ $templateInstance->assignApplicationData($applicationInstance);
+
+ // Load the master template
+ $masterTemplate = $applicationInstance->buildMasterTemplateName();
+
+ // 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 login_failed template
+ $templateInstance->loadCodeTemplate('login_failed');
+
+ // Assign the login_failed template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable('login_failed', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('login_failed_title'));
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // Construct the menu in every command. We could do this in BaseCommand class. But this means
+ // *every* command has a navigation system and that is want we don't want.
+ $menuInstance = ObjectFactory::createObjectByConfiguredName('login_failed_menu_class', array($applicationInstance));
+
+ // Render the menu
+ $menuInstance->renderMenu();
+
+ // Transfer it to the template engine instance
+ $menuInstance->transferContentToTemplateEngine($templateInstance);
+
+ /*
+ * ... 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 response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * 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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for logout
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 WebLogoutCommand 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 static final function createWebLogoutCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebLogoutCommand();
+
+ // 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 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');
+
+ // Exit here
+ exit();
+ }
+
+ /**
+ * 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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for the login failed page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
+ */
+ public static final 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
+ $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+ // Assign application data
+ $templateInstance->assignApplicationData($applicationInstance);
+
+ // Load the master template
+ $masterTemplate = $applicationInstance->buildMasterTemplateName();
+
+ // 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');
+
+ // Construct the menu in every command. We could do this in BaseCommand class. But this means
+ // *every* command has a navigation system and that is want we don't want.
+ $menuInstance = ObjectFactory::createObjectByConfiguredName('logout_menu_class', array($applicationInstance));
+
+ // Render the menu
+ $menuInstance->renderMenu();
+
+ // Transfer it to the template engine instance
+ $menuInstance->transferContentToTemplateEngine($templateInstance);
+
+ /*
+ * ... 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 response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * 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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for Problem page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 WebProblemCommand 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 static final function createWebProblemCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebProblemCommand();
+
+ // 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]
+?>
--- /dev/null
+<?php
+/**
+ * A command class for the registration form
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 WebRegisterCommand extends BaseCommand implements Commandable, Registerable {
+ /**
+ * 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 static final function createWebRegisterCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebRegisterCommand();
+
+ // 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) {
+ // Set request instance as extra instance
+ Registry::getRegistry()->addInstance('extra', $this);
+
+ // Get the application instance
+ $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+ // Assign all the application's data with template variables
+ $templateInstance->assignApplicationData($applicationInstance);
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // Load the master template
+ $masterTemplate = $applicationInstance->buildMasterTemplateName();
+
+ // 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 register template
+ $templateInstance->loadCodeTemplate('register_form');
+
+ // Assign the register template with the master template as a content ... ;)
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('register_form', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_register_title'));
+
+ // Construct the menu in every command. We could do this in BaseCommand class. But this means
+ // *every* command has a navigation system and that is want we don't want.
+ $menuInstance = ObjectFactory::createObjectByConfiguredName('register_menu_class', array($applicationInstance));
+
+ // Render the menu
+ $menuInstance->renderMenu();
+
+ // Transfer it to the template engine instance
+ $menuInstance->transferContentToTemplateEngine($templateInstance);
+
+ /*
+ * ... 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 response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * 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 method
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A command class for resending the confirmation link
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 WebResendLinkCommand 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 static final function createWebResendLinkCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebResendLinkCommand();
+
+ // 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 user instance from registry
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Get an application instance
+ $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Get a RNG instance (Random Number Generator)
+ $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
+
+ // Generate a pseudo-random string
+ $randomString = $rngInstance->randomString(255);
+
+ // Get a crypto instance
+ $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+
+ // Hash and encrypt the string
+ $hashedString = $cryptoInstance->hashString($cryptoInstance->encryptString($randomString));
+
+ // Update the user class
+ $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH, $hashedString);
+
+ // Re-set config entry to mailer engine
+ $this->getConfigInstance()->setConfigEntry('html_template_class', $this->getConfigInstance()->getConfigEntry('mail_template_class'));
+
+ // Prepare the template engine
+ $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+ // Assign the application data with the template engine
+ $templateInstance->assignApplicationData($applicationInstance);
+
+ // Get a mailer class
+ $mailerInstance = ObjectFactory::createObjectByConfiguredName('mailer_class', array($templateInstance, $applicationInstance, 'resend_link'));
+
+ // Set this mailer in our template engine
+ $templateInstance->setMailerInstance($mailerInstance);
+
+ // Add template variables we shall get
+ $mailerInstance->addConfigTemplateVariable('base_url');
+ $mailerInstance->addConfigTemplateVariable('admin_email');
+ $mailerInstance->addValueTemplateVariable('confirm_hash');
+ $mailerInstance->addValueTemplateVariable('username');
+ $mailerInstance->addValueTemplateVariable('email');
+
+ // Add the value instance for the confirmation hash
+ $mailerInstance->addValueInstance('confirm_hash', $userInstance);
+ $mailerInstance->addValueInstance('username', $userInstance);
+ $mailerInstance->addValueInstance('email', $userInstance);
+
+ // Add the recipient
+ $mailerInstance->addRecipientByUserInstance($userInstance);
+
+ // Use subject line from template
+ $mailerInstance->useSubjectFromTemplate();
+
+ // Send the email out
+ $mailerInstance->deliverEmail($responseInstance);
+
+ // Send out notification to admin (depends on settings)
+ $mailerInstance->sendAdminNotification($responseInstance);
+ }
+
+ /**
+ * 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) {
+ // Filter for checking if account is unconfirmed
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_filter'));
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A command for Status page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 WebStatusCommand 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 static final function createWebStatusCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebStatusCommand();
+
+ // 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) {
+ // Get the application instance
+ $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+ // Transfer application data
+ $templateInstance->assignApplicationData($applicationInstance);
+
+ // Load the master template
+ $masterTemplate = $applicationInstance->buildMasterTemplateName();
+
+ // 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 status template
+ $templateInstance->loadCodeTemplate('status');
+
+ // Assign the status template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable('status', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_status_title'));
+
+ // Construct the menu in every command. We could do this in BaseCommand class. But this means
+ // *every* command has a navigation system and that is want we don't want.
+ $menuInstance = ObjectFactory::createObjectByConfiguredName('status_menu_class', array($applicationInstance));
+
+ // Render the menu
+ $menuInstance->renderMenu();
+
+ // Transfer it to the template engine instance
+ $menuInstance->transferContentToTemplateEngine($templateInstance);
+
+ /*
+ * ... 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 response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * 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]
+?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A command for ??? page
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @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 Web???Command 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 createWeb???Command (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new Web???Command();
-
- // 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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for the confirmation link handling
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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 WebConfirmCommand 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 static final function createWebConfirmCommand (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new WebConfirmCommand();
-
- // 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
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
-
- // Prepare a template instance
- $templateInstance = $this->prepareTemplateInstance($applicationInstance);
-
- // Assign application data with template engine
- $templateInstance->assignApplicationData($applicationInstance);
-
- // Assign base URL
- $templateInstance->assignConfigVariable('base_url');
-
- // Load the master template
- $masterTemplate = $applicationInstance->buildMasterTemplateName();
-
- // 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 home template
- $templateInstance->loadCodeTemplate('confirm_link');
-
- // Assign the home template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable('confirm_link', 'content');
-
- // Load the master template
- $templateInstance->loadCodeTemplate($masterTemplate);
-
- // Set title
- $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_confirm_link_title'));
-
- // Get user instance
- try {
- $userInstance = Registry::getRegistry()->getInstance('user');
- } catch (NullPointerException $e) {
- // Not found user, e.g. when the user is somehow invalid
- $responseInstance->redirectToConfiguredUrl('html_cmd_user_is_null');
- }
-
- // Set username
- $templateInstance->assignVariable('username', $userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USERNAME));
-
- // Construct the menu in every command. We could do this in BaseCommand class. But this means
- // *every* command has a navigation system and that is want we don't want.
- $menuInstance = ObjectFactory::createObjectByConfiguredName('confirm_menu_class', array($applicationInstance));
-
- // Render the menu
- $menuInstance->renderMenu();
-
- // Transfer it to the template engine instance
- $menuInstance->transferContentToTemplateEngine($templateInstance);
-
- /*
- * ... 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 response class
- $templateInstance->transferToResponse($responseInstance);
- }
-
- /**
- * 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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for the form processor
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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 WebDoFormCommand 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 static final function createWebDoFormCommand (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new WebDoFormCommand();
-
- // 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) {
- // Should never be reached...
- $this->debugBackTrace('This should never be reached.');
- }
-
- /**
- * 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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for the home page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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 WebHomeCommand 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 static final function createWebHomeCommand (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new WebHomeCommand();
-
- // 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
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
-
- // Prepare a template instance
- $templateInstance = $this->prepareTemplateInstance($applicationInstance);
-
- // Transfer application data
- $templateInstance->assignApplicationData($applicationInstance);
-
- // Load the master template
- $masterTemplate = $applicationInstance->buildMasterTemplateName();
-
- // 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 home template
- $templateInstance->loadCodeTemplate('home');
-
- // Assign the home template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable('home', 'content');
-
- // Load the master template
- $templateInstance->loadCodeTemplate($masterTemplate);
-
- // Set title
- $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_home_title'));
-
- // Construct the menu in every command. We could do this in BaseCommand class. But this means
- // *every* command has a navigation system and that is want we don't want.
- $menuInstance = ObjectFactory::createObjectByConfiguredName('home_menu_class', array($applicationInstance));
-
- // Render the menu
- $menuInstance->renderMenu();
-
- // Transfer it to the template engine instance
- $menuInstance->transferContentToTemplateEngine($templateInstance);
-
- /*
- * ... 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 response class
- $templateInstance->transferToResponse($responseInstance);
- }
-
- /**
- * 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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for the login area (member/gamer area)
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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 WebLoginAreaCommand extends BaseCommand implements Commandable {
- /**
- * Name of the action
- */
- private $actionName = '';
-
- /**
- * 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 static final function createWebLoginAreaCommand (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new WebLoginAreaCommand();
-
- // 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
- * @todo Add some stuff here: Some personal data, app/game related data
- */
- protected function prepareCommand () {
- }
-
- /**
- * 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 action instance from registry
- $actionInstance = Registry::getRegistry()->getInstance('action');
-
- // Do we have an action here?
- if ($actionInstance instanceof PerformableAction) {
- // Execute the action (shall not output anything, see below why)
- $actionInstance->execute($requestInstance, $responseInstance);
- } // END - if
-
- // Get the application instance
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
-
- // Prepare a template instance
- $templateInstance = $this->prepareTemplateInstance($applicationInstance);
-
- // Assign base URL
- $templateInstance->assignConfigVariable('base_url');
-
- // Assign all the application's data with template variables
- $templateInstance->assignApplicationData($applicationInstance);
-
- // Load the master template
- $masterTemplate = $applicationInstance->buildMasterTemplateName();
-
- // 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 matching template
- $templateInstance->loadCodeTemplate('action_' . $this->actionName);
-
- // Assign the template with the master template as a content ... ;)
- $templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable('action_' . $this->actionName, 'login_content');
-
- // Load main template
- $templateInstance->loadCodeTemplate('login_main');
-
- // Assign the main template with the master template as a content ... ;)
- $templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable('login_main', 'content');
-
- // Load the master template
- $templateInstance->loadCodeTemplate($masterTemplate);
-
- // Set title
- $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($this->actionName . '_title'));
-
- // Construct the menu in every command. We could do this in BaseCommand class. But this means
- // *every* command has a navigation system and that is want we don't want.
- $menuInstance = ObjectFactory::createObjectByConfiguredName('login_area_menu_class', array($applicationInstance));
-
- // Render the menu
- $menuInstance->renderMenu();
-
- // Transfer it to the template engine instance
- $menuInstance->transferContentToTemplateEngine($templateInstance);
-
- /*
- * ... 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 response class
- $templateInstance->transferToResponse($responseInstance);
- }
-
- /**
- * Adds extra filters to the given controller instance. An corresponding action class must now exist!
- *
- * @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) {
- // Default is no action
- $actionInstance = NULL;
-
- // Get registry
- $registryInstance = Registry::getRegistry();
-
- // Get our application instance from the registry
- $applicationInstance = $registryInstance->getInstance('application');
-
- // Default action is the one from configuration
- $this->actionName = $this->convertDashesToUnderscores($applicationInstance->getAppShortName()) . '_login_' . $this->getConfigInstance()->getConfigEntry('login_default_action');
-
- // Get "action" from request
- $actReq = $requestInstance->getRequestElement('action');
-
- // Do we have a "action" parameter set?
- if ((is_string($actReq)) && (!empty($actReq))) {
- // Then use it with prefix
- $this->actionName = $this->convertDashesToUnderscores($applicationInstance->getAppShortName()) . '_login_' . $actReq;
- } // END - if
-
- // Get application instance
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
-
- // Get a resolver
- $actionResolver = WebActionResolver::createWebActionResolver($this->actionName, $applicationInstance);
-
- // Resolve the action
- $actionInstance = $actionResolver->resolveAction();
-
- // Add more action-specific filters
- $actionInstance->addExtraFilters($controllerInstance, $requestInstance);
-
- // Remember this action in registry
- Registry::getRegistry()->addInstance('action', $actionInstance);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * A command for the login form
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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 WebLoginCommand extends BaseCommand implements Commandable, Registerable {
- /**
- * 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 static final function createWebLoginCommand (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new WebLoginCommand();
-
- // 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) {
- // Set request instance as extra instance
- Registry::getRegistry()->addInstance('extra', $this);
-
- // Get the application instance
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
-
- // Prepare a template instance
- $templateInstance = $this->prepareTemplateInstance($applicationInstance);
-
- // Assign application data with template engine
- $templateInstance->assignApplicationData($applicationInstance);
-
- // Assign base URL
- $templateInstance->assignConfigVariable('base_url');
-
- // Load the master template
- $masterTemplate = $applicationInstance->buildMasterTemplateName();
-
- // 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 home template
- $templateInstance->loadCodeTemplate('login_form');
-
- // Assign the home template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable('login_form', 'content');
-
- // Load the master template
- $templateInstance->loadCodeTemplate($masterTemplate);
-
- // Set title
- $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_login_title'));
-
- // Construct the menu in every command. We could do this in BaseCommand class. But this means
- // *every* command has a navigation system and that is want we don't want.
- $menuInstance = ObjectFactory::createObjectByConfiguredName('login_menu_class', array($applicationInstance));
-
- // Render the menu
- $menuInstance->renderMenu();
-
- // Transfer it to the template engine instance
- $menuInstance->transferContentToTemplateEngine($templateInstance);
-
- /*
- * ... 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 response class
- $templateInstance->transferToResponse($responseInstance);
- }
-
- /**
- * 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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for the login failed page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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 WebLoginFailedCommand 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 static final function createWebLoginFailedCommand (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new WebLoginFailedCommand();
-
- // 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
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
-
- // Prepare a template instance
- $templateInstance = $this->prepareTemplateInstance($applicationInstance);
-
- // Assign application data with template engine
- $templateInstance->assignApplicationData($applicationInstance);
-
- // Load the master template
- $masterTemplate = $applicationInstance->buildMasterTemplateName();
-
- // 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 login_failed template
- $templateInstance->loadCodeTemplate('login_failed');
-
- // Assign the login_failed template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable('login_failed', 'content');
-
- // Load the master template
- $templateInstance->loadCodeTemplate($masterTemplate);
-
- // Set title
- $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('login_failed_title'));
-
- // Assign base URL
- $templateInstance->assignConfigVariable('base_url');
-
- // Construct the menu in every command. We could do this in BaseCommand class. But this means
- // *every* command has a navigation system and that is want we don't want.
- $menuInstance = ObjectFactory::createObjectByConfiguredName('login_failed_menu_class', array($applicationInstance));
-
- // Render the menu
- $menuInstance->renderMenu();
-
- // Transfer it to the template engine instance
- $menuInstance->transferContentToTemplateEngine($templateInstance);
-
- /*
- * ... 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 response class
- $templateInstance->transferToResponse($responseInstance);
- }
-
- /**
- * 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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for logout
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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 WebLogoutCommand 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 static final function createWebLogoutCommand (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new WebLogoutCommand();
-
- // 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 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');
-
- // Exit here
- exit();
- }
-
- /**
- * 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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for the login failed page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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__);
- }
-
- /**
- * Creates an instance of this class
- *
- * @param $resolverInstance An instance of a command resolver class
- * @return $commandInstance An instance a prepared command class
- */
- public static final 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
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
-
- // Prepare a template instance
- $templateInstance = $this->prepareTemplateInstance($applicationInstance);
-
- // Assign application data
- $templateInstance->assignApplicationData($applicationInstance);
-
- // Load the master template
- $masterTemplate = $applicationInstance->buildMasterTemplateName();
-
- // 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');
-
- // Construct the menu in every command. We could do this in BaseCommand class. But this means
- // *every* command has a navigation system and that is want we don't want.
- $menuInstance = ObjectFactory::createObjectByConfiguredName('logout_menu_class', array($applicationInstance));
-
- // Render the menu
- $menuInstance->renderMenu();
-
- // Transfer it to the template engine instance
- $menuInstance->transferContentToTemplateEngine($templateInstance);
-
- /*
- * ... 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 response class
- $templateInstance->transferToResponse($responseInstance);
- }
-
- /**
- * 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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for Problem page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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 WebProblemCommand 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 static final function createWebProblemCommand (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new WebProblemCommand();
-
- // 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]
-?>
+++ /dev/null
-<?php
-/**
- * A command class for the registration form
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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 WebRegisterCommand extends BaseCommand implements Commandable, Registerable {
- /**
- * 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 static final function createWebRegisterCommand (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new WebRegisterCommand();
-
- // 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) {
- // Set request instance as extra instance
- Registry::getRegistry()->addInstance('extra', $this);
-
- // Get the application instance
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
-
- // Prepare a template instance
- $templateInstance = $this->prepareTemplateInstance($applicationInstance);
-
- // Assign all the application's data with template variables
- $templateInstance->assignApplicationData($applicationInstance);
-
- // Assign base URL
- $templateInstance->assignConfigVariable('base_url');
-
- // Load the master template
- $masterTemplate = $applicationInstance->buildMasterTemplateName();
-
- // 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 register template
- $templateInstance->loadCodeTemplate('register_form');
-
- // Assign the register template with the master template as a content ... ;)
- $templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable('register_form', 'content');
-
- // Load the master template
- $templateInstance->loadCodeTemplate($masterTemplate);
-
- // Set title
- $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_register_title'));
-
- // Construct the menu in every command. We could do this in BaseCommand class. But this means
- // *every* command has a navigation system and that is want we don't want.
- $menuInstance = ObjectFactory::createObjectByConfiguredName('register_menu_class', array($applicationInstance));
-
- // Render the menu
- $menuInstance->renderMenu();
-
- // Transfer it to the template engine instance
- $menuInstance->transferContentToTemplateEngine($templateInstance);
-
- /*
- * ... 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 response class
- $templateInstance->transferToResponse($responseInstance);
- }
-
- /**
- * 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 method
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * A command class for resending the confirmation link
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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 WebResendLinkCommand 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 static final function createWebResendLinkCommand (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new WebResendLinkCommand();
-
- // 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 user instance from registry
- $userInstance = Registry::getRegistry()->getInstance('user');
-
- // Get an application instance
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
-
- // Get a RNG instance (Random Number Generator)
- $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
-
- // Generate a pseudo-random string
- $randomString = $rngInstance->randomString(255);
-
- // Get a crypto instance
- $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
-
- // Hash and encrypt the string
- $hashedString = $cryptoInstance->hashString($cryptoInstance->encryptString($randomString));
-
- // Update the user class
- $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH, $hashedString);
-
- // Re-set config entry to mailer engine
- $this->getConfigInstance()->setConfigEntry('html_template_class', $this->getConfigInstance()->getConfigEntry('mail_template_class'));
-
- // Prepare the template engine
- $templateInstance = $this->prepareTemplateInstance($applicationInstance);
-
- // Assign the application data with the template engine
- $templateInstance->assignApplicationData($applicationInstance);
-
- // Get a mailer class
- $mailerInstance = ObjectFactory::createObjectByConfiguredName('mailer_class', array($templateInstance, $applicationInstance, 'resend_link'));
-
- // Set this mailer in our template engine
- $templateInstance->setMailerInstance($mailerInstance);
-
- // Add template variables we shall get
- $mailerInstance->addConfigTemplateVariable('base_url');
- $mailerInstance->addConfigTemplateVariable('admin_email');
- $mailerInstance->addValueTemplateVariable('confirm_hash');
- $mailerInstance->addValueTemplateVariable('username');
- $mailerInstance->addValueTemplateVariable('email');
-
- // Add the value instance for the confirmation hash
- $mailerInstance->addValueInstance('confirm_hash', $userInstance);
- $mailerInstance->addValueInstance('username', $userInstance);
- $mailerInstance->addValueInstance('email', $userInstance);
-
- // Add the recipient
- $mailerInstance->addRecipientByUserInstance($userInstance);
-
- // Use subject line from template
- $mailerInstance->useSubjectFromTemplate();
-
- // Send the email out
- $mailerInstance->deliverEmail($responseInstance);
-
- // Send out notification to admin (depends on settings)
- $mailerInstance->sendAdminNotification($responseInstance);
- }
-
- /**
- * 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) {
- // Filter for checking if account is unconfirmed
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_filter'));
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * A command for Status page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.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 WebStatusCommand 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 static final function createWebStatusCommand (CommandResolver $resolverInstance) {
- // Get new instance
- $commandInstance = new WebStatusCommand();
-
- // 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) {
- // Get the application instance
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
-
- // Prepare a template instance
- $templateInstance = $this->prepareTemplateInstance($applicationInstance);
-
- // Transfer application data
- $templateInstance->assignApplicationData($applicationInstance);
-
- // Load the master template
- $masterTemplate = $applicationInstance->buildMasterTemplateName();
-
- // 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 status template
- $templateInstance->loadCodeTemplate('status');
-
- // Assign the status template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable('status', 'content');
-
- // Load the master template
- $templateInstance->loadCodeTemplate($masterTemplate);
-
- // Set title
- $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_status_title'));
-
- // Construct the menu in every command. We could do this in BaseCommand class. But this means
- // *every* command has a navigation system and that is want we don't want.
- $menuInstance = ObjectFactory::createObjectByConfiguredName('status_menu_class', array($applicationInstance));
-
- // Render the menu
- $menuInstance->renderMenu();
-
- // Transfer it to the template engine instance
- $menuInstance->transferContentToTemplateEngine($templateInstance);
-
- /*
- * ... 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 response class
- $templateInstance->transferToResponse($responseInstance);
- }
-
- /**
- * 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]
-?>