halgatewood / file-directory-list

Free Super Clean PHP File Directory Listing Script
https://halgatewood.com/free/file-directory-list/
360 stars 151 forks source link

Folder with dot/point inside are seen as file #16

Open advfr opened 6 years ago

advfr commented 6 years ago

Hello Hal and thank you for your great job ! Hey ! Am I the only one to see folders containing " . " inside as file, so not opening as a folder ? Can you try too ?

Thanks !

halgatewood commented 6 years ago

I am using the default PHP Function is_dir and I'm not sure what it can't handle the dot. I tried a test and the folder doesn't show up anywhere. I may try to look into again in the future, but not sure at the moment.

http://php.net/manual/en/function.is-dir.php

sneetsher commented 6 years ago

@advfr , you may try replace is_dir($d) with different method test false !== ($f = readdir($d))

source: https://php.net/manual/en/function.is-dir.php#76513

N0rdmann commented 5 years ago

+1

beeell1 commented 4 years ago

I have also encountered this problem some time ago. It seems that by replacing if( !$file_ext AND is_dir($file)) $file_ext = "dir"; with if( is_dir($file)) $file_ext = "dir"; in function display_block( $file ), the problem goes away. I think this is due to function ext($filename) returning true if the filename contains a ' . ' regardless of it being a directory or a file.

Hope this helps.

advfr commented 4 years ago

Hello Thanks you Guys.

Works fine beeell1 !

Thanks a lot !