1) $newString .= ", ".$array[$i]; else $newString = $array[$i]; } } return strtolower($newString); } function addStripes($string) { //return string with stripes between the words $string = str_replace("-","---",$string); // escape - $string = str_replace("/","slash_sign",$string); $string = str_replace(" ","-",$string); /* $array = explode(" ", $string); $newString = $array[0]; for($i = 1; $i < count($array); $i++) { $newString = $newString."-".$array[$i]; } */ //escape special chars $string = urlencode($string); return strtolower($string); } function removeStripes($string) { //remove escaped chars $string = urldecode($string); $string = str_replace("---","is1223streepje",$string); $string = str_replace("-"," ",$string); //return string without stripes between the words /* $array = explode("-", $string); $newString = $array[0]; for($i = 1; $i < count($array); $i++) { $newString = $newString." ".$array[$i]; } */ $string = str_replace("is1223streepje","-",$string); $string = str_replace("slash_sign","/",$string); return strtolower($string); } $dayArray[0] = 'Zondag'; $dayArray[1] = 'Maandag'; $dayArray[2] = 'Dinsdag'; $dayArray[3] = 'Woensdag'; $dayArray[4] = 'Donderdag'; $dayArray[5] = 'Vrijdag'; $dayArray[6] = 'Zaterdag'; $monthArray[0] = 'error'; $monthArray[1] = 'Januari'; $monthArray[2] = 'Februari'; $monthArray[3] = 'Maart'; $monthArray[4] = 'April'; $monthArray[5] = 'Mei'; $monthArray[6] = 'Juni'; $monthArray[7] = 'Juli'; $monthArray[8] = 'Augustus'; $monthArray[9] = 'September'; $monthArray[10] = 'Oktober'; $monthArray[11] = 'November'; $monthArray[12] = 'December'; $monthArrayGerman[0] = 'error'; $monthArrayGerman[1] = 'Januar'; $monthArrayGerman[2] = 'Februar'; $monthArrayGerman[3] = 'März'; $monthArrayGerman[4] = 'April'; $monthArrayGerman[5] = 'Mai'; $monthArrayGerman[6] = 'Juni'; $monthArrayGerman[7] = 'Juli'; $monthArrayGerman[8] = 'August'; $monthArrayGerman[9] = 'September'; $monthArrayGerman[10] = 'Oktober'; $monthArrayGerman[11] = 'November'; $monthArrayGerman[12] = 'Dezember'; function getMonthName($number) { $monthArray[0] = 'error'; $monthArray[1] = 'Januari'; $monthArray[2] = 'Februari'; $monthArray[3] = 'Maart'; $monthArray[4] = 'April'; $monthArray[5] = 'Mei'; $monthArray[6] = 'Juni'; $monthArray[7] = 'Juli'; $monthArray[8] = 'Augustus'; $monthArray[9] = 'September'; $monthArray[10] = 'Oktober'; $monthArray[11] = 'November'; $monthArray[12] = 'December'; return $monthArray[$number]; } function error($what) { return "
Er is een fout opgetreden (".$what."). Probeer opnieuw of waarschuw de webmaster
"; } function errorShort($what) { return "
Fout: ".$what."
"; } function succes($what) { return "
Succes: ".$what."
"; } function headTitle($what) { return "
".$what."
"; } function get_ip() { return $_SERVER['REMOTE_ADDR']; } function getDateName($datum) { $jaar = substr($datum, 0, 4); $maand_int = substr($datum, 5, 2); $dag = substr($datum, 8, 2); if(substr($datum, 5, 1) == 0) { $maand_int = substr($datum, 6, 1); } return "".intval($dag)." ".ucfirst(strtolower(getMonthName($maand_int)))." ".$jaar.""; } function getDateTimeName($datum) { $jaar = substr($datum, 0, 4); $maand_int = substr($datum, 5, 2); $dag = substr($datum, 8, 2); $tijd = substr($datum, 11, 5); if(substr($datum, 5, 1) == 0) { $maand_int = substr($datum, 6, 1); } return "".intval($dag)." ".ucfirst(strtolower(getMonthName($maand_int)))." ".$jaar." ".$tijd; } function getDateNumbers($datum) { $jaar = substr($datum, 0, 4); $maand_int = substr($datum, 5, 2); $dag = substr($datum, 8, 2); return "".$dag."-".$maand_int."-".$jaar.""; } function getDateTimeNumbers($datum) { $jaar = substr($datum, 0, 4); $maand_int = substr($datum, 5, 2); $dag = substr($datum, 8, 2); $tijd = substr($datum, 11, 5); return "".$dag."-".$maand_int."-".$jaar." ".$tijd.""; } function getYear($date) { return substr($date, 0, 4); } function getMonth($date) { return substr($date, 5, 2); } function getDay($date) { return intval(substr($date, 8, 2)); } function getDay2($date) { return substr($date, 8, 2); } function getHour($date) { return intval(substr($date, 11, 2)); } function getMinutes($date) { return substr($date, 14, 2); } function getSeconds($date) { return substr($date, 16, 2); } //Get a date to put in a dateTime field of a database function getFixedDateTime($date_year, $date_month, $date_day, $date_hour = 0, $date_minutes = 0) { if($date_month < 10) { $date_month = "0".$date_month; } if($date_day < 10) { $date_day = "0".$date_day; } if($date_hour < 10) { $date_hour = "0".$date_hour; } if($date_minutes < 10) { $date_minutes = "0".$date_minutes; } return "".$date_year."-".$date_month."-".$date_day." ".$date_hour.":".$date_minutes.":00"; } //Function to get the right image path // NOT IN USE ANYMORE FOR NEW WEBSITES function replaces($txt, $cms_path, $url = "") { $find = ") $i = 0; while($i < $txt_length) { if(substr($txt, $i, $path_length) == $path) { $found++; } $i++; } //img is found if($found > 0) { $count = 0; $i = 0; while($count < $found) { $i++; if(substr($return, $i, $path_length) == $path) { $count++; //found one $start = $i; $stop = $i; $i = 0; while(substr($return, $start, 4) != " 0) { $start--; } while(substr($return, $stop, 2) != "/>" && strlen($return) > $stop) { $stop++; } $stop += 2; if(strlen($path_new) > 1) { //new image here $size = getimagesize($path_new); $r_string = substr($return, 0, $start); $r_string .= "\"".$alt_new."\""; $r_string .= substr($return, $stop, strlen($return)); $return = $r_string; }else { //no new image, just remove the old image $return = substr($return, 0, $start).substr($return, $stop, strlen($return)); } } } } return $return; } function getRightNotation($notationNr, $text) { //removed functions return $text; } function check_file_extension($file_mimetype, $allowed_extensions = "") { // @paramater $file : the filetype (mime) to check // @paramater $allowed_extensions : the allowed extensions whitespace seperated, if empty all listed are oke // @return "true"(string) if extension ok, else string with error //Convert string with allowed extensions to array $allowed_extensions = explode(" ", $allowed_extensions); //All know extensions and there mimetypes in 2 array's //These two array's must for each extionsion contain the mimetype in the same place in the array $extensions = array('jpeg', 'jpg', 'gif', 'png', 'html', 'wma', 'doc', 'pdf', 'ai', 'eps', 'rtf', 'xls', 'ppt', 'mpp', 'gz', 'iii', 'wmf', 'pub', 'swf', 'zip', 'mp3', 'mp3', 'aif', 'ram', 'wav', 'bmp', 'css', 'htm', 'txt', 'mpeg', 'mpg', 'mov', 'asx', 'avi', 'docx', 'xlsx', 'pptx', 'avi', 'ppt'); $mimetypes = array('image/jpeg', 'image/jpg', 'image/gif', 'image/png', 'text/html', 'audio/x-ms-wma', 'application/msword', 'application/pdf', 'application/postscript', 'application/postscript', 'application/rtf', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.ms-project', 'application/x-gzip', 'application/x-iphone', 'application/x-msmetafile', 'application/x-mspublisher', 'application/x-shockwave-flash', 'application/zip', 'audio/mpeg', 'audio/mp3', 'audio/x-aiff', 'audio/x-pn-realaudio', 'audio/x-wav', 'image/bmp', 'text/css', 'text/html', 'text/plain', 'video/mpeg', 'video/mpeg', 'video/quicktime', 'video/x-ms-asf', 'video/x-msvideo', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'video/avi', 'application/vnd.ms-powerpoint'); //check if mimetype of file is in array of known mimetypes if(in_array($file_mimetype, $mimetypes)) { //mime type found if(count($allowed_extensions) < 2) { // all listed extensions/mimetypes are OK, return true return "true"; }else { //check if mimetype is OK $found_extension = ""; //Search for the array position of the mimetype for($i = 0; $i < count($mimetypes); $i++) { if($mimetypes[$i] == $file_mimetype) $found_extension = $extensions[$i]; // extension is in the same position in the extensions array } //check if found extension is in the allowed extensions array if(in_array($found_extension, $allowed_extensions)) return "true"; else return "Dit type bestand kan hier niet worden ge-upload."; } }else { //mimetype unknown return "Dit type bestand is niet bekend in het systeem en kan niet worden ge-upload."; } } function file_upload_check($file_name = "new_file", $allowed_extensions = "", $max_bytes = 1000000) { //Check if an file is uploaded and no errors occured // Returns true if all checks are passed, else an string with an dutch error message to show on screen if(isset($_FILES[$file_name])) { // File does exist if($_FILES[$file_name]["error"] == UPLOAD_ERR_OK) { //No error found by PHP if($_FILES[$file_name]["size"] < $max_bytes) { //File not to big if(strlen($allowed_extensions) > 0) { //Get the name and the extension of the uploaded file $fileArray = explode("\\", $_FILES[$file_name]['name']); $number = count($fileArray) - 1; $fileName = strtolower($fileArray[$number]); $fileArray = explode(".", $fileName); $number = count($fileArray) - 1; $fileExt = $fileArray[$number]; //check if the extension of the file is in the array of allowed extensions if(in_array($fileExt, explode(" ", $allowed_extensions))) { return true; }else { return "Het bestand is van een niet toegestaan type."; } }else { return true; } }else { return "Het bestand is groter dan de maximale toegestane grootte."; } }else { return "Het uploaden is mislukt: foutcode: ".$_FILES[$file_name]["error"]; } }else { return "Het bestand is niet gevonden."; } } function create_thumb($src, $dst, $width=100, $height=100, $resizeBy="width", $quality=100, $resizeXY=false, $dieIfTooSmall=true) { //Function to create an thumbnail of another image // @ param // $src = source image path // $dst = path new image (thumbnail) // $width = width thumbnail // $height = height thumbnail // $streven = thumb must by exact "width", "height" or "both" is which case the new image may be out of balance // $quality= quality of new image in percent from 0 to 100, only for jpg and jpeg //extension of original image $extension = strtolower(end(explode(".", $src))); // Get source image switch($extension) { case 'jpg': $src_img = @imagecreatefromjpeg($src); break; case 'jpeg': $src_img = @imagecreatefromjpeg($src); break; case 'gif': $src_img = @imagecreatefromgif($src); break; break; case 'png': $src_img = @imagecreatefrompng($src); break; default: return "Kan geen thumbnail maken voor deze extensie: ".$extension; break; } if($src_img === false) { return "Kon image identifier niet creeeren. Controleer of het bestand bestaat en uit te lezen is"; } //get original width $src_width = imagesx($src_img); //get original height $src_height = imagesy($src_img); if(true) { // Calculate ratio's //get ratio min $ratio_x_min = ($src_width / $width); $ratio_y_min = ($src_height / $height); switch($resizeBy) { case 'width': //get ratio from width $ratio_x = ($src_width / $width); $ratio_y = $ratio_x; if($resizeXY == 'min') { if($ratio_y > $ratio_y_min) { $ratio_y = $ratio_x = $ratio_y_min; } }else if($resizeXY == 'max') { //die("test voor max"); if($ratio_y < $ratio_y_min) { $ratio_y = $ratio_x = $ratio_y_min; } } break; case 'height': //get ratio from height $ratio_y = ($src_height / $height); $ratio_x = $ratio_y; if($resizeXY == 'min') { if($ratio_x > $ratio_x_min) { $ratio_x = $ratio_y = $ratio_x_min; } }else if($resizeXY == 'max') { if($ratio_x < $ratio_x_min) { $ratio_x = $ratio_y = $ratio_x_min; } } break; case 'both': //get separate ratio's: this could bring the new image out of balance $ratio_x = ( $src_width / $width ); $ratio_y = ( $src_height / $height ); break; default: return "Incorrecte streefwaarde voor resizeBy"; break; } $dst_width = round( $src_width / $ratio_x ); $dst_height = round( $src_height / $ratio_y ); if(($dst_width > $src_width || $dst_height > $src_height) && $resizeBy != "both") { if($dieIfTooSmall) { return "Het aanmaken van de thumbnail is mislukt, afbeelding vergroten niet mogelijk"; }else { $dst_width = $src_width; $dst_height = $src_height; } } }else { //If both height and width had to be exact do this anyway the file is to small if($resizeBy == "both") { $ratio_x = ( $src_width / $width ); $ratio_y = ( $src_height / $height ); $dst_width = round( $src_width / $ratio_x ); $dst_height = round( $src_height / $ratio_y ); }else { $dst_width = $src_width; $dst_height = $src_height; } } // ImageCreateTrueColor only works for jpeg, jpg and png if($extension == "gif") $dst_img = imagecreate($dst_width, $dst_height); else $dst_img = imagecreatetruecolor($dst_width, $dst_height); //Resample image imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); // Output image switch($extension) { case 'jpg': $result = imagejpeg($dst_img, $dst, $quality); break; case 'jpeg': $result = imagejpeg($dst_img, $dst, $quality); break; case 'gif': $result = imagegif($dst_img, $dst); break; case 'png': $result = imagepng($dst_img, $dst); break; } //delete temporary image imagedestroy($dst_img); if($result == false) return "Het aanmaken van de thumbnail is mislukt, afbeelding output mislukt"; else return true; } function getFileExtensionUploadedFile($file_name = "new_file") { //Get the name and the extension of the uploaded file $fileArray = explode("\\", $_FILES[$file_name]['name']); $number = count($fileArray) - 1; $fileName = strtolower($fileArray[$number]); $fileArray = explode(".", $fileName); $number = count($fileArray) - 1; $fileExt = $fileArray[$number]; return $fileExt; } function getPriceInCent($euros, $cents) { return (100 * intval($euros)) + intval($cents); } function getCents($price) { //return cents string always 2 numbers $x = $price % 100; if(strlen($x) < 2) $x = "0".$x; return $x; } function getEuros($price) { return (int) floor($price / 100); } function getPrice($cents) { $euros ="".getEuros($cents); $cents = "".getCents($cents); if(strlen($euros) > 3) { $length = strlen($euros); $euros = substr($euros,0,$length-3).".".substr($euros,$length-3); } //substr($euros,1) return "".$euros.",".$cents; } function getNiceNumber($number) { $length = strlen($number); $niceNumber = ""; $teller = 0; for($i = $length; $i >= 0; $i--) { $teller++; if($i%3 == 0) { $niceNumber = substr($number,$i,1).".".$niceNumber; $teller = 0; }else { $niceNumber = substr($number,$i,1)."".$niceNumber; } } return $niceNumber; } //Random string, parameter = number of chars default = 6 function createString($p_iChrs = 6) { if(!is_Numeric($p_iChrs)){ $p_iChrs = 10; } $sReturn=""; $aInteger = range("0","9"); // Array 0 - 9 $aAlpha = range("a","z"); // Array a - z $aAlphaC = range("A","Z"); // Array A - Z $aChrs = array_merge($aInteger, $aAlpha, $aAlphaC); //create random string for($cnt=0;$cnt<$p_iChrs;$cnt++) { $sReturn.= $aChrs[rand(0,count($aChrs)-1)]; } return $sReturn; } function getBTW($price_cents) { return (intval($price_cents) / 100) * 19; } ?> Veenpop Festival Klazienaveen