| 1 | <?php |
|---|
| 2 | // $Id: downloader.php,v 1.2 2005/03/18 12:51:55 onokazu Exp $ |
|---|
| 3 | // ------------------------------------------------------------------------ // |
|---|
| 4 | // XOOPS - PHP Content Management System // |
|---|
| 5 | // Copyright (c) 2000 XOOPS.org // |
|---|
| 6 | // <http://www.xoops.org/> // |
|---|
| 7 | // ------------------------------------------------------------------------ // |
|---|
| 8 | // This program is free software; you can redistribute it and/or modify // |
|---|
| 9 | // it under the terms of the GNU General Public License as published by // |
|---|
| 10 | // the Free Software Foundation; either version 2 of the License, or // |
|---|
| 11 | // (at your option) any later version. // |
|---|
| 12 | // // |
|---|
| 13 | // You may not change or alter any portion of this comment or credits // |
|---|
| 14 | // of supporting developers from this source code or any supporting // |
|---|
| 15 | // source code which is considered copyrighted (c) material of the // |
|---|
| 16 | // original comment or credit authors. // |
|---|
| 17 | // // |
|---|
| 18 | // This program is distributed in the hope that it will be useful, // |
|---|
| 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|---|
| 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|---|
| 21 | // GNU General Public License for more details. // |
|---|
| 22 | // // |
|---|
| 23 | // You should have received a copy of the GNU General Public License // |
|---|
| 24 | // along with this program; if not, write to the Free Software // |
|---|
| 25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
|---|
| 26 | // ------------------------------------------------------------------------ // |
|---|
| 27 | // Author: Kazumi Ono (AKA onokazu) // |
|---|
| 28 | // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // |
|---|
| 29 | // Project: The XOOPS Project // |
|---|
| 30 | // ------------------------------------------------------------------------- // |
|---|
| 31 | /** |
|---|
| 32 | * Sends non HTML files through a http socket |
|---|
| 33 | * |
|---|
| 34 | * @package kernel |
|---|
| 35 | * @subpackage core |
|---|
| 36 | * |
|---|
| 37 | * @author Kazumi Ono <[email protected]> |
|---|
| 38 | * @copyright copyright (c) 2000-2003 XOOPS.org |
|---|
| 39 | */ |
|---|
| 40 | class XoopsDownloader |
|---|
| 41 | { |
|---|
| 42 | |
|---|
| 43 | /**#@+ |
|---|
| 44 | * file information |
|---|
| 45 | */ |
|---|
| 46 | var $mimetype; |
|---|
| 47 | var $ext; |
|---|
| 48 | var $archiver; |
|---|
| 49 | /**#@-*/ |
|---|
| 50 | |
|---|
| 51 | /** |
|---|
| 52 | * Constructor |
|---|
| 53 | */ |
|---|
| 54 | function XoopsDownloader() |
|---|
| 55 | { |
|---|
| 56 | //EMPTY |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | /** |
|---|
| 60 | * Send the HTTP header |
|---|
| 61 | * |
|---|
| 62 | * @param string $filename |
|---|
| 63 | * |
|---|
| 64 | * @access private |
|---|
| 65 | */ |
|---|
| 66 | function _header($filename) |
|---|
| 67 | { |
|---|
| 68 | if (function_exists('mb_http_output')) { |
|---|
| 69 | mb_http_output('pass'); |
|---|
| 70 | } |
|---|
| 71 | header('Content-Type: '.$this->mimetype); |
|---|
| 72 | if (preg_match("/MSIE ([0-9]\.[0-9]{1,2})/", $_SERVER['HTTP_USER_AGENT'])) { |
|---|
| 73 | header('Content-Disposition: inline; filename="'.$filename.'"'); |
|---|
| 74 | header('Expires: 0'); |
|---|
| 75 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|---|
| 76 | header('Pragma: public'); |
|---|
| 77 | } else { |
|---|
| 78 | header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|---|
| 79 | header('Expires: 0'); |
|---|
| 80 | header('Pragma: no-cache'); |
|---|
| 81 | } |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | /** |
|---|
| 85 | * XoopsDownloader::addFile() |
|---|
| 86 | * |
|---|
| 87 | * @param string $filepath |
|---|
| 88 | * @param string $newfilename |
|---|
| 89 | **/ |
|---|
| 90 | function addFile($filepath, $newfilename=null) |
|---|
| 91 | { |
|---|
| 92 | //EMPTY |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | /** |
|---|
| 96 | * XoopsDownloader::addBinaryFile() |
|---|
| 97 | * |
|---|
| 98 | * @param string $filepath |
|---|
| 99 | * @param string $newfilename |
|---|
| 100 | **/ |
|---|
| 101 | function addBinaryFile($filepath, $newfilename=null) |
|---|
| 102 | { |
|---|
| 103 | //EMPTY |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | /** |
|---|
| 107 | * XoopsDownloader::addFileData() |
|---|
| 108 | * |
|---|
| 109 | * @param mixed $data |
|---|
| 110 | * @param string $filename |
|---|
| 111 | * @param integer $time |
|---|
| 112 | **/ |
|---|
| 113 | function addFileData(&$data, $filename, $time=0) |
|---|
| 114 | { |
|---|
| 115 | //EMPTY |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | /** |
|---|
| 119 | * XoopsDownloader::addBinaryFileData() |
|---|
| 120 | * |
|---|
| 121 | * @param mixed $data |
|---|
| 122 | * @param string $filename |
|---|
| 123 | * @param integer $time |
|---|
| 124 | **/ |
|---|
| 125 | function addBinaryFileData(&$data, $filename, $time=0) |
|---|
| 126 | { |
|---|
| 127 | //EMPTY |
|---|
| 128 | } |
|---|
| 129 | |
|---|
| 130 | /** |
|---|
| 131 | * XoopsDownloader::download() |
|---|
| 132 | * |
|---|
| 133 | * @param string $name |
|---|
| 134 | * @param boolean $gzip |
|---|
| 135 | **/ |
|---|
| 136 | function download($name, $gzip = true) |
|---|
| 137 | { |
|---|
| 138 | //EMPTY |
|---|
| 139 | } |
|---|
| 140 | } |
|---|
| 141 | ?> |
|---|