application/ship-simu/main/commands/web/class_WebShipsimuRefillCommand.php -text
application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php -text
application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php -text
+application/ship-simu/main/commands/web/company/.htaccess -text
+application/ship-simu/main/commands/web/company/class_WebShipSimuCompanyCommand.php -text
application/ship-simu/main/commands/web/government/.htaccess -text
application/ship-simu/main/commands/web/government/class_WebGovernmentFailedStartupCommand.php -text
application/ship-simu/main/commands/web/government/class_WebShipsimuGovernmentStartupCommand.php -text
application/ship-simu/main/constructions/yards/class_Shipyard.php -text
application/ship-simu/main/controller/.htaccess -text
application/ship-simu/main/controller/web/.htaccess -text
+application/ship-simu/main/controller/web/class_WebCompanyController.php -text
application/ship-simu/main/controller/web/class_WebGovernmentFailedController.php -text
application/ship-simu/main/drives/.htaccess -text
application/ship-simu/main/drives/class_BaseDrive.php -text
application/ship-simu/main/menu/class_ShipSimuHomeMenu.php -text
application/ship-simu/main/menu/class_ShipSimuLoginAreaMenu.php -text
application/ship-simu/main/menu/class_ShipSimuLoginMenu.php -text
+application/ship-simu/main/menu/class_ShipSimuLogoutMenu.php -text
application/ship-simu/main/menu/class_ShipSimuRegisterMenu.php -text
application/ship-simu/main/parts/.htaccess -text
application/ship-simu/main/parts/class_BaseShipPart.php -text
application/ship-simu/main/registration/class_ShipSimuRegistration.php -text
application/ship-simu/main/resolver/.htaccess -text
application/ship-simu/main/resolver/web/.htaccess -text
+application/ship-simu/main/resolver/web/class_WebCompanyCommandResolver.php -text
application/ship-simu/main/resolver/web/class_WebGovernmentFailedCommandResolver.php -text
application/ship-simu/main/ships/.htaccess -text
application/ship-simu/main/ships/class_BaseShip.php -text
$cfg->setConfigEntry('login_default_action', "welcome");
// CFG: LOGIN-AREA-LOGOUT-ACTION
-$cfg->setConfigEntry('login_area_logout_action', "logout");
+$cfg->setConfigEntry('login_area_logout_action', "index.php?app={?app_short_name?}&page=login_area&page=logout");
// CFG: LOGIN-AREA-PROFILE-ACTION
-$cfg->setConfigEntry('login_area_profile_action', "profile");
+$cfg->setConfigEntry('login_area_profile_action', "index.php?app={?app_short_name?}&page=login_area&page=profile");
// CFG: LOGIN-AREA-COMPANY-ACTION
-$cfg->setConfigEntry('login_area_company_action', "company");
+$cfg->setConfigEntry('login_area_company_action', "index.php?app={?app_short_name?}&page=login_area");
+
+// CFG: LOGIN-AREA-LIST-COMPANIES-ACTION
+$cfg->setConfigEntry('login_area_list_companies_action', "index.php?app={?app_short_name?}&page=login_area");
+
+// CFG: LOGOUT_DONE-RELOGIN-ACTION
+$cfg->setConfigEntry('logout_done_relogin_action', "index.php?app={?app_short_name?}&page=login");
+
+// CFG: LOGIN-REGISTER-ACTION
+$cfg->setConfigEntry('login_register_action', "index.php?app={?app_short_name?}&page=register");
// CFG: NEWS-READER-HOME-CLASS
$cfg->setConfigEntry('news_reader_home_class', "DefaultNewsReader");
// CFG: WEB-CMD-GOVERNMENT-FAILED-RESOLVER-CLASS
$cfg->setConfigEntry('web_cmd_government_failed_resolver_class', "WebGovernmentFailedCommandResolver");
+// CFG: WEB-CMD-COMPANY-RESOLVER-CLASS
+$cfg->setConfigEntry('web_cmd_company_resolver_class', "WebCompanyCommandResolver");
+
// CFG: REFILL-REQUEST-CURRENCY-PAYMENT-TYPE
$cfg->setConfigEntry('refill_request_currency_payment_type', "test");
// CFG: LOGIN-MENU-CLASS
$cfg->setConfigEntry('login_menu_class', "ShipSimuLoginMenu");
+// CFG: LOGOUT-MENU-CLASS
+$cfg->setConfigEntry('logout_menu_class', "ShipSimuLogoutMenu");
+
// CFG: REGISTER-MENU-CLASS
$cfg->setConfigEntry('register_menu_class', "ShipSimuRegisterMenu");
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command for the money refill page
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebShipSimuCompanyCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Creates an instance of this command and sets the resolver instance
+ *
+ * @param $resolverInstance An instance of a command resolver
+ * @return $commandInstance The created command instance
+ */
+ public final static function createWebShipSimuCompanyCommand (CommandResolver $resolverInstance) {
+ // Get a new instance
+ $commandInstance = new WebShipSimuCompanyCommand();
+
+ // Set the resolver instance
+ $commandInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $commandInstance;
+ }
+
+ /**
+ * Executes the command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get template instance
+ $templateInstance = $responseInstance->getTemplateInstance();
+
+ // Set amount and type as variables
+ $templateInstance->assignVariable('refill_done', $requestInstance->getRequestElement('type'));
+ $templateInstance->assignVariable('amount' , $requestInstance->getRequestElement('amount'));
+
+ // This method does currently redirect if all goes right
+ $responseInstance->redirectToConfiguredUrl('refill_page_done');
+ }
+
+ /**
+ * 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 user auth filter (we don't need an update of the user here because it will be redirected)
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter'));
+
+ // Add user status filter here
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Controller for failed government requests
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebCompanyController extends BaseController implements Controller {
+ /**
+ * 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 $controllerInstance A prepared instance of this class
+ * @todo Add some filters to this controller
+ */
+ public final static function createWebCompanyController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new WebCompanyController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // User auth filter
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter'));
+
+ // User update filter
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter'));
+
+ // News fetcher filter
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter'));
+
+ // News proccess/display-preparation
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter'));
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance from the resolver by sending a request instance to the resolver
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // Add more filters by the command
+ $commandInstance->addExtraFilters($this, $requestInstance);
+
+ // Try to run the pre filters, if auth exceptions come through redirect here
+ try {
+ // Run the pre filters
+ $this->executePreFilters($requestInstance, $responseInstance);
+ } catch (UserAuthorizationException $e) {
+ // Redirect to main page
+ $responseInstance->redirectToConfiguredUrl('login_failed');
+
+ // Exit here
+ exit();
+ }
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Run the pre filters
+ $this->executePostFilters($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ShipSimuLogoutMenu extends BaseMenu implements RenderableMenu {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $menuInstance An instance of this class
+ */
+ public final static function createShipSimuLogoutMenu () {
+ // Get a new instance
+ $menuInstance = new ShipSimuLogoutMenu();
+
+ // Return the prepared instance
+ return $menuInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A command resolver for local (non-hubbed) web commands including the failed government request
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebCompanyCommandResolver extends BaseCommandResolver implements CommandResolver {
+ /**
+ * Last successfull resolved command
+ */
+ private $lastCommandInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set prefix to "Web"
+ $this->setCommandPrefix('Web');
+ }
+
+ /**
+ * Creates an instance of a Web command resolver with a given default command
+ *
+ * @param $commandName The default command we shall execute
+ * @param $appInstance An instance of a manageable application helper class
+ * @return $resolverInstance The prepared command resolver instance
+ * @throws EmptyVariableException Thrown if default command is not set
+ * @throws InvalidInterfaceException Thrown if command does not implement interface Commandable
+ */
+ public final static function createWebCompanyCommandResolver ($commandName, ManageableApplication $appInstance) {
+ // Create the new instance
+ $resolverInstance = new WebCompanyCommandResolver();
+
+ // Get request instance
+ $requestInstance = $appInstance->getRequestInstance();
+
+ // Is the variable $commandName set and the command is valid?
+ if (empty($commandName)) {
+ // Then thrown an exception here
+ throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!$resolverInstance->resolveCommandByRequest($requestInstance) instanceof Commandable) {
+ // Invalid command found (missing interface?)
+ throw new InvalidInterfaceException(array($userInstance, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING);
+ }
+
+ // Set the application instance
+ $resolverInstance->setApplicationInstance($appInstance);
+
+ // Return the prepared instance
+ return $resolverInstance;
+ }
+
+ /**
+ * Returns an command instance for a given request class or null if
+ * it was not found
+ *
+ * @param $requestInstance An instance of a request class
+ * @return $commandInstance An instance of the resolved command
+ * @throws InvalidCommandException Thrown if $commandName is
+ * invalid
+ * @throws InvalidCommandInstanceException Thrown if $commandInstance
+ * is an invalid instance
+ */
+ public function resolveCommandByRequest (Requestable $requestInstance) {
+ // Init instance
+ $commandInstance = null;
+
+ // This goes fine so let's resolv the command
+ $commandName = str_replace('-', '_', $requestInstance->getRequestElement('app')) . '_' . $requestInstance->getRequestElement('page');
+
+ // Is there a "failed" request?
+ if ($requestInstance->isRequestElementSet('failed')) {
+ // Then include with within the command name
+ $commandName = $commandName . '_' . $requestInstance->getRequestElement('failed');
+ } // END - if
+
+ // Is the command empty? Then fall back to default command
+ if (empty($commandName)) $commandName = $this->getConfigInstance()->getConfigEntry('default_web_command');
+
+ // Check if command is valid
+ if ($this->isCommandValid($commandName) === false) {
+ // This command is invalid!
+ throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
+
+ // Get the command
+ $commandInstance = $this->loadCommand($commandName);
+
+ // And validate it
+ if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) {
+ // This command has an invalid instance!
+ throw new InvalidCommandInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
+
+ // Set last command
+ $this->lastCommandInstance = $commandInstance;
+
+ // Return the resolved command instance
+ return $commandInstance;
+ }
+
+ /**
+ * Resolves the command by its direct name and returns an instance of its class
+ *
+ * @param $commandName The direct command name we shall resolve
+ * @return $commandInstance An instance of the command class
+ * @throws InvalidCommandException Thrown if $commandName is invalid
+ */
+ public function resolveCommand ($commandName) {
+ // Initiate the instance variable
+ $commandInstance = null;
+
+ // Is the command empty? Then fall back to default command
+ if (empty($commandName)) $commandName = $this->getConfigInstance()->getConfigEntry('default_web_command');
+
+ // Check if command is valid
+ if ($this->isCommandValid($commandName) === false) {
+ // This command is invalid!
+ throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ }
+
+ // Get the command
+ $commandInstance = $this->loadCommand($commandName);
+
+ // Return the instance
+ return $commandInstance;
+ }
+
+ /**
+ * "Loads" a given command and instances it if not yet cached
+ *
+ * @param $commandName A command name we shall look for
+ * @return $commandInstance A loaded command instance
+ * @throws InvalidCommandException Thrown if even the default
+ * command class is missing (bad!)
+ */
+ private function loadCommand ($commandName) {
+ // Cache default command
+ $defaultCommand = $this->getConfigInstance()->getConfigEntry('default_web_command');
+
+ // Init command instance
+ $commandInstance = null;
+
+ // Get 'app' from the application
+ $app = Registry::getRegistry()->getInstance('application')->getRequestInstance()->getRequestElement('app');
+
+ // Create command class name
+ $this->setClassName(sprintf("%s%sCommand",
+ $this->getCommandPrefix(),
+ $this->convertToClassName($commandName)
+ ));
+
+ // Is this class loaded?
+ if (!class_exists($this->getClassName())) {
+ // Class not found, so throw an exception
+ throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
+
+ // Initiate the command
+ $commandInstance = ObjectFactory::createObjectByName($this->getClassName(), array($this));
+
+ // Return the result
+ return $commandInstance;
+ }
+}
+
+// [EOF]
+?>
parent::__construct(__CLASS__);
// Set prefix to "Web"
- $this->setCommandPrefix("Web");
+ $this->setCommandPrefix('Web');
}
/**
$commandInstance = null;
// Create command class name
- $this->setClassName(sprintf("Web%sCommand",
+ $this->setClassName(sprintf("%s%sCommand",
+ $this->getCommandPrefix(),
$this->convertToClassName($commandName)
));
<?php
// Get a link helper instance
-$linkInstance = ObjectFactory::createObjectByConfiguredName('web_link_helper', array($this, 'companys'));
+$linkInstance = ObjectFactory::createObjectByConfiguredName('web_link_helper', array($this, 'list_companies'));
// Prefetch the user data
$linkInstance->prefetchValueInstance('user');
</div>
<div class="table_footer">
- {?companys?}
+ {?list_companies?}
</div>
</div>
}
// Get helper instance
-$helperInstance = ObjectFactory::createObjectByConfiguredName('web_link_helper', array($this, 'register_login_form'));
+$helperInstance = ObjectFactory::createObjectByConfiguredName('web_link_helper', array($this, 'register'));
// Set link text
$helperInstance->addLinkWithTextById('register_login');
</div>
<div id="content_footer">
- Noch kein Spieleaccount? {?register_login_form?}
+ Noch kein Spieleaccount? {?register?}
</div>