<?php
function recursive_calcul($path,$init=false){
    global $size;
if ($init) { $size=$sizeG=0; $O=$file='';}
$size= (isset($size)) ? $size : 0;
$sizeG= (isset($sizeG)) ? $sizeG : 0;
    $O = @dir($path);
    if(!is_object($O))
    return false;
    while($file = $O -> read()){
        if($file != '.' && $file != '..') {
            if(is_file($path.'/'.$file)) {
           $sizeF=filesize($path.'/'.$file);
              $size+=$sizeF;
         } elseif(is_dir($path.'/'.$file)) recursive_calcul($path.'/'.$file);
         }
     }
    $O -> close();
    return round($size/1024,2);
}
function ajax_action_spe ($lib,$fct,$var,$txt,$id=''){
$f='onclick="{upload_ajax(\'retour_ajax_txt\',\''."%1\$s".'\',\''."%2\$s".'\', \''."%3\$s".'\', \''."%4\$s".'\'); montre(\'retour_ajax\'); document.getElementById(\''."%5\$s".'\').innerHTML=\''.SIZE.' 0 Ko\' ; false}"';
return sprintf($f,$lib,$fct,$var,$txt,$id);
}

## Remplacement des caratéres accentués et tous caratéres non imprimables
function clean_accents ($content){
$content = strtolower($content);
$content = stripslashes($content);
$array_1 = array("!","?",";","&","\"","'"," - ","^","\'","/","é","è","ê","ë","à","â","ù","û","ô","î","ï");
$array_2 = array("","","","-","","","-","+","'","-","e","e","e","e","a","a","u","u","o","i","i");
$content = str_replace($array_1, $array_2, $content);
return $content;
}

function delete_dbl_revisions () {
	$file_conf = $prev =array("");
	$nom=NewFct('cstr_liste',ADD_PATH_ADMIN.REP_DATA."bak/",'',true) ;
	$nom=array_reverse($nom);
	if (is_array($nom)) {
		while ($r=each($nom)){
			$n=NewFct('extract_nom_dater_evoluer',ADD_PATH_ADMIN.REP_DATA."bak/".$r['value'],"");
		   	if ( (!isset($prev[$n['titre']]))OR(count($prev)==0) ) {
				echo $n['titre'];
				$prev[$n['titre']]=$n['titre'];
				$n['titre']='';
			}
			else echo unlink($r['value']);
		}
		return true;
	}
	else return false;
}

?>