"; $input = strip_tags($input, $allowable_tags); $input = htmlspecialchars($input); return $input; } function clean_data($input){ $input = nl2br($input); $input = addslashes($input); return $input; } function reverse_data($input){ $input = str_replace("
","",$input); return $input; } function makeSlug($string,$space="-") { if (function_exists('iconv')) { $string = @iconv('UTF-8', 'ASCII//TRANSLIT', $string); } $string = preg_replace("/[^a-zA-Z0-9 -]/", "", $string); $string = strtolower($string); $string = str_replace(" ", $space, $string); return $string; } function checkEmail($email){ // Check the @ symbol and the lenghts if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols return false; } // Split it into sections $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } function sanitize($input){ if(is_array($input)){ foreach($input as $k=>$i){ $output[$k]=sanitize($i); } } else{ if(get_magic_quotes_gpc()){ $input=stripslashes($input); } $output=mysql_real_escape_string($input); } return $output; } function sendMail($email, $subject, $body, $from = "info@kees-tm.nl", $fromname = "Kees TM Webmanager", $attach = ''){ require_once("libraries/phpmailer/class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsHTML(false); // HTML Mail $mail->From = $from; // Sender Email $mail->FromName = $fromname; // Sender Name $mail->Subject = $subject; // Subject $mail->Body = $body; // Content $mail->AddAddress($email, $email); // Add address if($attach){ $mail->AddAttachment($_SERVER['DOCUMENT_ROOT']."/media/uploads/cv/".$attach); } if($mail->Send()){ return true; } else return false; } function templateString($variable, $template){ require_once('libraries/smarty/Smarty.class.php'); $smarty = new Smarty(); $smarty->template_dir = SMARTY_TEMPLATEDIR; $smarty->compile_dir = SMARTY_COMPILEDIR; $smarty->cache_dir = SMARTY_CACHEDIR; $smarty->config_dir = SMARTY_CONFIGDIR; $smarty->assign('var', $variable); $string = $smarty->fetch($template); return $string; } function getYears($birthday){ list($year,$month,$day) = explode("-",$birthday); $year_diff = date("Y") - $year; $month_diff = date("m") - $month; $day_diff = date("d") - $day; if ($month_diff < 0) $year_diff--; elseif (($month_diff==0) && ($day_diff < 0)) $year_diff--; return $year_diff; } function generatePassword ($length = 8) { // start with a blank password $password = ""; // define possible characters $possible = "0123456789bcdfghjkmnpqrstvwxyz"; // set up a counter $i = 0; // add random characters to $password until $length is reached while ($i < $length) { // pick a random character from the possible ones $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); // we don't want this character if it's already in the password if (!strstr($password, $char)) { $password .= $char; $i++; } } // done! return $password; } function getAll($sql){ $sql = mysql_query($sql); while ($row = mysql_fetch_array($sql,MYSQL_ASSOC)){ $aReturn[] = $row; } return $aReturn; } function delete_directory($dirname) { if (is_dir($dirname)) $dir_handle = opendir($dirname); if (!$dir_handle) return false; while($file = readdir($dir_handle)) { if ($file != "." && $file != "..") { if (!is_dir($dirname."/".$file)) unlink($dirname."/".$file); else delete_directory($dirname.'/'.$file); } } closedir($dir_handle); rmdir($dirname); return true; } function convertdate($datum){ $date = explode("-", $datum); $new_date = $date[2]."-".$date[1]."-".$date[0]; return $new_date; } /**** Maak een pdf als factuur var $data object met orderdata var $products array met de producten return een opgeslagen pdf ****/ function makePDF($data, $products){ require_once('models/Pdf.php'); $pdf = new PDF(); $header = array('Artikel', 'Aantal', 'Prijs'); if(BTW_ON_BILL){ foreach($products as $key => $value){ $btw = 0; $btw += $value[2]*(BTW/100); $btw_key = $key + 1; } $products[$btw_key][0] = ''; $products[$btw_key][1] = 'incl. '.BTW.'% btw'; $products[$btw_key][2] = $btw; } if(SHIPPING){ $shipping = $btw_key + 1; $products[$shipping][0] = 'Verzendkosten'; $products[$shipping][1] = ''; $products[$shipping][2] = SHIPPING; } $pdf->AddPage(); $pdf->UserData($data); $pdf->FancyTable($header,$products); $pdfname = substr(sha1($data->lastname.$data->id), 0, 6); //$pdf->Output(); //Sla de pdf op op de server $pdf->Output('media/pdf/'.$pdfname.'.pdf', 'F'); } function redirectToIdeal($order, $products){ ### is gelijk aan 'Sleutel', zie uw dashboard onder tabblad "Certificaat uploaden" $shakey = "VE1sbW6VbwDjj704"; ### is gelijk aan 'Acceptant ID', zie uw dashboard onder tabblad "Gegevens Acceptant" $merchantID = "002015787"; ### subID niet wijzigen ### $subID = "0"; ### bedrag moet geconverteerd worden naar eurocenten ### $amount = 0; $orderNumber = $order->id; $paymentType = "ideal"; ### De geldigheid van de aanbieding zetten we in dit voorbeeld op een week ### $validUntil = date("Y-m-d\TG:i:s\Z",strtotime ("+1 week")); $aantal = count($products); $i = 1; foreach($products as $key => $value){ ### Maak de bestellijst ### ${itemNumber.$i} = $key; ${itemDescription.$i} = $value[0]; ${product.$i.number} = $value[1]; ${product.$i.price} = $value[2]; ### bereken alvast een deel van de SHA string ### $partOfSha = $partOfSha . ${itemNumber.$i} . ${itemDescription.$i} . ${product.$i.number} . ${product.$i.price}; $amount = $amount + (${product.$i.price} * ${product.$i.number}); $i++; } if(SHIPPING){ //Bezorgkosten ${itemNumber.$i} = 01; ${itemDescription.$i} = "Verzendkosten"; ${product.$i.number} = 1; ${product.$i.price} = SHIPPING; ### bereken alvast een deel van de SHA string ### $partOfSha = $partOfSha . ${itemNumber.$i} . ${itemDescription.$i} . ${product.$i.number} . ${product.$i.price}; $amount = $amount + ${product.$i.price}; $aantal += 1; } ### bouw de String op waarover een SHA1 moet worden berekend ### $shastring = $shakey . $merchantID . $subID . $amount . $orderNumber . $paymentType . $validUntil . $partOfSha ; ###speciale HTML entiteiten verwijderen: $clean_shaString = HTML_entity_decode($shastring); ### De tekens "\t", "\n", "\r", " " (spaties) mogen niet voorkomen in de string $not_allowed = array("\t", "\n", "\r", " "); $clean_shaString = str_replace($not_allowed, "",$clean_shaString); $shasign = sha1($clean_shaString); $redirect = IDEAL_URL."?amount=$amount&orderNumber=$orderNumber¤cy=EUR&purchaseID=$orderNumber&paymentType=$paymentType&validUntil=$validUntil&hash=$shasign&subID=$subID&merchantID=$merchantID&key=$shakey"; for($i=1;$i<=$aantal;$i++){ $redirect = $redirect . "&itemQuantity$i=${product.$i.number}&itemNumber$i=${itemNumber.$i}&itemDescription$i=${itemDescription.$i}&itemPrice$i=${product.$i.price}"; } return $redirect; } function setMoney($price){ setlocale(LC_MONETARY, 'it_IT'); $value = money_format('%.2n',($price)); $v1 = explode (".", $value) ; $bedrag = ''; $i=0; foreach ($v1 as $t) { if($t != '00'){ $bedrag .= $t; }else{ $bedrag .= '-'; } if(!$i){ $bedrag .= ','; } $i++; } return '€ '.$bedrag; } ?>
Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'PDO Connection Error: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname' in /www/htdocs/humantalentc/http/libraries/Doctrine/Connection.php:461 Stack trace: #0 /www/htdocs/humantalentc/http/libraries/Doctrine/Connection/Mysql.php(101): Doctrine_Connection->connect() #1 /www/htdocs/humantalentc/http/libraries/Doctrine/Connection.php(999): Doctrine_Connection_Mysql->connect() #2 /www/htdocs/humantalentc/http/libraries/Doctrine/Query/Abstract.php(981): Doctrine_Connection->execute('SELECT w.id AS ...', Array) #3 /www/htdocs/humantalentc/http/libraries/Doctrine/Query/Abstract.php(1025): Doctrine_Query_Abstract->_execute(Array) #4 /www/htdocs/humantalentc/http/libraries/Doctrine/Query.php(262): Doctrine_Query_Abstract->execute(Array, NULL) #5 /www/htdocs/humantalentc/http/libraries/Doctrine/Table.php(1272): Doctrine_Query->fetchOne(Array, NULL) #6 /www/htdocs/humantalentc/http/index.php(15): Doct in /www/htdocs/humantalentc/http/libraries/Doctrine/Connection.php on line 461