summaryrefslogtreecommitdiff
path: root/includes/lib/general.php
diff options
context:
space:
mode:
authorMichael Tänzer <neo@nhng.de>2011-10-20 17:34:07 +0200
committerMichael Tänzer <neo@nhng.de>2011-10-20 17:34:07 +0200
commit99d0ec582fb1f76479424c0300005284c58e67b0 (patch)
tree17823d7201755f608239415c8df3c701bb4ad0e1 /includes/lib/general.php
parent9fbc1a84044a2e7e04de6422d5ef1b6887b401a3 (diff)
downloadcacert-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.php22
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);
+}
+