= "5" ) ini_set( "zend.ze1_compatibility_mode", 1 ); function StatusMessage($MessageTyp,$MessageHeadline,$MessageText,$MessageVariables = array()) { /* Setting CSS-StyleSheet class depending on the $MessageTyp and rewriting $MessageTyp with a readable string. */ if($MessageTyp == "INFO") { $class = "class=\"statusInfo\""; } elseif($MessageTyp == "WARN") { $class = "class=\"statusWarn\""; } elseif($MessageTyp == "ERROR") { $class = "class=\"statusError\""; } /* Set output-message, when none or false $MessageTyp is submitted. */ else { $class = "class=\"statusError\""; $MessageTyp = _("LAM Internal Error"); $MessageHeadline = _("Invalid/Missing Message type"); $MessageText = _("Please report this error to the Bug-Tracker at {link=http://lam.sf.net}LDAP Account Manager Development Team{endlink}. The error number is {bold}0001:Invalid/Missing Message type.{endbold} Thank you."); } $MessageHeadline = parseMessageString($MessageHeadline); $MessageText = parseMessageString($MessageText); if (is_file("../graphics/error.png")) { $MessageTyp = "\"""; } else { $MessageTyp = "\"""; } $MessageHeadline = "

" . $MessageHeadline . "

"; // Format $MessageHeadline $MessageText = "

" . $MessageText . "

"; // Format $MessageText $format = "
\n
\n\n\n\n\n\n
" . $MessageTyp . "" . $MessageHeadline . $MessageText . "
\n
\n
\n"; if (is_array($MessageVariables)) { array_unshift($MessageVariables, $format); call_user_func_array('printf',$MessageVariables); } else { printf($format, $MessageVariables); } } /* Use the three replace functions on the submitted Text. */ function parseMessageString($MessageString) { return linkText(colorText(boldText($MessageString))); } /* Replace {bold} and {endbold} with and HTML-Tags. */ function boldText($text) { $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-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\}/"; // Regular expression matching {link=[Link-Target]}[Text]{endlink} $replace = "\\2"; //Replace pattern return preg_replace($pattern,$replace,$text); } ?>