$nbpage)$page=$nbpage; $pluriel='';if($nbitems>1)$pluriel='s'; $pluriel1='';if($nbpage>1)$pluriel1='s'; $pagination='
'; if($option==0)$pagination.=''.number_format($nbitems,0,'',' ').' '; if($option!=-1)$pagination.=__('résultat','annonces').$pluriel.' /'; $pagination.=' '.$nbpage.' '.__('page','annonces').$pluriel1.'  ' . __('Page', 'annonces') . '   : '; $min=$page-$offset; if($min<1)$min=1; $max=$min+(2*$offset); if($max>=$nbpage){$max=$nbpage;$min=$max-(2*$offset)-1;} if($min<1)$min=1; $minto=$min - ($offset)-1; if($minto<1){$minto=1;} $maxto=$min + (3*$offset)+1; if($maxto>$nbpage){$max=$nbpage;} if($option<2){ // sens croissant if($min>1)$pagination.=''; else $pagination.='    '; for($i=$min;$i<=$max;$i++){ $selected='';if($i==$page)$selected='color:'.$slctdcolor.';background:'.$slctdbackground.';font-weight:bold;'; $pagination.=' '.$i.''; } if($max<$nbpage)$pagination.=''; } else{ // sens decroissant if($max<$nbpage)$pagination.=''; for($i=$max;$i>=$min;$i--){ $selected='';if($i==$page)$selected='color:'.$slctdcolor.';background:'.$slctdbackground.';font-weight:bold;'; $pagination.=''.$i.''; } if($min>1)$pagination.=''; else $pagination.='    '; } $pagination.='
'; return $pagination; } function slugify_nospace($text) { if (empty($text)) { return ''; }else{ $text = preg_replace('/\s/', '+', $text); $text = trim($text); } return $text; } function slugify($text) { $pattern = Array("é", "è", "ê", "ç", "à", "â", "î", "ï", "ù", "ô", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ö", "Ù", "Û", "Ü"); $rep_pat = Array("e", "e", "e", "c", "a", "a", "i", "i", "u", "o", "E", "E", "E", "E", "I", "I", "I", "I", "O", "U", "U", "U"); if (empty($text)) { return ''; } else { $text = str_replace($pattern, $rep_pat, utf8_decode($text)); $text = preg_replace('/\s/', '', $text); $text = trim($text); } return $text; } function slugify_accent_ut8($text){ $pattern = Array("/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/û/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/", "/’/","/"/"); $rep_pat = Array("é", "è", "ê", "ç", "à", "â", "î", "ï", "ù", "ô", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ö", "Ù", "Û", "Ü", "'",'"'); if ($text == '') { return ''; } else { $text = preg_replace($pattern, $rep_pat, ($text)); } return $text; } function slugify_accent($text){ $pattern = Array("/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/û/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/", "/’/","/"/"); $rep_pat = Array("é", "è", "ê", "ç", "à", "â", "î", "ï", "ù", "ô", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ö", "Ù", "Û", "Ü", "'",'"'); if ($text == '') { return ''; } else { $text = preg_replace($pattern, $rep_pat, utf8_decode($text)); } return $text; } public function slugify_noaccent($text){ $pattern = Array("/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/û/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/","/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/ù/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/","/'/"); $rep_pat = Array("e", "e", "e", "c", "a", "a", "i", "i", "u", "o", "E", "E", "E", "E", "I", "I", "I", "I", "O", "U", "U", "U","e", "e", "e", "c", "a", "a", "i", "i", "u", "o", "E", "E", "E", "E", "I", "I", "I", "I", "O", "U", "U", "U", "’"); if ($text == '') { return ''; } else { $text = preg_replace($pattern, $rep_pat, utf8_decode($text)); } return $text; } public function slugify_noaccent_no_utf8decode($text){ $pattern = Array("/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/û/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/","/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/ù/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/","/'/",'/"/'); $rep_pat = Array("e", "e", "e", "c", "a", "a", "i", "i", "u", "o", "E", "E", "E", "E", "I", "I", "I", "I", "O", "U", "U", "U","e", "e", "e", "c", "a", "a", "i", "i", "u", "o", "E", "E", "E", "E", "I", "I", "I", "I", "O", "U", "U", "U", "’","""); if ($text == '') { return ''; } else { $text = preg_replace($pattern, $rep_pat, $text); } return $text; } function make_recursiv_dir($directory) { $directoryComponent = explode('/',$directory); $str = ''; foreach($directoryComponent as $k => $component) { if((trim($component) != '') && (trim($component) != '..') && (trim($component) != '.')) { $str .= '/' . trim($component); if(long2ip(ip2long($_SERVER["REMOTE_ADDR"])) == '127.0.0.1') { if(!is_dir(substr($str,1)) && (!is_file(substr($str,1)) ) ) { mkdir( substr($str,1) ); } } else { if(!is_dir($str) && (!is_file($str) ) ) { mkdir( $str ); } } } } tools::changeAccesAuthorisation($directory); } function changeAccesAuthorisation($dir) { $tab=explode('/',$dir); $str=''; foreach($tab as $k => $v ) { if((trim($v)!='')) { $str.='/'.trim($v); if( (trim($v)!='..') &&(trim($v)!='.') ) { if(!is_dir(substr($str,1)) && (!is_file(substr($str,1)) ) ) { chmod(str_replace('//','/',$str), 0755); } } } } } function copyEntireDirectory($sourceDirectory, $destinationDirectory) { if(is_dir($sourceDirectory)) { if(!is_dir($destinationDirectory)) { mkdir($destinationDirectory, 0755, true); } $hdir = opendir($sourceDirectory); while($item = readdir($hdir)) { if(is_dir($sourceDirectory . '/' . $item) && ($item != '.') && ($item != '..') && ($item != '.svn') ) { tools::copyEntireDirectory($sourceDirectory . '/' . $item, $destinationDirectory . '/' . $item); } elseif(is_file($sourceDirectory . '/' . $item)) { copy($sourceDirectory . '/' . $item, $destinationDirectory . '/' . $item); } } closedir( $hdir ); } } }