4 * SCM Tarballs download page
6 * Copyright 1999-2001 (c) VA Linux Systems
7 * Copyright 2003-2004 (c) GForge
8 * Copyright 2010 (c) Franck Villaume
9 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
10 * http://fusionforge.org/
12 * This file is part of FusionForge. FusionForge is free software;
13 * you can redistribute it and/or modify it under the terms of the
14 * GNU General Public License as published by the Free Software
15 * Foundation; either version 2 of the Licence, or (at your option)
18 * FusionForge 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.
23 * You should have received a copy of the GNU General Public License along
24 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 require_once('env.inc.php');
31 require_once $gfcommon.'include/pre.php';
33 // get current information
34 $group_id=getIntFromGet('group_id');
38 $group = group_get_object($group_id);
39 if (!$group || !is_object($group)) {
40 exit_error(_('Error creating group'),'home');
41 } else if ($group->isError()) {
42 exit_error($group->getErrorMessage(),'home');
45 // Tarball downloads require the same permissions as SCM read access
46 if (!forge_check_perm ('scm', $group->getID(), 'read')) {
47 exit_permission_denied('home');
50 $group_name=$group->getUnixName();
52 $filename=$group_name.'-scmroot.tar.gz';
54 if (file_exists(forge_get_config('scm_tarballs_path').'/'.$filename)) {
55 Header('Content-disposition: filename="'.str_replace('"', '', $filename).'"');
56 Header("Content-type: application/x-gzip");
57 $length = filesize(forge_get_config('scm_tarballs_path').'/'.$filename);
58 Header("Content-length: ".$length);
60 readfile_chunked(forge_get_config('scm_tarballs_path').'/'.$filename);
62 session_redirect('/404.php');