function getSubClass($fileName, $diskFile) { //php4 can't list subclasses of class, so we need to add each one here require_once "AudioFile.php"; require_once "ImageFile.php"; require_once "VideoFile.php"; require_once "ZipFile.php"; if (preg_match('/\\.([^.]{2,4}$)/', $fileName, $m)) { $ext = strtolower($m[1]); } else { return "PlainFile"; } if (ImageFile::validateExtension($ext)) { return "ImageFile"; } if (ZipFile::validateExtension($ext)) { return "ZipFile"; } $audioValid = AudioFile::validateExtension($ext); $videoValid = VideoFile::validateExtension($ext); if ($audioValid && $videoValid) { exec(escapeshellcmd("file " . $diskFile), $out, $ret_error); if (preg_match("/video/", $out[0]) || preg_match("/movie/", $out[0])) { return "VideoFile"; } else { return "AudioFile"; } } if ($audioValid) { return "AudioFile"; } if ($videoValid) { return "VideoFile"; } return "PlainFile"; }