diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 06fb495a91354eaa17d606fa917b9c74accbd5ea..741b1691fba2897fb30954362712d45774df1e17 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