inc/classes/main/controller/form/.htaccess -text
inc/classes/main/controller/form/class_WebDoFormController.php -text
inc/classes/main/controller/form/class_WebLoginAreaController.php -text
+inc/classes/main/controller/image/.htaccess -text
+inc/classes/main/controller/image/class_ImageDefaultController.php -text
inc/classes/main/controller/login/.htaccess -text
inc/classes/main/controller/login/class_WebLoginAreaController.php -text
inc/classes/main/controller/web/.htaccess -text
inc/classes/main/resolver/class_BaseResolver.php -text
inc/classes/main/resolver/command/.htaccess -text
inc/classes/main/resolver/command/class_BaseCommandResolver.php -text
+inc/classes/main/resolver/command/image/.htaccess -text
+inc/classes/main/resolver/command/image/class_ImageCommandResolver.php -text
inc/classes/main/resolver/command/web/.htaccess -text
inc/classes/main/resolver/command/web/class_WebCommandResolver.php -text
inc/classes/main/resolver/controller/.htaccess -text
inc/classes/main/resolver/controller/class_BaseControllerResolver.php -text
+inc/classes/main/resolver/controller/image/.htaccess -text
+inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php -text
inc/classes/main/resolver/controller/web/.htaccess -text
inc/classes/main/resolver/controller/web/class_WebControllerResolver.php -text
inc/classes/main/response/.htaccess -text
// If it is null then get default command
if (is_null($commandName)) {
- $commandName = $this->getConfigInstance()->readConfig('default_command');
+ $commandName = $responseInstance->getDefaultCommand();
} // END - if
// Get a resolver
// Walk through all messages
foreach ($messageList as $message) {
print("MSG:".$message."<br />\n");
- }
+ } // END - if
}
}
// Get a configuration instance for shorter lines
$cfg = FrameworkConfiguration::getInstance();
-// CFG: DEFAULT-COMMAND
-$cfg->setConfigEntry('default_command', "home");
+// CFG: DEFAULT-WEB-COMMAND
+$cfg->setConfigEntry('default_web_command', "home");
+
+// CFG: DEFAULT-IMAGE-COMMAND
+$cfg->setConfigEntry('default_image_command', "build");
// CFG: PAGE-WITH-NEWS
$cfg->setConfigEntry('page_with_news', "home");
// [EOF]
?>
<div class="captcha_image">
- <img src="$config[base_url]/index.php?app=ship-simu&page=captcha_image&encrypt={?encrypted_code?}&response=image" alt="CAPTCHA-Bild" title="CAPTCHA-Bild" class="captcha_img" />
+ <img src="$config[base_url]/index.php?app=ship-simu&page=code_captcha&encrypt={?encrypted_code?}&response=image" alt="CAPTCHA-Bild" title="CAPTCHA-Bild" class="captcha_img" />
</div>
<div class="captcha_code">
{?captcha_code?}
$this->getLine()
);
+ // Set extra data
+ $this->setExtraData($resolverInstance->getClassName());
+
// Call parent contructor with message
parent::__construct($message, $code);
}
*/
public function __construct(array $msgArray, $code) {
// Prepare the message
- $message = sprintf("[%s:%d] Cannot resolve controller <span id=\"exception_reason\">%s</span>.",
+ $message = sprintf("[%s:%d] Cannot resolve controller <span id=\"exception_reason\">%s (class name: %s)</span>.",
$msgArray[0]->__toString(),
$this->getLine(),
- $msgArray[1]
+ $msgArray[1],
+ $msgArray[0]->getClassName()
);
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName());
+
// Call parent contructor with message
parent::__construct($message, $code);
}
$classArray[1]
);
+ // Set extra data
+ $this->setExtraData($classArray[1]);
+
// Call parent constructor
parent::__construct($message, $code);
}
$msgArray[0]->getClassName()
);
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName());
+
// Call parent constructor
parent::__construct($message, $code);
}
const EXCEPTION_MISSING_FILE_IO_HANDLER = 0x02f;
const EXCEPTION_MISSING_ELEMENT = 0x030;
const EXCEPTION_HEADERS_ALREADY_SENT = 0x031;
- const EXCEPTION_DEFAUL_CONTROLLER_GONE = 0x032;
+ const EXCEPTION_DEFAULT_CONTROLLER_GONE = 0x032;
const EXCEPTION_CLASS_NOT_FOUND = 0x033;
const EXCEPTION_REQUIRED_INTERFACE_MISSING = 0x034;
const EXCEPTION_FATAL_ERROR = 0x035;
* 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 Controller extends BaseController implements Controller {
+class ???Controller extends BaseController implements Controller {
/**
* Protected constructor
*
parent::__construct(__CLASS__);
// Set part description
- $this->setObjectDescription("Ein spezieller Controller");
+ $this->setObjectDescription("");
// Create unique ID number
$this->generateUniqueId();
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ */
+ public final static function create???Controller (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new ???Controller();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // 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
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
- // Clean up a little
- $this->removeSystemArray();
+ // Flush the response out
+ $responseInstance->flushBuffer();
}
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A default controller for images
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ImageDefaultController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("Default image controller");
+
+ // Create unique ID number
+ $this->generateUniqueId();
+
+ // Clean up a little
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ */
+ public final static function createImageDefaultController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new ImageDefaultController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // 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
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
<?php
/**
- * The default controller for all other requests
+ * The default controller for all other web requests
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
parent::__construct(__CLASS__);
// Set part description
- $this->setObjectDescription("Default controller for all other requests");
+ $this->setObjectDescription("Default controller for all other web requests");
// Create unique ID number
$this->generateUniqueId();
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command resolver for local (non-hubbed) image commands
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ImageCommandResolver 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 part description
+ $this->setObjectDescription("Resolver for local image commands");
+
+ // Create unique ID number
+ $this->generateUniqueId();
+
+ // Set prefix to "Image"
+ $this->setCommandPrefix("Image");
+ }
+
+ /**
+ * Creates an instance of a Image 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 the default command is not set
+ * @throws InvalidCommandException Thrown if the default command is invalid
+ */
+ public final static function createImageCommandResolver ($commandName, ManageableApplication $appInstance) {
+ // Create the new instance
+ $resolverInstance = new ImageCommandResolver();
+
+ // 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->isCommandValid($commandName)) {
+ // Invalid command found
+ throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ }
+
+ // 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 variables
+ $commandName = "";
+ $commandInstance = null;
+
+ // This goes fine so let's resolv the command
+ $commandName = $requestInstance->getRequestElement('page');
+
+ // Is the command empty? Then fall back to default command
+ if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_image_command');
+
+ // Check if the command is valid
+ if (!$this->isCommandValid($commandName)) {
+ // This command is invalid!
+ throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
+
+ // Get the command
+ $commandInstance = $this->loadCommand($commandName);
+
+ // 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()->readConfig('default_image_command');
+
+ // Check if the command is valid
+ if (!$this->isCommandValid($commandName)) {
+ // This command is invalid!
+ throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ }
+
+ // 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()->readConfig('default_image_command');
+
+ // Init command instance
+ $commandInstance = null;
+
+ // Create command class name
+ $this->setClassName(sprintf("Image%sCommand",
+ $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]
+?>
<?php
/**
- * A command resolver for local (non-hubbed) commands
+ * A command resolver for local (non-hubbed) web commands
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
// Is the variable $commandName set and the command is valid?
if (empty($commandName)) {
// Then thrown an exception here
- throw new EmptyVariableException(array($resolverInstance, 'defaultCommand'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (!$resolverInstance->isCommandValid($commandName)) {
// Invalid command found
throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
$commandName = $requestInstance->getRequestElement('page');
// Is the command empty? Then fall back to default command
- if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_command');
+ if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
// Check if the command is valid
if (!$this->isCommandValid($commandName)) {
$commandInstance = null;
// Is the command empty? Then fall back to default command
- if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_command');
+ if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
// Check if the command is valid
if (!$this->isCommandValid($commandName)) {
*/
private function loadCommand ($commandName) {
// Cache default command
- $defaultCommand = $this->getConfigInstance()->readConfig('default_command');
+ $defaultCommand = $this->getConfigInstance()->readConfig('default_web_command');
// Init command instance
$commandInstance = null;
// Is this class loaded?
if (!class_exists($this->getClassName())) {
- // Class not found, so try the default one or throw exception
- if ($commandName != $defaultCommand) {
- // Try the default command
- return $this->loadCommand($defaultCommand);
- } else {
- // Still not found?
- throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
- }
+ // Class not found, so throw an exception
+ throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
} // END - if
// Initiate the command
/**
* Setter for controller name
*
- * @param $controllerName Last validated controller name
+ * @param $controllerName Last validated controller name
* @return void
*/
protected final function setControllerName ($controllerName) {
*
* @return $controllerName Last validated controller name
*/
- protected final function getControllerName () {
+ public final function getControllerName () {
return $this->controllerName;
}
/**
* Checks wether the given controller is valid
*
- * @param $controllerName The default controller we shall execute
- * @return $isValid Wether the given controller is valid
+ * @param $controllerName The default controller we shall execute
+ * @return $isValid Wether the given controller is valid
* @throws EmptyVariableException Thrown if the given controller is not set
+ * @throws DefaultControllerException If the default controller was not found
*/
public function isControllerValid ($controllerName) {
// By default nothing shall be valid
}
} else {
// All is tried, give it up here
- throw new DefaultControllerException($this, self::EXCEPTION_DEFAUL_CONTROLLER_GONE);
+ throw new DefaultControllerException($this, self::EXCEPTION_DEFAULT_CONTROLLER_GONE);
}
} // END - while
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A resolver for resolving controllers locally
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ImageControllerResolver extends BaseControllerResolver implements ControllerResolver {
+ /**
+ * Last successfull resolved controller (name)
+ */
+ private $lastControllerName = "";
+
+ /**
+ * Last successfull resolved controller (instance)
+ */
+ private $lastControllerInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("Resolver for local web controllers");
+
+ // Create unique ID number
+ $this->generateUniqueId();
+
+ // Set prefix to "Image"
+ $this->setControllerPrefix("Image");
+ }
+
+ /**
+ * Creates an instance of a resolver class with a given command
+ *
+ * @param $controllerName The controller we shall resolve
+ * @param $appInstance An instance of a manageable application helper class
+ * @return $resolverInstance The prepared controller resolver instance
+ * @throws EmptyVariableException Thrown if the default command is not set
+ * @throws InvalidControllerException Thrown if the default controller is invalid
+ */
+ public final static function createImageControllerResolver ($controllerName, ManageableApplication $appInstance) {
+ // Create the new instance
+ $resolverInstance = new ImageControllerResolver();
+
+ // Is the variable $controllerName set and the command is valid?
+ if (empty($controllerName)) {
+ // Then thrown an exception here
+ throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!$resolverInstance->isControllerValid($controllerName)) {
+ // Invalid command found
+ throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+ }
+
+ // Set the application instance
+ $resolverInstance->setApplicationInstance($appInstance);
+
+ // Set command name
+ $resolverInstance->setControllerName($controllerName);
+
+ // Return the prepared instance
+ return $resolverInstance;
+ }
+
+ /**
+ * Resolves the default controller of the given command
+ *
+ * @return $controllerInstance A controller instance for the default
+ * command
+ * @throws InvalidControllerInstanceException Thrown if $controllerInstance
+ * is invalid
+ */
+ public function resolveController () {
+ // Init variables
+ $controllerName = "";
+ $controllerInstance = null;
+
+ // Get the command name
+ $controllerName = $this->getControllerName();
+
+ // Get the command
+ $controllerInstance = $this->loadController($controllerName);
+
+ // And validate it
+ if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
+ // This command has an invalid instance!
+ throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+ } // END - if
+
+ // Set last controller
+ $this->lastControllerInstance = $controllerInstance;
+
+ // Return the maybe resolved instance
+ return $controllerInstance;
+ }
+
+ /**
+ * "Loads" a given controller and instances it if not yet cached. If the
+ * controller was not found one of the default controllers will be used
+ * depending on wether news shall be displayed.
+ *
+ * @param $controllerName A controller name we shall look for
+ * @return $controllerInstance A loaded controller instance
+ * @throws InvalidControllerException Thrown if even the requested
+ * controller class is missing (bad!)
+ */
+ private function loadController ($controllerName) {
+ // Debug message
+ //* DEBUG: */ $this->debugBackTrace();
+
+ // Cache default command
+ $defaultController = $this->getConfigInstance()->readConfig('default_image_command');
+
+ // Init controller instance
+ $controllerInstance = null;
+
+ // Default controller
+ $this->setClassName("ImageDefaultController");
+
+ // Generate the class name
+ //* DEBUG: */ echo __METHOD__.": Controller=".$controllerName;
+ if ($controllerName != $defaultController) {
+ // Create controller class name
+ $this->setClassName(sprintf("Image%sController",
+ $this->convertToClassName($controllerName)
+ ));
+ } else {
+ // Default controller
+ $this->setClassName("ImageDefaultController");
+ }
+ //* DEBUG: */ echo ", controller=".$this->getClassName()."<br />\n";
+
+ // Is this class loaded?
+ if (!class_exists($this->getClassName())) {
+ // Class not found, so try the default one or throw exception
+ throw new InvalidControllerException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+ } // END - if
+
+ // Initiate the resolver and controller
+ $resolverInstance = ObjectFactory::createObjectByConfiguredName('image_cmd_resolver_class', array($controllerName, $this->getApplicationInstance()));
+ $controllerInstance = ObjectFactory::createObjectByName($this->getClassName(), array($resolverInstance));
+
+ // Remove resolver
+ unset($resolverInstance);
+
+ // Return the result
+ return $controllerInstance;
+ }
+}
+
+// [EOF]
+?>
throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (!$resolverInstance->isControllerValid($controllerName)) {
// Invalid command found
- throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_COMMAND);
+ throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
}
// Set the application instance
*
* @param $controllerName A controller name we shall look for
* @return $controllerInstance A loaded controller instance
- * @throws DefaultControllerException Thrown if even the default
+ * @throws InvalidControllerException Thrown if even the requested
* controller class is missing (bad!)
*/
private function loadController ($controllerName) {
//* DEBUG: */ $this->debugBackTrace();
// Cache default command
- $defaultController = $this->getConfigInstance()->readConfig('default_command');
+ $defaultController = $this->getConfigInstance()->readConfig('default_web_command');
// Init controller instance
$controllerInstance = null;
// Is this class loaded?
if (!class_exists($this->getClassName())) {
- // Class not found, so try the default one or throw exception
- if ($controllerName != $defaultController) {
- // Try the default controller
- return $this->loadController($defaultController);
- } else {
- // Still not found?
- throw new DefaultControllerException($this, self::EXCEPTION_DEFAUL_CONTROLLER_GONE);
- }
+ // Throw an exception here
+ throw new InvalidControllerException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
} // END - if
// Initiate the resolver and controller
// CFG: WEB-CMD-RESOLVER-CLASS
$cfg->setConfigEntry('web_cmd_resolver_class', "WebCommandResolver");
+// CFG: IMAGE-CMD-RESOLVER-CLASS
+$cfg->setConfigEntry('image_cmd_resolver_class', "ImageCommandResolver");
+
// CFG: MAILER-CLASS
$cfg->setConfigEntry('mailer_class', "DebugMailer");