function getFile($pPath) { $pPath = urldecode($pPath); $filetype = $this->getFileType($pPath); if (substr($pPath, 0, strlen(FileManager::FILESYSTEM_PLUGIN_DOWNLOAD)) === FileManager::FILESYSTEM_PLUGIN_DOWNLOAD) { $path = substr($pPath, strlen(FileManager::FILESYSTEM_PLUGIN_DOWNLOAD) + 3); $path = explode('/', $path); $plugin = $path[0]; unset($path[0]); $path = implode('/', $path); require_once dirname(__FILE__) . '/PluginManager.php'; $pluginManager = new PluginManager($plugin); if ($pluginManager->isInstalled($plugin)) { $pluginManager->getView('download', $path); } } else { if (substr($pPath, 0, strlen(FileManager::FILESYSTEM_PLUGIN_PUBLIC)) === FileManager::FILESYSTEM_PLUGIN_PUBLIC) { $path = substr($pPath, strlen(FileManager::FILESYSTEM_PLUGIN_PUBLIC) + 3); $path = dirname(dirname(__FILE__)) . '/data/' . $path; } else { if (substr($pPath, 0, strlen(FileManager::FILESYSTEM_PLUGIN_PRIVATE)) === FileManager::FILESYSTEM_PLUGIN_PRIVATE) { $path = substr($pPath, strlen(FileManager::FILESYSTEM_PLUGIN_PRIVATE) + 3); $path = $this->userFolder . '.userfiles/' . $path; } else { if ($this->userFiles != null) { $path = $this->userFiles . $pPath; } else { die('noright'); } } } if (is_dir($path)) { ini_set("max_execution_time", 300); $uniquid = uniqid(); $filename = $path . '_' . $uniquid . '.zip.tmpdl'; shell_exec('cd ' . $path . ' && zip -r ' . $filename . ' . -x .\\* "*/\\.*"'); header('Content-Type: application/octet-stream'); header('Content-Transfer-Encoding: Binary'); header('Content-disposition: attachment; filename="' . basename($path) . '.zip"'); if (file_exists($filename)) { readfile($filename); unlink($filename); } } if (file_exists($path)) { if ($filetype == "music") { header('Content-Disposition: inline; filename="' . basename($path) . '"'); header("Content-type: audio/mpeg"); header("Content-Transfer-Encoding: binary"); //header("Content-Length: ".filesize($path).""); // Probleme mit Android App //header('X-Pad: avoid browser bug'); header('Accept-Ranges: bytes'); // It's there to move forward/backwards in track //header("Cache-Control: no-store, no-cache, must-revalidate"); //header("Cache-Control: post-check=0, pre-check=0", false); //header("Pragma: no-cache"); //header("Content-Type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3"); header("X-Sendfile: {$path}"); //readfile($path); } else { if ($filetype == "video") { header('Content-Disposition: inline; filename="' . basename($path) . '"'); header("Content-Transfer-Encoding: binary"); header("X-Sendfile: {$path}"); header("Content-type: video/mp4"); header('Accept-Ranges: bytes'); // It's there to move forward/backwards in track } else { header('Content-Type: application/octet-stream'); header('Content-Transfer-Encoding: Binary'); header('Content-disposition: attachment; filename="' . basename($path) . '"'); readfile($path); } } } } }