]>
src.bluestatic.org Git - bugdar.git/blob - viewattachment.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
24 define('SVN', '$Id$');
26 $focus['showreport
'] = 'focus
';
28 require_once('./global.php
');
30 $attachment = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE attachmentid = " . intval($bugsys->in['attachmentid
']));
33 $message->error($lang->getlex('error_invalid_id
'));
36 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $attachment[bugid]");
37 if (($bug['hidden
'] AND !can_perform('canviewhidden
', $bug['productid
'])) OR !can_perform('canviewbugs
', $bug['productid
']))
39 $message->error_permission();
42 if (!can_perform('cangetattach
', $bug['productid
']))
44 $message->error_permission();
50 if ($funct->fetch_extension($attachment['filename
']) != 'txt
')
52 header("Content-Disposition: inline; filename=$attachment[filename]");
53 header("Content-transfer-encoding: binary");
57 header("Content-Disposition: attachment; filename=$attachment[filename]");
59 header("Content-Length: " . strlen($attachment['attachment
']));
60 header("Content-Type: $attachment[mimetype]");
62 print($attachment['attachment
']);
64 /*=====================================================================*\
65 || ###################################################################
68 || ###################################################################
69 \*=====================================================================*/