From 8fc80d7ec216d78014e8c5c4e5bf48b4cd99835b Mon Sep 17 00:00:00 2001 From: hecht Date: Mon, 10 Oct 2011 18:32:55 +0000 Subject: [PATCH] added some methods to convert dates and timestamps in american format into the german format! --- ag/include/parse.inc.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/ag/include/parse.inc.php b/ag/include/parse.inc.php index a6589dd..146f07f 100644 --- a/ag/include/parse.inc.php +++ b/ag/include/parse.inc.php @@ -18,7 +18,7 @@ function encodeNoHTMLnoBBAlBhed($msg){ $msg = $msg[1]; $albhed = array ( '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', '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' + 'ü' => 'ia', 'Ü' => 'Ia', 'ö' => 'ua', 'Ö' => 'Ua', 'ä' => 'ya', 'Ä' => 'Ya', 'ß' => 'cc' ); $in_html = 0; $in_bb_brackets = 0; @@ -87,7 +87,7 @@ function decodeNoHTMLNoBBAlBhed($msg){ $result .= $str; } } - return $result; + return $result; } function encodeNoHTMLWithBB($msg){ @@ -211,7 +211,7 @@ function bbcode($messagetext) { '\1', '\2', '\2', - '\2', + '\2', '
' //'', //'' @@ -290,17 +290,17 @@ function validateStringArray($value){ for($i=0,$n=count($value);$i<$n;$i++){ $value[$i] = validateString($value[$i]); } - return $value; + return $value; } function validateEmailAddress($mail){ - return validateString($mail); + return validateString($mail); } function validateName($name){ $allowed = "/[^a-z0-9\\040\\-\\_äöü]/i"; // Beschraenke die Eingabezeichen - $da_name = trim(addslashes(preg_replace($allowed,'',$name))); + $da_name = trim(addslashes(preg_replace($allowed,'',$name))); if(strlen($da_name) < 2){ return NULL; } @@ -317,4 +317,18 @@ function validateURL($url){ } } +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); +} + + ?>