File: download.php

package info (click to toggle)
gforge 4.5.14-22etch13
  • links: PTS
  • area: main
  • in suites: etch
  • size: 13,004 kB
  • ctags: 11,918
  • sloc: php: 36,047; sql: 29,050; sh: 10,538; perl: 6,496; xml: 3,810; makefile: 341; python: 263; ansic: 256
file content (69 lines) | stat: -rw-r--r-- 1,705 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
  *
  * SourceForge Generic Tracker facility
  *
  * SourceForge: Breaking Down the Barriers to Open Source Development
  * Copyright 1999-2001 (c) VA Linux Systems
  * http://sourceforge.net
  *
  * @version   $Id: download.php 2973 2004-04-20 08:33:34Z gsmet $
  *
  */

$no_gz_buffer=true;

require_once('pre.php');
require_once('common/tracker/Artifact.class');
require_once('common/tracker/ArtifactFile.class');
//require_once('www/tracker/include/ArtifactFileHtml.class');
require_once('common/tracker/ArtifactType.class');
require_once('common/tracker/ArtifactType.class');

$arr=explode('/',$REQUEST_URI);
$group_id=$arr[3];
$atid=$arr[4];
$aid=$arr[5];
$file_id=$arr[6];

if (!$group_id) {
	exit_no_group();
}
//
//  get the Group object
//
$group =& group_get_object($group_id);
if (!$group || !is_object($group) || $group->isError()) {
	exit_no_group();
}

//
//  Create the ArtifactType object
//
$ath = new ArtifactType($group,$atid);
if (!$ath || !is_object($ath)) {
	exit_error('Error','ArtifactType could not be created');
}
if ($ath->isError()) {
	exit_error('Error',$ath->getErrorMessage());
}

$ah=new Artifact($ath,$aid);
if (!$ah || !is_object($ah)) {
	exit_error('ERROR','Artifact Could Not Be Created');
} else if ($ah->isError()) {
	exit_error('ERROR',$ah->getErrorMessage());
} else {
	$afh=new ArtifactFile($ah,$file_id);
	if (!$afh || !is_object($afh)) {
		exit_error('ERROR','ArtifactFile Could Not Be Created');
	} else if ($afh->isError()) {
		exit_error('ERROR',$afh->getErrorMessage());
	} else {
		Header ('Content-disposition: filename="'.str_replace('"', '', $afh->getName()).'"');
		Header ("Content-type: ".$afh->getType());
		echo $afh->getData();
	}
}

?>