diff --git a/source/lib/SihnonFramework/Exceptions.class.php b/source/lib/SihnonFramework/Exceptions.class.php index 241ee73..429267a 100644 --- a/source/lib/SihnonFramework/Exceptions.class.php +++ b/source/lib/SihnonFramework/Exceptions.class.php @@ -8,6 +8,12 @@ class SihnonFramework_Exception_AlreadyInitialisted extends SihnonFramework_E class SihnonFramework_Exception_NotImplemented extends SihnonFramework_Exception {}; class SihnonFramework_Exception_MissingDefinition extends SihnonFramework_Exception {}; +class SihnonFramework_Exception_TemplateException extends SihnonFramework_Exception {}; +class SihnonFramework_Exception_AbortEntirePage extends SihnonFramework_Exception_TemplateException {}; +class SihnonFramework_Exception_Unauthorized extends SihnonFramework_Exception_TemplateException {}; +class SihnonFramework_Exception_FileNotFound extends SihnonFramework_Exception_TemplateException {}; +class SihnonFramework_Exception_InvalidParameters extends SihnonFramework_Exception_TemplateException {}; + class SihnonFramework_Exception_DatabaseException extends SihnonFramework_Exception {}; class SihnonFramework_Exception_DatabaseConfigMissing extends SihnonFramework_Exception_DatabaseException {}; class SihnonFramework_Exception_DatabaseConnectFailed extends SihnonFramework_Exception_DatabaseException {}; @@ -24,6 +30,5 @@ class SihnonFramework_Exception_CacheObjectNotFound extends SihnonFramework_E class SihnonFramework_Exception_InvalidPluginName extends SihnonFramework_Exception {}; -class SihnonFramework_Exception_FileNotFound extends SihnonFramework_Exception {}; ?> diff --git a/source/lib/SihnonFramework/Main.class.php b/source/lib/SihnonFramework/Main.class.php index c0b7d1e..5f28891 100644 --- a/source/lib/SihnonFramework/Main.class.php +++ b/source/lib/SihnonFramework/Main.class.php @@ -116,7 +116,10 @@ class SihnonFramework_Main { if (preg_match("/^{$class['base']}_/", $classname)) { // Special case: all related exceptions are grouped into a single file if (preg_match("/^({$class['base']}_(?:.*?_)?)Exception/", $classname, $matches)) { - require_once($class['base_dir_prefix'] . preg_replace('/_/', '/', $matches[1]) . 'Exceptions.class.php'); + $exceptions_filename = $class['base_dir_prefix'] . preg_replace('/_/', '/', $matches[1]) . 'Exceptions.class.php'; + if (file_exists($exceptions_filename)) { + require_once($exceptions_filename); + } return; } @@ -231,7 +234,7 @@ class SihnonFramework_Main { return $var; } - if (is_string($default) && preg_match('/^Sihnon(Framework)?_Exception/', $default) && class_exists($default) && is_subclass_of($default, SihnonFramework_Exception)) { + if (is_string($default) && preg_match('/^Sihnon(Framework)?_Exception/', $default) && class_exists($default) && is_subclass_of($default, 'SihnonFramework_Exception')) { throw new $default(); } diff --git a/source/lib/SihnonFramework/PluginFactory.class.php b/source/lib/SihnonFramework/PluginFactory.class.php index 4598d6d..5c55b7c 100644 --- a/source/lib/SihnonFramework/PluginFactory.class.php +++ b/source/lib/SihnonFramework/PluginFactory.class.php @@ -36,7 +36,7 @@ abstract class SihnonFramework_PluginFactory implements Sihnon_IPluginFactory { $plugins = array(); if (! is_array($directories)) { - $directories = array(SihnonLib => $directories); + $directories = array(Sihnon_Lib => $directories); } foreach ($directories as $base_dir => $directory) { @@ -87,4 +87,4 @@ abstract class SihnonFramework_PluginFactory implements Sihnon_IPluginFactory { } -?> \ No newline at end of file +?> diff --git a/source/lib/SihnonFramework/RequestParser.class.php b/source/lib/SihnonFramework/RequestParser.class.php index c37613a..95b64fa 100644 --- a/source/lib/SihnonFramework/RequestParser.class.php +++ b/source/lib/SihnonFramework/RequestParser.class.php @@ -73,7 +73,7 @@ class SihnonFramework_RequestParser { } public function exists($key) { - return isset($this->vars[$key]); + return array_key_exists($key, $this->vars); } public function get($key, $default = null) { @@ -81,7 +81,7 @@ class SihnonFramework_RequestParser { return $this->vars[$key]; } - if (is_string($default) && preg_match('/^[a-zA-Z_]+_Exception/', $default) && class_exists($default) && is_subclass_of($default, SihnonFramework_Exception)) { + if (is_string($default) && preg_match('/^[a-zA-Z_]+_Exception/', $default) && class_exists($default) && is_subclass_of($default, 'SihnonFramework_Exception')) { throw new $default(); }