<?php include_once '../fns/sys_tempnam.php'; include_once '../common.php'; $tempnam = sys_tempnam('exportZip'); $fileSystem->exportZip($tempnam); header('Cache-Control: no-cache'); header('Content-Disposition: attachment; filename=gvirila-session-' . date('Y-m-d') . '.zip'); header('Content-Type: application/zip'); readfile($tempnam); unlink($tempnam);
function putFileContent($path, $content, $overwrite, &$mtime = null) { $this->sessionSuspend(); try { $ftp = $this->getConnection(); $splitPaths = Path::split($path); $fileName = array_pop($splitPaths); $this->chdir($ftp, $splitPaths); if (ftp_is_dir($ftp, $fileName)) { throw new NotAFileException($path); } if (ftp_is_file($ftp, $fileName) && !$overwrite) { throw new ItemAlreadyExistsException($path); } if ($mtime !== null) { $oldMtime = ftp_mdtm($ftp, $fileName); if ($oldMtime > $mtime) { throw new ModifiedDateException(); } } $tempnam = sys_tempnam('ftpupload'); file_put_contents($tempnam, $content); $f = fopen($tempnam, 'r'); $ok = @ftp_fput($ftp, $fileName, $f, FTP_BINARY, 0); fclose($f); unlink($tempnam); if (!$ok) { throw new ReadWriteException($path); } $mtime = ftp_mdtm($ftp, $fileName); } catch (Exception $e) { $this->sessionResume(); throw $e; } $this->sessionResume(); }