read()) { if (!in_array($entry,$exclude_list)) { if (is_dir($dirName.'/'.$entry)) { if ($entry != 'CVS') { files::getDirList($dirName.'/'.$entry); } } else { $filelist[] = $dirName.'/'.$entry; } } } $d->close(); return array('dirs'=>$dirlist, 'files'=>$filelist); } function makePackage($name,$dir,$remove_path='',$gzip=true) { if ($gzip && !function_exists('gzcompress')) { return false; } if (($filelist = files::getDirList($dir)) === false) { return false; } $res = array ('name' => $name, 'dirs' => array(), 'files' => array()); foreach ($filelist['dirs'] as $v) { $res['dirs'][] = preg_replace('/^'.preg_quote($remove_path,'/').'/','',$v); } foreach ($filelist['files'] as $v) { $f_content = base64_encode(file_get_contents($v)); $v = preg_replace('/^'.preg_quote($remove_path,'/').'/','',$v); $res['files'][$v] = $f_content; } $res = serialize($res); if ($gzip) { $res = gzencode($res); } return $res; } } class path { function real($p,$strict=true) { $os = (DIRECTORY_SEPARATOR == '\\') ? 'win' : 'nix'; # Chemin absolu ou non ? if ($os == 'win') { $_abs = preg_match('/^\w+:/',$p); } else { $_abs = substr($p,0,1) == '/'; } # Transformation du chemin, forme std if ($os == 'win') { $p = str_replace('\\','/',$p); } # Ajout de la racine du fichier appelant si if (!$_abs) { $p = dirname($_SERVER['SCRIPT_FILENAME']).'/'.$p; } # Nettoyage $p = preg_replace('|/+|','/',$p); if (strlen($p) > 1) { $p = preg_replace('|/$|','',$p); } $_start = ''; if ($os == 'win') { list($_start,$p) = explode(':',$p); $_start .= ':/'; } else { $_start = '/'; } $p = substr($p,1); # Parcours $P = explode('/',$p); $res = array(); for ($i=0;$i 0) { array_pop($res); } } else { array_push($res,$P[$i]); } } $p = $_start.implode('/',$res); if ($strict && !@file_exists($p)) { return false; } return $p; } } ?>