20 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
22 include_once
$GLOBALS['xoops']->path('class/downloader.php');
47 $this->archiver =
new zipfile();
48 $this->ext = trim(
$ext);
49 $this->mimeType = trim($mimyType);
57 function addFile($filepath, $newfilename = null)
60 $fp = fopen($filepath,
"r");
61 $data = fread($fp, filesize($filepath));
63 $filename = (isset($newfilename) && trim($newfilename) !=
'') ? trim($newfilename) : $filepath;
64 $this->archiver->addFile($data, $filename, filemtime($filename));
73 function addBinaryFile($filepath, $newfilename = null)
76 $fp = fopen($filepath,
"rb");
77 $data = fread($fp, filesize($filepath));
79 $filename = (isset($newfilename) && trim($newfilename) !=
'') ? trim($newfilename) : $filepath;
80 $this->archiver->addFile($data, $filename, filemtime($filename));
90 function addFileData(&$data, $filename,
$time = 0)
92 $this->archiver->addFile($data, $filename,
$time);
102 function addBinaryFileData(&$data, $filename,
$time = 0)
104 $this->addFileData($data, $filename,
$time);
113 function download($name, $gzip =
true)
115 $this->_header($name . $this->ext);
116 echo $this->archiver->file();