diff options
author | Michael Tänzer <neo@nhng.de> | 2011-10-20 17:34:07 +0200 |
---|---|---|
committer | Michael Tänzer <neo@nhng.de> | 2011-10-20 17:34:07 +0200 |
commit | 99d0ec582fb1f76479424c0300005284c58e67b0 (patch) | |
tree | 17823d7201755f608239415c8df3c701bb4ad0e1 /includes/lib/general.php | |
parent | 9fbc1a84044a2e7e04de6422d5ef1b6887b401a3 (diff) | |
download | cacert-devel-99d0ec582fb1f76479424c0300005284c58e67b0.tar.gz cacert-devel-99d0ec582fb1f76479424c0300005284c58e67b0.tar.xz cacert-devel-99d0ec582fb1f76479424c0300005284c58e67b0.zip |
bug 978: Move things around (common functions moved to a lib file)
Signed-off-by: Michael Tänzer <neo@nhng.de>
Diffstat (limited to 'includes/lib/general.php')
-rw-r--r-- | includes/lib/general.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/includes/lib/general.php b/includes/lib/general.php index 25d2561..6cfbd10 100644 --- a/includes/lib/general.php +++ b/includes/lib/general.php @@ -47,4 +47,24 @@ function get_user_id_from_cert($serial, $issuer_cn) return -1; } -?> +/** +* Produces a log entry with the error message with log level E_USER_WARN +* and a random ID an returns a message that can be displayed to the user +* including the generated ID +* +* @param $errormessage string +* The error message that should be logged +* @return string containing the generated ID that can be displayed to the +* user +*/ +function failWithId($errormessage) { + $errorId = rand(); + trigger_error("$errormessage. ID: $errorId", E_USER_WARNING); + return sprintf(_("Something went wrong when processing your request. ". + "Please contact %s for help and provide them with the ". + "following ID: %d"), + "<a href='mailto:support@cacert.org?subject=System%20Error%20-%20". + "ID%3A%20$errorId'>support@cacert.org</a>", + $errorId); +} + |