AddAddress($to); $mail->Subject = $subject; $mail->Body = $body; return $mail->Send(); } function erreur($message, $color="danger") { global $template; $template->assign('ERRmessage', $message); $template->assign('ERRcolor', $color); } function format_url($string) { $string = trim($string); if ( ctype_digit($string) ) { return $string; } else { // replace accented chars $accents = '/&([A-Za-z]{1,2})(grave|acute|circ|cedil|uml|lig);/'; $string_encoded = htmlentities($string,ENT_NOQUOTES,'UTF-8'); $string = preg_replace($accents,'$1',$string_encoded); // clean out the rest $replace = array('([\40\'/])','([^a-zA-Z0-9-])','(-{2,})'); $with = array('-','','-'); $string = preg_replace($replace,$with,$string); } return strtolower($string); } function pagination($nbPages, $page, $link = "documents-recents-") { $nbPages++; $cntPages = array(); if ($nbPages < 10) { for ($i = 1 ; $i <= $nbPages ; $i++) $cntPages[] = $i; } else { for ($i = 1 ; $i <= 4 ; $i++) $cntPages[] = $i; if (6 != max(6, $page)) $cntPages[] = "..."; for ($i = max(6, $page) - 1 ; $i < min(max(6, $page) + 3, $nbPages - 2) ; $i++) $cntPages[] = $i; if ($nbPages - 2 != max(6, $page) + 3 && $nbPages - 2 != $i) $cntPages[] = "..."; for ($i = $nbPages - 2 ; $i <= $nbPages ; $i++) $cntPages[] = $i; } $out = ""; foreach($cntPages as $p) { if ($p == "...") $out .= " ... "; else $out .= ' '.$p.' '; } return '<<'.$out.'>>'; } function eregmenu($pattern, $string) { return preg_match("#".$pattern."#ui", $string); } ?>