From: Roland Häder Date: Sun, 19 Jul 2009 15:58:26 +0000 (+0000) Subject: Filters/commands added, missing config entries added X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=87182026c240081921f6f4a75a36a02baf70c9bd;p=hub.git Filters/commands added, missing config entries added --- diff --git a/.gitattributes b/.gitattributes index 024efc0db..7c7f796bf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -36,6 +36,9 @@ application/hub/main/.htaccess -text application/hub/main/class_ -text application/hub/main/class_Base -text application/hub/main/class_BaseHubSystem.php -text +application/hub/main/commands/.htaccess -text +application/hub/main/commands/console/.htaccess -text +application/hub/main/commands/console/class_ConsoleMainCommand.php -text application/hub/main/connectors/.htaccess -text application/hub/main/connectors/class_BaseConnector.php -text application/hub/main/connectors/query/.htaccess -text @@ -51,6 +54,12 @@ application/hub/main/connectors/queues/local/class_LocalQueueConnector.php -text application/hub/main/database/.htaccess -text application/hub/main/database/wrapper/.htaccess -text application/hub/main/database/wrapper/class_NodeInformationDatabaseWrapper.php -text +application/hub/main/filter/.htaccess -text +application/hub/main/filter/bootstrap/.htaccess -text +application/hub/main/filter/bootstrap/class_Bootstrap -text +application/hub/main/filter/console/.htaccess -text +application/hub/main/filter/console/class_Console -text +application/hub/main/filter/console/class_ConsoleWelcomeTeaserFilter.php -text application/hub/main/listener/.htaccess -text application/hub/main/listener/class_ -text application/hub/main/listener/class_BaseListener.php -text @@ -100,6 +109,7 @@ application/hub/main/states/hub/class_BaseHubState.php -text application/hub/starter.php -text /clear-cache.sh -text db/.htaccess -text +db/news/.htaccess -text db/node_data/.htaccess -text docs/COPYING -text docs/COPYING.documents -text diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index bc1f8c954..96d955ace 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -182,7 +182,11 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica // If it is null then get default command if (is_null($commandName)) { + // Get default command $commandName = $responseInstance->getDefaultCommand(); + + // Set it in request + $requestInstance->setRequestElement('command', $commandName); } // END - if // Get a resolver diff --git a/application/hub/config.php b/application/hub/config.php index da92087de..f8e54313d 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -87,5 +87,20 @@ $cfg->setConfigEntry('default_console_command', "main"); // CFG: CONSOLE-CMD-RESOLVER-CLASS $cfg->setConfigEntry('console_cmd_resolver_class', "ConsoleCommandResolver"); +// CFG: NEWS-DOWNLOAD-FILTER +$cfg->setConfigEntry('news_download_filter', "NewsDownloadFilter"); + +// CFG: NEWS-PROCESS-FILTER +$cfg->setConfigEntry('news_process_filter', "NewsProcessFilter"); + +// CFG: CONSOLE-WELCOME-TEASER-FILTER +$cfg->setConfigEntry('console_welcome_teaser_filter', "ConsoleWelcomeTeaserFilter"); + +// CFG: NEWS-READER-CLASS +$cfg->setConfigEntry('news_reader_class', "ConsoleNewsReader"); + +// CFG: NEWS-MAIN-LIMIT +$cfg->setConfigEntry('news_main_limit', 5); + // [EOF] ?> diff --git a/application/hub/main/commands/.htaccess b/application/hub/main/commands/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/commands/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/commands/console/.htaccess b/application/hub/main/commands/console/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/commands/console/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/commands/console/class_ConsoleMainCommand.php b/application/hub/main/commands/console/class_ConsoleMainCommand.php new file mode 100644 index 000000000..4ce11a581 --- /dev/null +++ b/application/hub/main/commands/console/class_ConsoleMainCommand.php @@ -0,0 +1,78 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 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 ConsoleMainCommand 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 createConsoleMainCommand (CommandResolver $resolverInstance) { + // Get new instance + $commandInstance = new ConsoleMainCommand(); + + // 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) { + // Add filters + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('console_welcome_teaser_filter')); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/.htaccess b/application/hub/main/filter/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/filter/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/filter/bootstrap/.htaccess b/application/hub/main/filter/bootstrap/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/filter/bootstrap/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/filter/bootstrap/class_Bootstrap b/application/hub/main/filter/bootstrap/class_Bootstrap new file mode 100644 index 000000000..9e509f68d --- /dev/null +++ b/application/hub/main/filter/bootstrap/class_Bootstrap @@ -0,0 +1,63 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 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 ???BootstrapFilter extends BaseFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public final static function create???BootstrapFilter () { + // Get a new instance + $filterInstance = new ???BootstrapFilter(); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter 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) { + // Implement this! + $this->partialStub("Please implement this method."); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/console/.htaccess b/application/hub/main/filter/console/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/filter/console/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/filter/console/class_Console b/application/hub/main/filter/console/class_Console new file mode 100644 index 000000000..d6565af8a --- /dev/null +++ b/application/hub/main/filter/console/class_Console @@ -0,0 +1,63 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 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 Console???Filter extends BaseFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public final static function createConsole???Filter () { + // Get a new instance + $filterInstance = new Console???Filter(); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter 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) { + // Implement this! + $this->partialStub("Please implement this method."); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/console/class_ConsoleWelcomeTeaserFilter.php b/application/hub/main/filter/console/class_ConsoleWelcomeTeaserFilter.php new file mode 100644 index 000000000..1f889d0c0 --- /dev/null +++ b/application/hub/main/filter/console/class_ConsoleWelcomeTeaserFilter.php @@ -0,0 +1,63 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 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 ConsoleWelcomeTeaserFilter extends BaseFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public final static function createConsoleWelcomeTeaserFilter () { + // Get a new instance + $filterInstance = new ConsoleWelcomeTeaserFilter(); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter 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) { + // Implement this! + $this->partialStub("Please implement this method."); + } +} + +// [EOF] +?> diff --git a/db/news/.htaccess b/db/news/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/db/news/.htaccess @@ -0,0 +1 @@ +Deny from all