Some errors corrected and comments added.
This commit is contained in:
parent
d30f115eb8
commit
0670f4a520
|
@ -25,6 +25,7 @@ $Id$
|
||||||
|
|
||||||
function StatusMessage($MessageTyp, $MessageHeadline, $MessageText)
|
function StatusMessage($MessageTyp, $MessageHeadline, $MessageText)
|
||||||
{
|
{
|
||||||
|
/* Setting CSS-StyleSheet class depending on the $MessageTyp and rewriting $MessageTyp with a readable string. */
|
||||||
if($MessageTyp == "INFO")
|
if($MessageTyp == "INFO")
|
||||||
{
|
{
|
||||||
$class = "class=\"status_info\"";
|
$class = "class=\"status_info\"";
|
||||||
|
@ -40,6 +41,7 @@ function StatusMessage($MessageTyp, $MessageHeadline, $MessageText)
|
||||||
$class = "class=\"status_error\"";
|
$class = "class=\"status_error\"";
|
||||||
$MessageTyp = _("Error");
|
$MessageTyp = _("Error");
|
||||||
}
|
}
|
||||||
|
/* Set output-message, when none or false $MessageTyp is submitted. */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$class = "class=\"status_error\"";
|
$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.");
|
$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);
|
$MessageHeadline = parseMessageString($MessageHeadline);
|
||||||
$MessageText = parseMessageText($MessageText);
|
$MessageText = parseMessageString($MessageText);
|
||||||
|
|
||||||
$MessageTyp = "<h1 $class>$MessageTyp</h1>";
|
$MessageTyp = "<h1 $class>$MessageTyp</h1>"; // Format $MessageTyp
|
||||||
$MessageHeadline = "<h2 $class>$MessageHeadline</h2>";
|
$MessageHeadline = "<h2 $class>$MessageHeadline</h2>"; // Format $MessageHeadline
|
||||||
$MessageText = "<p $class>$MessageText</p>";
|
$MessageText = "<p $class>$MessageText</p>"; // Format $MessageText
|
||||||
echo "<div $class><br>" . $MessageTyp.$MessageHeadline.$MessageText . "<br></div>";
|
echo "<div $class><br>" . $MessageTyp.$MessageHeadline.$MessageText . "<br></div>"; // Writing status message
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseMessageText($MessageText)
|
/* Use the three replace functions on the submitted Text. */
|
||||||
|
function parseMessageString($MessageString)
|
||||||
{
|
{
|
||||||
$return = linkText(colorText(boldText($MessageText)));
|
return = linkText(colorText(boldText($MessageString)));
|
||||||
return $return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Replace {bold} and {endbold} with <b> and </b> HTML-Tags. */
|
||||||
function boldText($text)
|
function boldText($text)
|
||||||
{
|
{
|
||||||
$pattern = "/\{bold\}([^{]*)\{endbold\}/";
|
$pattern = "/\{bold\}([^{]*)\{endbold\}/"; // Regular expression matching {bold}[Text]{endbold}
|
||||||
$replace = "<b class\"status\">\\1</b>";
|
$replace = "<b class\"status\">\\1</b>"; // Replace pattern
|
||||||
$return = preg_replace($pattern,$replace,$text);
|
return = preg_replace($pattern,$replace,$text);
|
||||||
return $return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Replace {color=#[HEX-Value]} or {color=[HEX-Value]} and {endcolor} with <font color="#[HEX-Value]"> and </font> HTML-Tags. */
|
||||||
function colorText($text)
|
function colorText($text)
|
||||||
{
|
{
|
||||||
$pattern = "/\{color=([0-9,a,b,c,d,e,f,A,B,C,D,F]{6})\}([^{]*)\{endcolor\}/";
|
$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 = "<font color=\"#\\1\">\\2</font>";
|
$replace = "<font color=\"#\\1\">\\2</font>"; // Replace pattern
|
||||||
$return = preg_replace($pattern,$replace,$text);
|
return = preg_replace($pattern,$replace,$text);
|
||||||
return $return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Replace {link=[Link-Target]} and {endlink} with <a href="[Link-Target]" target="_blank"> and </a> HTML-Tags. */
|
||||||
function linkText($text)
|
function linkText($text)
|
||||||
{
|
{
|
||||||
$pattern = "/\{link=([^}]*)\}([^{]*)\{endlink\}/";
|
$pattern = "/\{link=([^}]*)\}([^{]*)\{endlink\}/"; // Regular expression matching {link=[Link-Target]}[Text]{endlink}
|
||||||
$replace = "<a href=\"\\1\" target=\"_blank\">\\2</a>";
|
$replace = "<a href=\"\\1\" target=\"_blank\">\\2</a>"; //Replace pattern
|
||||||
$return = preg_replace($pattern,$replace,$text);
|
return = preg_replace($pattern,$replace,$text);
|
||||||
return $return;
|
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
?>
|
|
Loading…
Reference in New Issue