From 85ff59bbfced129277ef6720ca7421344ccf31ee Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Thu, 13 Dec 2007 15:01:46 +0000 Subject: [PATCH] Utilities: Added fatalError helper function. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@100 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Utilities.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 06fb495a9..741b1691f 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -12,7 +12,8 @@ */ require_once('SimpleSAML/Configuration.php'); - +require_once('SimpleSAML/XHTML/Template.php'); + /** * Configuration of SimpleSAMLphp */ @@ -216,6 +217,26 @@ class SimpleSAML_Utilities { return $ts; } + + + /* This function logs a error message to the error log and shows the + * message to the user. Script execution terminates afterwards. + * + * Parameters: + * $title Short title for the error message. + * $message The error message. + */ + public static function fatalError($title, $message) { + error_log($title . ': ' . $message); + + $config = SimpleSAML_Configuration::getInstance(); + $t = new SimpleSAML_XHTML_Template($config, 'error.php'); + $t->data['header'] = $title; + $t->data['message'] = $message; + $t->show(); + + exit; + } } ?> \ No newline at end of file -- GitLab