function rfilesize($path) { if (!is_dir($path)) { return filesize($path); } else { $files = glob(rtrim($path, '/') . '/*'); $totalSize = 0; foreach ($files as $file) { $totalSize += rfilesize($file); } return $totalSize; } }
foreach ($filters['hide'] as $hidef) { if (preg_match($hidef, $file['raw'])) { $file['show'] = false; break; } } } if ($file['show']) { // Create a temporary list that can be sorted easily $templist[$n]['name'] = $file['name']; $templist[$n]['type'] = $file['type']; $templist[$n]['link'] = $file['link']; $templist[$n]['raw'] = $file['raw']; if ($conf['ShowSizes']) { if ($conf['FileSizeType'] == 'recursive') { $file['size'] = rfilesize($file['raw']); } elseif ($conf['FileSizeType'] == 'diskspace') { $file['size'] = filespace($file['raw']); } else { $file['size'] = filesize($file['raw']); } $totalsize += $templist[$n]['size'] = $file['size']; } if ($conf['ShowPerms']) { $file['perms'] = substr(sprintf('%o', fileperms($file['raw'])), -3); $templist[$n]['perms'] = $conf['FilePermsType'] == 'symbolic' ? oct2sym($file['perms']) : $file['perms']; } if ($conf['ShowModTimes']) { $file['modtime'] = filemtime($file['raw']); $templist[$n]['modtime'] = $file['modtime']; }