4 * FusionForge SCM Snapshots download page
6 * Copyright 1999-2001 (c) VA Linux Systems
7 * Copyright 2003-2004 (c) GForge
8 * Copyright 2010 (c) Franck Villaume
9 * http://fusionforge.org/
11 * This file is part of FusionForge.
13 * FusionForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
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
24 * along with FusionForge; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 // Snapshot downloads require the same permissions as SCM read access
46 if (!forge_check_perm ('scm', $group->getID(), 'read')) {
47 exit_permission_denied('home');
51 $group_name=$group->getUnixName();
53 $filename=$group_name.'-scm-latest.tar.gz';
55 if (file_exists(forge_get_config('scm_snapshots_path').'/'.$filename)) {
56 Header('Content-disposition: filename="'.str_replace('"', '', $filename).'"');
57 Header('Content-type: application/x-gzip');
58 $length = filesize(forge_get_config('scm_snapshots_path').'/'.$filename);
59 Header('Content-length: '.$length);
61 readfile_chunked(forge_get_config('scm_snapshots_path').'/'.$filename);
63 session_redirect(util_make_url('/404.php'));