/** * Start the dowload of a given patch */ public function downloadPatch() { if (!AccountManager::getInstance()->isLogged()) { return JsonResponseBuilder::failure(); } $FileFullPath = $this->getRequestVariable('FilePath'); $FileName = $this->getRequestVariable('FileName'); $patchID = $this->getRequestVariable('patchID'); $t = explode('/', $FileFullPath, 2); $FileLang = $t[0]; $FilePath = $t[1]; if ($patchID) { $patch = File::patchDiff($patchID); } else { $file = new File($FileLang, $FilePath . $FileName); $patch = $file->diff(); } $name = 'patch-' . time() . '.patch'; header("Content-Type: application/force-download; name=\"{$name}\""); header("Content-Transfer-Encoding: binary"); header("Content-Disposition: attachment; filename=\"{$name}\""); header("Expires: 0"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); return implode("\n", $patch); }