1: <?php
2: /**
3: * XOOPS downloader
4: *
5: * You may not change or alter any portion of this comment or credits
6: * of supporting developers from this source code or any supporting source code
7: * which is considered copyrighted (c) material of the original comment or credit authors.
8: * This program is distributed in the hope that it will be useful,
9: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11: *
12: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
13: * @license GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html)
14: * @package kernel
15: * @since 2.0.0
16: * @author Kazumi Ono <onokazu@xoops.org>
17: */
18:
19: defined('XOOPS_ROOT_PATH') || exit('Restricted access');
20:
21: /**
22: * Sends non HTML files through a http socket
23: *
24: */
25: class XoopsDownloader
26: {
27: /**
28: * *#@+
29: * file information
30: */
31: public $mimetype;
32: public $ext;
33: public $archiver;
34: /**
35: * *#@-
36: */
37:
38: /**
39: * Constructor
40: */
41:
42: public function __construct()
43: {
44: // EMPTY
45: }
46:
47: /**
48: * Send the HTTP header
49: *
50: * @param string $filename
51: * @access private
52: */
53: public function _header($filename)
54: {
55: if (function_exists('mb_http_output')) {
56: mb_http_output('pass');
57: }
58: header('Content-Type: ' . $this->mimetype);
59: if (preg_match("/MSIE (\d\.\d{1,2})/", $_SERVER['HTTP_USER_AGENT'])) {
60: header('Content-Disposition: attachment; filename="' . $filename . '"');
61: header('Expires: 0');
62: header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
63: header('Pragma: public');
64: } else {
65: header('Content-Disposition: attachment; filename="' . $filename . '"');
66: header('Expires: 0');
67: header('Pragma: no-cache');
68: }
69: }
70:
71: /**
72: * XoopsDownloader::addFile()
73: *
74: * @param string $filepath
75: * @param string $newfilename
76: */
77: public function addFile($filepath, $newfilename = null)
78: {
79: // EMPTY
80: }
81:
82: /**
83: * XoopsDownloader::addBinaryFile()
84: *
85: * @param string $filepath
86: * @param string $newfilename
87: */
88: public function addBinaryFile($filepath, $newfilename = null)
89: {
90: // EMPTY
91: }
92:
93: /**
94: * XoopsDownloader::addFileData()
95: *
96: * @param mixed $data
97: * @param string $filename
98: * @param integer $time
99: */
100: public function addFileData(&$data, $filename, $time = 0)
101: {
102: // EMPTY
103: }
104:
105: /**
106: * XoopsDownloader::addBinaryFileData()
107: *
108: * @param mixed $data
109: * @param string $filename
110: * @param integer $time
111: */
112: public function addBinaryFileData(&$data, $filename, $time = 0)
113: {
114: // EMPTY
115: }
116:
117: /**
118: * XoopsDownloader::download()
119: *
120: * @param string $name
121: * @param boolean $gzip
122: */
123: public function download($name, $gzip = true)
124: {
125: // EMPTY
126: }
127: }
128: