diff --git a/lam/lib/status.inc b/lam/lib/status.inc
index 17d38587..dd86e3c0 100644
--- a/lam/lib/status.inc
+++ b/lam/lib/status.inc
@@ -25,6 +25,7 @@ $Id$
function StatusMessage($MessageTyp, $MessageHeadline, $MessageText)
{
+ /* Setting CSS-StyleSheet class depending on the $MessageTyp and rewriting $MessageTyp with a readable string. */
if($MessageTyp == "INFO")
{
$class = "class=\"status_info\"";
@@ -40,6 +41,7 @@ function StatusMessage($MessageTyp, $MessageHeadline, $MessageText)
$class = "class=\"status_error\"";
$MessageTyp = _("Error");
}
+ /* Set output-message, when none or false $MessageTyp is submitted. */
else
{
$class = "class=\"status_error\"";
@@ -48,43 +50,42 @@ function StatusMessage($MessageTyp, $MessageHeadline, $MessageText)
$MessageText = _("Please report this error to the {link=mailto:lam-devel@sourceforge.net}LDAP Account Manager Development Team{endlink}. The error number is {bold}0001:Invalid/Missing Message Typ.{endbold} Thank you.");
}
- $MessageHeadline = parseMessageText($MessageHeadline);
- $MessageText = parseMessageText($MessageText);
+ $MessageHeadline = parseMessageString($MessageHeadline);
+ $MessageText = parseMessageString($MessageText);
- $MessageTyp = "
$MessageTyp
";
- $MessageHeadline = "$MessageHeadline
";
- $MessageText = "$MessageText
";
- echo "
" . $MessageTyp.$MessageHeadline.$MessageText . "
";
+ $MessageTyp = "$MessageTyp
"; // Format $MessageTyp
+ $MessageHeadline = "$MessageHeadline
"; // Format $MessageHeadline
+ $MessageText = "$MessageText
"; // Format $MessageText
+ echo "
" . $MessageTyp.$MessageHeadline.$MessageText . "
"; // Writing status message
}
-function parseMessageText($MessageText)
+/* Use the three replace functions on the submitted Text. */
+function parseMessageString($MessageString)
{
- $return = linkText(colorText(boldText($MessageText)));
- return $return;
+ return = linkText(colorText(boldText($MessageString)));
}
+/* Replace {bold} and {endbold} with and HTML-Tags. */
function boldText($text)
{
- $pattern = "/\{bold\}([^{]*)\{endbold\}/";
- $replace = "\\1";
- $return = preg_replace($pattern,$replace,$text);
- return $return;
+ $pattern = "/\{bold\}([^{]*)\{endbold\}/"; // Regular expression matching {bold}[Text]{endbold}
+ $replace = "\\1"; // Replace pattern
+ return = preg_replace($pattern,$replace,$text);
}
+/* Replace {color=#[HEX-Value]} or {color=[HEX-Value]} and {endcolor} with and HTML-Tags. */
function colorText($text)
{
- $pattern = "/\{color=([0-9,a,b,c,d,e,f,A,B,C,D,F]{6})\}([^{]*)\{endcolor\}/";
- $replace = "\\2";
- $return = preg_replace($pattern,$replace,$text);
- return $return;
+ $pattern = "/\{color=#?([0-9,a-f,A-F]{6})\}([^{]*)\{endcolor\}/"; // Regular expression matching {color=#[HEX-Value]}[Text]{endcolor} or {color=[HEX-Value]}[Text]{endcolor}
+ $replace = "\\2"; // Replace pattern
+ return = preg_replace($pattern,$replace,$text);
}
+/* Replace {link=[Link-Target]} and {endlink} with and HTML-Tags. */
function linkText($text)
{
- $pattern = "/\{link=([^}]*)\}([^{]*)\{endlink\}/";
- $replace = "\\2";
- $return = preg_replace($pattern,$replace,$text);
- return $return;
+ $pattern = "/\{link=([^}]*)\}([^{]*)\{endlink\}/"; // Regular expression matching {link=[Link-Target]}[Text]{endlink}
+ $replace = "\\2"; //Replace pattern
+ return = preg_replace($pattern,$replace,$text);
}
-
-?>
+?>
\ No newline at end of file