From 5181fe1b4c8cfe9d25d8d930cc0c96a7734e6e8f Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Tue, 20 Dec 2011 01:42:21 +0000 Subject: [PATCH] Add support for 401 errors in the templating system --- source/lib/SihnonFramework/Exceptions.class.php | 1 + source/lib/SihnonFramework/Page.class.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/lib/SihnonFramework/Exceptions.class.php b/source/lib/SihnonFramework/Exceptions.class.php index 5ec39c6..0d90461 100644 --- a/source/lib/SihnonFramework/Exceptions.class.php +++ b/source/lib/SihnonFramework/Exceptions.class.php @@ -13,6 +13,7 @@ class SihnonFramework_Exception_TemplateException extends SihnonFramework_E 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_NotAuthorised extends SihnonFramework_Exception_TemplateException {}; class SihnonFramework_Exception_InvalidParameters extends SihnonFramework_Exception_TemplateException {}; class SihnonFramework_Exception_DatabaseException extends SihnonFramework_Exception {}; diff --git a/source/lib/SihnonFramework/Page.class.php b/source/lib/SihnonFramework/Page.class.php index 5de45ca..8bd37d2 100644 --- a/source/lib/SihnonFramework/Page.class.php +++ b/source/lib/SihnonFramework/Page.class.php @@ -41,7 +41,9 @@ class SihnonFramework_Page { } catch (SihnonFramework_Exception_AbortEntirePage $e) { return false; } catch (SihnonFramework_Exception_FileNotFound $e) { - $content = $this->render('errors/404.tpl', 'errors/404.php'); + $content = $this->render('errors/404.tpl', 'errors/404.php'); + } catch (SihnonFramework_Exception_NotAuthorised $e) { + $content = $this->render('errors/401.tpl', 'errors/404.php'); } catch (SihnonFramework_Exception $e) { $content = $this->render('errors/unhandled-exception.tpl', 'errors/unhandled-exception.php', array( 'exception' => $e,