show(); exit; } $reportId = (string) $_REQUEST['reportId']; $email = (string) $_REQUEST['email']; $text = htmlspecialchars((string) $_REQUEST['text']); $data = null; try { $session = SimpleSAML_Session::getSessionFromRequest(); $data = $session->getData('core:errorreport', $reportId); } catch (Exception $e) { SimpleSAML\Logger::error('Error loading error report data: '.var_export($e->getMessage(), true)); } if ($data === null) { $data = array( 'exceptionMsg' => 'not set', 'exceptionTrace' => 'not set', 'reportId' => $reportId, 'trackId' => 'not set', 'url' => 'not set', 'version' => $config->getVersion(), 'referer' => 'not set', ); if (isset($session)) { $data['trackId'] = $session->getTrackID(); } } foreach ($data as $k => $v) { $data[$k] = htmlspecialchars($v); } // build the email message $message = <<SimpleSAMLphp Error Report

Message from user:

%s

Exception: %s

%s

URL:

%s

Host:

%s

Directory:

%s

Track ID:

%s

Version: %s

Report ID: %s

Referer: %s


MESSAGE; $message = sprintf( $message, htmlspecialchars($text), $data['exceptionMsg'], $data['exceptionTrace'], $data['url'], $data['url'], htmlspecialchars(php_uname('n')), dirname(dirname(__FILE__)), $data['trackId'], $data['version'], $data['reportId'], $data['referer'] ); // add the email address of the submitter as the Reply-To address $email = trim($email); // check that it looks like a valid email address if (!preg_match('/\s/', $email) && strpos($email, '@') !== false) { $replyto = $email; $from = $email; } else { $replyto = null; $from = 'no-reply@simplesamlphp.org'; } // send the email $toAddress = $config->getString('technicalcontact_email', 'na@example.org'); if ($config->getBoolean('errorreporting', true) && $toAddress !== 'na@example.org') { $email = new SimpleSAML_XHTML_EMail($toAddress, 'SimpleSAMLphp error report', $from); $email->setBody($message); $email->send(); SimpleSAML\Logger::error('Report with id '.$reportId.' sent to <'.$toAddress.'>.'); } // redirect the user back to this page to clear the POST request \SimpleSAML\Utils\HTTP::redirectTrustedURL(\SimpleSAML\Utils\HTTP::getSelfURLNoQuery());