Skip to content
Snippets Groups Projects
Commit 4bedd361 authored by Olav Morken's avatar Olav Morken
Browse files

Add option to use a custom error handling function.

Thanks to Andjelko Horvat for implementing this feature!

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2699 44740490-163a-0410-bde0-09ae8108e29a
parent e7c8897a
No related branches found
No related tags found
No related merge requests found
...@@ -145,29 +145,38 @@ class SimpleSAML_Error_Error extends SimpleSAML_Error_Exception { ...@@ -145,29 +145,38 @@ class SimpleSAML_Error_Error extends SimpleSAML_Error_Exception {
$errorData = $this->saveError(); $errorData = $this->saveError();
$config = SimpleSAML_Configuration::getInstance(); $config = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($config, 'error.php', 'errors');
$t->data['showerrors'] = $config->getBoolean('showerrors', true); $data['showerrors'] = $config->getBoolean('showerrors', true);
$t->data['error'] = $errorData; $data['error'] = $errorData;
$t->data['errorCode'] = $this->errorCode; $data['errorCode'] = $this->errorCode;
$t->data['parameters'] = $this->parameters; $data['parameters'] = $this->parameters;
/* Check if there is a valid technical contact email address. */ /* Check if there is a valid technical contact email address. */
if($config->getString('technicalcontact_email', 'na@example.org') !== 'na@example.org') { if($config->getString('technicalcontact_email', 'na@example.org') !== 'na@example.org') {
/* Enable error reporting. */ /* Enable error reporting. */
$baseurl = SimpleSAML_Utilities::getBaseURL(); $baseurl = SimpleSAML_Utilities::getBaseURL();
$t->data['errorReportAddress'] = $baseurl . 'errorreport.php'; $data['errorReportAddress'] = $baseurl . 'errorreport.php';
} }
$session = SimpleSAML_Session::getInstance(); $session = SimpleSAML_Session::getInstance();
$attributes = $session->getAttributes(); $attributes = $session->getAttributes();
if (is_array($attributes) && array_key_exists('mail', $attributes) && count($attributes['mail']) > 0) { if (is_array($attributes) && array_key_exists('mail', $attributes) && count($attributes['mail']) > 0) {
$email = $attributes['mail'][0]; $data['email'] = $attributes['mail'][0];
} else {
$data['email'] = '';
}
$show_function = $config->getString('errors.show_function', NULL);
if (isset($show_function)) {
assert('is_callable($show_function)');
call_user_func($show_function, $config, $data);
assert('FALSE');
} else { } else {
$email = ''; $t = new SimpleSAML_XHTML_Template($config, 'error.php', 'errors');
$t->data = array_merge($t->data, $data);
$t->show();
} }
$t->data['email'] = $email;
$t->show();
exit; exit;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment