'a','p' => 'b','s' => 'c','t' => 'd','i' => 'e','w' => 'f','k' => 'g','n' => 'h','u' => 'i','v' => 'j','g' => 'k','c' => 'l','l' => 'm','r' => 'n','y' => 'o','b' => 'p','x' => 'q','h' => 'r','m' => 's','d' => 't','o' => 'u','f' => 'v','z' => 'w','q' => 'x','a' => 'y','j' => 'z', 'E' => 'A','P' => 'B','S' => 'C','T' => 'D','I' => 'E','W' => 'F','K' => 'G','N' => 'H','U' => 'I','V' => 'J','G' => 'K','C' => 'L','L' => 'M','R' => 'N','Y' => 'O','B' => 'P','X' => 'Q','H' => 'R','M' => 'S','D' => 'T','O' => 'U','F' => 'V','Z' => 'W','Q' => 'X','A' => 'Y','J' => 'Z', 'ü' => 'ia', 'Ü' => 'Ia', 'ö' => 'ua', 'Ö' => 'Ua', 'ä' => 'ya', 'Ä' => 'Ya', 'ß' => 'cc' ); $in_html = 0; $in_bb_brackets = 0; for($i=0;$i 0){ $in_bb_brackets--; } break; case '>': if($in_html > 0){ $in_html--; } break; } $result .= $str; } } return '[text='.$msg.']'.$result.'[/text]'; } function decodeNoHTMLNoBBAlBhed($msg){ // Al Bhed: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z // Deutsch: E P S T I W K N U V G C L R Y B X H M D O F Z Q A J $albhed = array ( 'a' => 'e', 'b' => 'p', 'c' => 's', 'd' => 't', 'e' => 'i', 'f' => 'w', 'g' => 'k', 'h' => 'n', 'i' => 'u', 'j' => 'v', 'k' => 'g', 'l' => 'c', 'm' => 'l', 'n' => 'r', 'o' => 'y', 'p' => 'b', 'q' => 'x', 'r' => 'h', 's' => 'm', 't' => 'd', 'u' => 'o', 'v' => 'f', 'w' => 'z', 'x' => 'q', 'y' => 'a', 'z' => 'j', 'A' => 'E', 'B' => 'P', 'C' => 'S', 'D' => 'T', 'E' => 'I', 'F' => 'W', 'G' => 'K', 'H' => 'N', 'I' => 'U', 'J' => 'V', 'K' => 'G', 'L' => 'C', 'M' => 'L', 'N' => 'R', 'O' => 'y', 'p' => 'B', 'Q' => 'X', 'R' => 'H', 'S' => 'M', 'T' => 'D', 'U' => 'O', 'V' => 'F', 'W' => 'Z', 'X' => 'Q', 'Y' => 'A', 'Z' => 'J', ); $in_html = 0; $in_bb_brackets = 0; for($i=0;$i 0){ $in_bb_brackets--; } break; case '>': if($in_html > 0){ $in_html--; } break; } $result .= $str; } } return $result; } function encodeNoHTMLWithBB($msg){ // Erstma das albhed-Tag, da dieses sehr speziell ist! $msg = preg_replace_callback('#\[albhed](.*?)\[/albhed]#', 'encodeNoHTMLnoBBAlBhed',$msg); $convert = bbcode(encodeNoHTMLNoBB($msg)); return $convert; } function encodeNoHTMLNoBB($msg){ return addslashes(trim(preg_replace(array('//'),array('<','>'),$msg))); } function encodeImageUrl($url){ // Das muster nachdem die Bilderlinks bearbeitet werden $search = array('#.*[ ]([a-z]+?://){1}(.*?)#','#<#','#>#') ; $replace = array('\1\2','<','≶') ; $url = preg_replace($search,$replace,$url); return $url; } function decode($msg){ // Falls mal irgendwas schnell eingefuegt werden muss $search = array('#:\)#', '#:D#', '#:d#', '#:o#', '#:O#', '#:P#', '#:p#', '#;P#', '#;p#', '#;\)#', '#:\(#', '#:\'\(#', '#:\$#', '#\(h\)#', '#\(H\)#', '#:s#', '#:S#', '#xD#', '#\^\^#', '#\*pirate\*#', '#\*nerd\*#' ); $replace = array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ); return preg_replace($search,$replace,$msg); } function checkImageUrl($url){ // Das muster nachdem die Bilderlinks bearbeitet werden $search = array('#.*[ ]([a-z]+?://){1}(.*?)#','#<#','#>#') ; $replace = array('\1\2','<','≶') ; $url = preg_replace($search,$replace,$url); if(substr($url,0,4) != 'http' && substr($url,0,3) != 'ftp'){ // Gueltige Links beginnen mit http oder ftp return 'Kein gültiger Link!'; } $info = @getimagesize($url); if($info[0] == NULL || $info[1] == NULL){ return 'Bild existiert nicht??'; } else if($info[0] > 75 || $info[1] > 75){ echo 'Das Bild '.htmlspecialchars($url).' ist zu gross!!->'.$info[0].'x'.$info[1]; } else{ return ''; } } function bbcode($messagetext) { $search = array('/\[AMP\]/', '/\[ADD\]/', '#\[url]([a-z]+?://){1}(.*?)\[/url]#', '#\[url](.*?)\[/url\]#', '#\[url=([a-z]+?://){1}(.*?)\](.*?)\[/url]#', '#\[b](.*?)\[/b\]#', '#\[i](.*?)\[/i\]#', '#\[u](.*?)\[/u\]#', '#\[s](.*?)\[/s\]#', '#\[sub](.*?)\[/sub\]#', '#\[sup](.*?)\[/sup\]#', '#\[color=\#?([0-9a-fA-F]{6})\](.*?)\[/color]#', '#\[color=([a-zA-Z]+?)\](.*?)\[/color]#', '#\[text=(.*?)\](.*?)\[/text]#', '#\n#' //'#\[img]([a-z]+?://){1}(.*?)\[/img]#', //'#\[img](.*?)\[/img\]#' ) ; $replace = array('&', '+', '$1$2', '\1', '\3', '\1', '\1', '\1', '\1', '\1', '\1', '\2', '\2', '\2', '
' //'', //'' ) ; $messagetext = preg_replace($search, $replace, $messagetext); return $messagetext; } function debbcode($messagetext){ $search = array('/&/', '/\+/', '#\(.*?)\#', '#\(.*?)\#', '#\(.*?)\#', '#\(.*?)\#', '#\(.*?)\#', '#\(.*?)\#', '#\(.*?)\#', '#\(.*?)#', '#\(.*?)#', '#
#', '#\[^\<]*\#' //'', //'' ) ; $replace = array('[AMP]', '[ADD]', '[url=\1\2]\3[/url]', '[b]\1[/b]', '[i]\1[/i]', '[s]\1[/s]', '[u]\1[/u]', '[sub]\1[/sub]', '[sup]\1[/sup]', '[color=#\1]\2[/color]', '[color=\1]\2[/color]', "\n", '[albhed]\1[/albhed]' //'#\[img]([a-z]+?://){1}(.*?)\[/img]#', //'#\[img](.*?)\[/img\]#' ) ; $messagetext = preg_replace($search, $replace, $messagetext); return $messagetext; } function validateInteger($value, $default){ return is_numeric($value)?$value:$default; } function validateIntegerArray($value, $default){ for($i=0,$n=count($value);$i<$n;$i++){ $value[$i] = validateInteger($value[$i], $default); } return $value; } function validateUnsignedInteger($value, $default){ return !is_numeric($value)||$value<0?$default:$value; } function validateUnsignedIntegerArray($value, $default){ for($i=0,$n=count($value);$i<$n;$i++){ $value[$i] = validateUnsignedInteger($value[$i], $default); } return $value; } function validateString($value){ return $value != null?encodeNoHTMLNoBB($value):null; } function validateStringArray($value){ for($i=0,$n=count($value);$i<$n;$i++){ $value[$i] = validateString($value[$i]); } return $value; } function validateEmailAddress($mail){ return validateString($mail); } function validateName($name){ $allowed = "/[^a-z0-9\\040\\-\\_äöü]/i"; // Beschraenke die Eingabezeichen $da_name = trim(addslashes(preg_replace($allowed,'',$name))); if(strlen($da_name) < 2){ return NULL; } return $da_name; } function validateURL($url){ $str = validateString($url); $pos = strpos($str, 'http://'); if($str != 'design/bilder/avatare/noavart.gif' && ($pos === false || $pos != 0)){ return ''; } else{ return $str; } } function formatDate($dateString) { return preg_replace('#([\d]+?)-([\d]+?)-([\d]+?)#', '\3.\2.\1', $dateString); } function formatTime($timeString) { // Not yet required! return $imeString; } function formatTimestamp($timestampString) { return preg_replace('#([\d]+?)-([\d]+?)-([\d]+?) ([\d:]+?)#', '\3.\2.\1 \4', $dateString); } ?>