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.
14 * FusionForge is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * FusionForge is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with FusionForge; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 require_once('env.inc.php');
32 require_once $gfcommon.'include/pre.php';
34 // get current information
35 $group_id=getIntFromGet('group_id');
39 $group = group_get_object($group_id);
40 if (!$group || !is_object($group)) {
41 exit_error(_('Error creating group'),'home');
42 } else if ($group->isError()) {
43 exit_error($group->getErrorMessage(),'home');
46 // Tarball downloads require the same permissions as SCM read access
47 if (!forge_check_perm ('scm', $group->getID(), 'read')) {
48 exit_permission_denied('home');
51 $group_name=$group->getUnixName();
53 $filename=$group_name.'-scmroot.tar.gz';
55 if (file_exists(forge_get_config('scm_tarballs_path').'/'.$filename)) {
56 Header('Content-disposition: filename="'.str_replace('"', '', $filename).'"');
57 Header("Content-type: application/x-gzip");
58 $length = filesize(forge_get_config('scm_tarballs_path').'/'.$filename);
59 Header("Content-length: ".$length);
61 readfile_chunked(forge_get_config('scm_tarballs_path').'/'.$filename);
63 session_redirect('/404.php');