show(); exit; } $reportId = (string)$_REQUEST['reportId']; $email = (string)$_REQUEST['email']; $text = htmlspecialchars((string)$_REQUEST['text']); 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:

' . htmlspecialchars($text) . '

Exception: ' . $data['exceptionMsg'] . '

' . $data['exceptionTrace'] . '

URL:

' . $data['url'] . '

Host:

' . htmlspecialchars(php_uname('n')) . '

Directory:

' . dirname(dirname(__FILE__)) . '

Track ID:

' . $data['trackId'] . '

Version: ' . $data['version'] . '

Report ID: ' . $data['reportId'] . '

Referer: ' . htmlspecialchars($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_Utilities::redirectTrustedURL(SimpleSAML_Utilities::selfURLNoQuery());