diff --git a/sync.php b/sync.php index 7330b00..9e39dca 100644 --- a/sync.php +++ b/sync.php @@ -123,20 +123,18 @@ function getFileArray($foldername) { GLOBAL $localDir, $skip_filetype, $tempFilesArray; $dirhandle = @opendir($foldername); //öppnar mappen - $temp = 0; if($dirhandle !== false){ //gick det att öppna mappen? while($filename = readdir($dirhandle)){ //loopar igenom alla filer i mappen $filepath = $foldername ."/". $filename; - if($temp>1 && is_dir($filepath)){ //är det en mapp? + if($filename != "." && $filename != ".." && is_dir($filepath)){ //är det en mapp? getFileArray($filepath); } - else{ // its a file + else{ // its a file $filetype = ereg_replace("^.+\\.([^.]+)$", "\\1", $filename); if (!in_array($filetype, $skip_filetype)) { $tempFilesArray[] = array(filemtime($filepath),str_replace($localDir, "", $filepath),("http://".$_SERVER['SERVER_NAME'].str_replace("sync.php","",$_SERVER['SCRIPT_NAME']).$filepath),$filename); } } - $temp++; } } return $tempFilesArray;