Shares: improved empty folder checking

This commit is contained in:
bergware
2023-04-26 10:49:00 +02:00
parent 98a2b44939
commit e580c16ccd

View File

@@ -14,8 +14,7 @@
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
if (isset($_POST['scan'])) {
$scan = $_POST['scan'];
die(is_dir("/mnt/user/$scan") ? (count(scandir("/mnt/user/$scan",SCANDIR_SORT_NONE))<=2 ? '1' : '0') : '1');
die((new \FilesystemIterator("/mnt/user/{$_POST['scan']}"))->valid() ? '0' : '1');
}
// add translations