From: Roland Haeder Date: Sun, 5 Apr 2015 21:19:45 +0000 (+0200) Subject: Renamed classes. X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=d27364a3d92a9c82e162f8069acce3f4b822ae54 Renamed classes. Signed-off-by: Roland Häder --- diff --git a/inc/classes/main/commands/html/.htaccess b/inc/classes/main/commands/html/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/main/commands/html/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/commands/html/class_Html b/inc/classes/main/commands/html/class_Html new file mode 100644 index 00000000..00341240 --- /dev/null +++ b/inc/classes/main/commands/html/class_Html @@ -0,0 +1,77 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlConfirmCommand.php b/inc/classes/main/commands/html/class_HtmlConfirmCommand.php new file mode 100644 index 00000000..7c3d3ec9 --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlConfirmCommand.php @@ -0,0 +1,146 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlDoFormCommand.php b/inc/classes/main/commands/html/class_HtmlDoFormCommand.php new file mode 100644 index 00000000..3ad014bb --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlDoFormCommand.php @@ -0,0 +1,78 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlHomeCommand.php b/inc/classes/main/commands/html/class_HtmlHomeCommand.php new file mode 100644 index 00000000..3eb7790f --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlHomeCommand.php @@ -0,0 +1,132 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlLoginAreaCommand.php b/inc/classes/main/commands/html/class_HtmlLoginAreaCommand.php new file mode 100644 index 00000000..73af08bf --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlLoginAreaCommand.php @@ -0,0 +1,203 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlLoginCommand.php b/inc/classes/main/commands/html/class_HtmlLoginCommand.php new file mode 100644 index 00000000..a594a8c7 --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlLoginCommand.php @@ -0,0 +1,138 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlLoginFailedCommand.php b/inc/classes/main/commands/html/class_HtmlLoginFailedCommand.php new file mode 100644 index 00000000..60ea219c --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlLoginFailedCommand.php @@ -0,0 +1,135 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlLogoutCommand.php b/inc/classes/main/commands/html/class_HtmlLogoutCommand.php new file mode 100644 index 00000000..99b9747f --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlLogoutCommand.php @@ -0,0 +1,89 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlLogoutDoneCommand.php b/inc/classes/main/commands/html/class_HtmlLogoutDoneCommand.php new file mode 100644 index 00000000..269f19a8 --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlLogoutDoneCommand.php @@ -0,0 +1,135 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlProblemCommand.php b/inc/classes/main/commands/html/class_HtmlProblemCommand.php new file mode 100644 index 00000000..7adb9ce7 --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlProblemCommand.php @@ -0,0 +1,77 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlRegisterCommand.php b/inc/classes/main/commands/html/class_HtmlRegisterCommand.php new file mode 100644 index 00000000..de17bc33 --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlRegisterCommand.php @@ -0,0 +1,139 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlResendLinkCommand.php b/inc/classes/main/commands/html/class_HtmlResendLinkCommand.php new file mode 100644 index 00000000..37dfe803 --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlResendLinkCommand.php @@ -0,0 +1,135 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/html/class_HtmlStatusCommand.php b/inc/classes/main/commands/html/class_HtmlStatusCommand.php new file mode 100644 index 00000000..3946c822 --- /dev/null +++ b/inc/classes/main/commands/html/class_HtmlStatusCommand.php @@ -0,0 +1,133 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/main/commands/web/.htaccess b/inc/classes/main/commands/web/.htaccess deleted file mode 100644 index 3a428827..00000000 --- a/inc/classes/main/commands/web/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/inc/classes/main/commands/web/class_ b/inc/classes/main/commands/web/class_ deleted file mode 100644 index 1dc5ddac..00000000 --- a/inc/classes/main/commands/web/class_ +++ /dev/null @@ -1,77 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebConfirmCommand.php b/inc/classes/main/commands/web/class_WebConfirmCommand.php deleted file mode 100644 index 7c3d3ec9..00000000 --- a/inc/classes/main/commands/web/class_WebConfirmCommand.php +++ /dev/null @@ -1,146 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebDoFormCommand.php b/inc/classes/main/commands/web/class_WebDoFormCommand.php deleted file mode 100644 index 3ad014bb..00000000 --- a/inc/classes/main/commands/web/class_WebDoFormCommand.php +++ /dev/null @@ -1,78 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebHomeCommand.php b/inc/classes/main/commands/web/class_WebHomeCommand.php deleted file mode 100644 index 3eb7790f..00000000 --- a/inc/classes/main/commands/web/class_WebHomeCommand.php +++ /dev/null @@ -1,132 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebLoginAreaCommand.php b/inc/classes/main/commands/web/class_WebLoginAreaCommand.php deleted file mode 100644 index 73af08bf..00000000 --- a/inc/classes/main/commands/web/class_WebLoginAreaCommand.php +++ /dev/null @@ -1,203 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebLoginCommand.php b/inc/classes/main/commands/web/class_WebLoginCommand.php deleted file mode 100644 index a594a8c7..00000000 --- a/inc/classes/main/commands/web/class_WebLoginCommand.php +++ /dev/null @@ -1,138 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebLoginFailedCommand.php b/inc/classes/main/commands/web/class_WebLoginFailedCommand.php deleted file mode 100644 index 60ea219c..00000000 --- a/inc/classes/main/commands/web/class_WebLoginFailedCommand.php +++ /dev/null @@ -1,135 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebLogoutCommand.php b/inc/classes/main/commands/web/class_WebLogoutCommand.php deleted file mode 100644 index 99b9747f..00000000 --- a/inc/classes/main/commands/web/class_WebLogoutCommand.php +++ /dev/null @@ -1,89 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebLogoutDoneCommand.php b/inc/classes/main/commands/web/class_WebLogoutDoneCommand.php deleted file mode 100644 index 269f19a8..00000000 --- a/inc/classes/main/commands/web/class_WebLogoutDoneCommand.php +++ /dev/null @@ -1,135 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebProblemCommand.php b/inc/classes/main/commands/web/class_WebProblemCommand.php deleted file mode 100644 index 7adb9ce7..00000000 --- a/inc/classes/main/commands/web/class_WebProblemCommand.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebRegisterCommand.php b/inc/classes/main/commands/web/class_WebRegisterCommand.php deleted file mode 100644 index de17bc33..00000000 --- a/inc/classes/main/commands/web/class_WebRegisterCommand.php +++ /dev/null @@ -1,139 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebResendLinkCommand.php b/inc/classes/main/commands/web/class_WebResendLinkCommand.php deleted file mode 100644 index 37dfe803..00000000 --- a/inc/classes/main/commands/web/class_WebResendLinkCommand.php +++ /dev/null @@ -1,135 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/inc/classes/main/commands/web/class_WebStatusCommand.php b/inc/classes/main/commands/web/class_WebStatusCommand.php deleted file mode 100644 index 3946c822..00000000 --- a/inc/classes/main/commands/web/class_WebStatusCommand.php +++ /dev/null @@ -1,133 +0,0 @@ - - * @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 . - */ -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] -?>