diff --git a/core/src/plugins/access.fs/class.fsAccessDriver.php b/core/src/plugins/access.fs/class.fsAccessDriver.php index 9861e8b77e..42823f8a43 100644 --- a/core/src/plugins/access.fs/class.fsAccessDriver.php +++ b/core/src/plugins/access.fs/class.fsAccessDriver.php @@ -1236,6 +1236,22 @@ function readFile($filePathOrData, $headerType="plain", $localName="", $data=fal header('Content-Disposition: attachment; filename="' . basename($filePathOrData) . '"'); return; } + if($this->getFilteredOption("USE_XACCELREDIRECT", $this->repository->getId()) && $this->wrapperClassName == "fsAccessWrapper" && array_key_exists("X-Accel-Mapping",$_SERVER)){ + if(!$realfileSystem) $filePathOrData = fsAccessWrapper::getRealFSReference($filePathOrData); + $filePathOrData = str_replace("\\", "/", $filePathOrData); + $filePathOrData = SystemTextEncoding::toUTF8($filePathOrData); + $mapping = explode('=',$_SERVER['X-Accel-Mapping']); + $replacecount = 0; + $accelfile = str_replace($mapping[0],$mapping[1],$filePathOrData,$replacecount); + if($replacecount == 1){ + header("X-Accel-Redirect: $accelfile"); + header("Content-type: application/octet-stream"); + header('Content-Disposition: attachment; filename="' . basename($accelfile) . '"'); + return; + } else { + AJXP_Logger::logAction("error","Problem with X-Accel-Mapping for file $filePathOrData"); + } + } $stream = fopen("php://output", "a"); if($realfileSystem){ AJXP_Logger::debug("realFS!", array("file"=>$filePathOrData)); diff --git a/core/src/plugins/access.fs/manifest.xml b/core/src/plugins/access.fs/manifest.xml index 9c75565969..e78c93879b 100644 --- a/core/src/plugins/access.fs/manifest.xml +++ b/core/src/plugins/access.fs/manifest.xml @@ -14,6 +14,7 @@ + @@ -38,4 +39,4 @@ - \ No newline at end of file +