$filetypes = new filetypes(); $path = smartstrip($_REQUEST['path']); $group_folders = get_group_folders($GO_SECURITY->user_id, 0); if (is_group_folder($group_folders, $path) || $fs->has_read_permission($GO_SECURITY->user_id, $path) || $fs->has_write_permission($GO_SECURITY->user_id, $path)) { $filename = basename($path); $extension = get_extension($filename); $type = $filetypes->get_type($extension); $browser = detect_browser(); header('Content-Type: ' . $type['mime']); header('Content-Length: ' . $fs->chroot_filesize($path)); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); if ($browser['name'] == 'MSIE') { header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $filename . '"'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); } else { header('Content-Type: ' . $type['mime']); header('Pragma: no-cache'); header('Content-Disposition: attachment; filename="' . $filename . '"'); } header('Content-Transfer-Encoding: binary'); $fd = $fs->chroot_fopen($path, 'rb'); while (!feof($fd)) { print fread($fd, 32768); } fclose($fd); } else { header('Location: ' . $GO_CONFIG->host . 'error_docs/401.php'); exit; }