X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Ffunctions.inc;h=ddb9e1465caa15c773d0e9bd1c572256ab62065a;hb=62feb9d8929295ba361884d3d42f294e2d31046d;hp=529741c40c1e41b5944b1ec3654fa3ae39683e3f;hpb=60e1ea99ca0aa114b3fe6e309c711385beab4d9f;p=gosa.git diff --git a/include/functions.inc b/include/functions.inc index 529741c40..ddb9e1465 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -1132,27 +1132,63 @@ function print_red() } if(isset($_SESSION['errors']) && strlen($_SESSION['errors'])==0) { + + + if(preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])){ + + $_SESSION['errors'].= " + +
+
"; + $hide = "hide(\"e_layer\");hide(\"e_layer2\");hide(\"e_layer3\");"; + }else{ + + $_SESSION['errors'].= " +
+
"; + $hide = "hide(\"e_layer\");hide(\"e_layer2\");"; + } + $_SESSION['errors'].= " -
-
-
". "". "

"._("An error occurred while processing your request"). "

$string

$addmsg

"; } @@ -1396,9 +1432,9 @@ function print_header($image, $headline, $info= "") $display.= " "; $display.= "\n"; } - if (isset($_SESSION['errors'])){ - $display.= $_SESSION['errors']; - } +# if (isset($_SESSION['errors'])){ +# $display.= $_SESSION['errors']; +# } return ($display); } @@ -2416,6 +2452,71 @@ function get_base_from_hook($dn, $attrib) } +function prepare4mailbody($string) +{ + $string = html_entity_decode($string); + + $from = array( + "/%/", + "/ /", + "/\n/", + "/\r/", + "/!/", + "/#/", + "/\*/", + "/\//", + "//", + "/\?/", + "/\"/"); + + $to = array( + "%25", + "%20", + "%0A", + "%0D", + "%21", + "%23", + "%2A", + "%2F", + "%3C", + "%3E", + "%3F", + "%22"); + + $string = preg_replace($from,$to,$string); + + return($string); +} + + +function mac2company($mac) +{ + $vendor= ""; + + /* Generate a normailzed mac... */ + $mac= substr(preg_replace('/[:-]/', '', $mac), 0, 6); + + /* Check for existance of the oui file */ + if (!is_readable(CONFIG_DIR."/oui.txt")){ + return (""); + } + + /* Open file and look for mac addresses... */ + $handle = @fopen(CONFIG_DIR."/oui.txt", "r"); + if ($handle) { + while (!feof($handle)) { + $line = fgets($handle, 4096); + + if (preg_match("/^$mac/i", $line)){ + $vendor= substr($line, 32); + } + } + fclose($handle); + } + + return ($vendor); +} // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: