r303: Added SVN constant to user files; now ISSO debug information shows SVN details.
[bugdar.git] / viewattachment.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
12
13 ob_start();
14
15 define('SVN', '$Id$');
16
17 require_once('./global.php');
18
19 $attachment = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE attachmentid = " . intval($bugsys->in['attachmentid']));
20 if (!$attachment)
21 {
22 $message->error('alert: bad attachment');
23 }
24
25 if (!can_perform('cangetattach') AND !can_perform('caneditattach'))
26 {
27 $message->error_permission();
28 }
29
30 ob_clean();
31 ob_end_clean();
32
33 if ($funct->fetch_extension($attachment['filename']) != 'txt')
34 {
35 header("Content-Disposition: inline; filename=$attachment[filename]");
36 header("Content-transfer-encoding: binary");
37 }
38 else
39 {
40 header("Content-Disposition: attachment; filename=$attachment[filename]");
41 }
42 header("Content-Length: " . strlen($attachment['attachment']));
43 header("Content-Type: $attachment[mimetype]");
44
45 print($attachment['attachment']);
46
47 /*=====================================================================*\
48 || ###################################################################
49 || # $HeadURL$
50 || # $Id$
51 || ###################################################################
52 \*=====================================================================*/
53 ?>