5 * Copyright 2010, Roland Mas <lolando@debian.org>
7 * Thorsten Glaser <t.glaser@tarent.de>
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the Licence, or (at your option)
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 require_once ('../../../www/env.inc.php');
27 require_once $gfcommon.'include/pre.php';
28 require_once $gfwww.'scm/include/scm_utils.php';
30 $func = getStringFromRequest ('func') ;
33 if (preg_match('!^grouppage/([a-z][-a-z0-9_]+)(/.*)$!', $func, $matches)) {
34 $grp = util_ifsetor($matches[1]);
36 $grp = group_get_object_by_name($grp);
38 if ($grp && is_object($grp) && !$grp->isError()) {
39 session_redirect('/projects/' . $grp->getUnixName() . '/');
41 exit_error(sprintf(_('Cannot locate group for func=%s'), $func), 'scm');
45 case 'request-personal-repo':
46 $group_id = getIntFromRequest ('group_id') ;
47 session_require_perm ('scm', $group_id, 'write') ;
48 $user = session_get_user(); // get the session user
49 $result = db_query_params ('SELECT * FROM plugin_scmgit_personal_repos p WHERE p.group_id=$1 AND p.user_id=$2',
52 if ($result && db_numrows ($result) == 1) {
53 scm_header (array ('title' => _('SCM Repository'), 'group' => $group_id)) ;
54 echo _('You have already requested a personal Git repository for this project. If it does not exist yet, it will be created shortly.') ;
59 $glist = $user->getGroups() ;
60 foreach ($glist as $g) {
61 if ($g->getID() == $group_id) {
62 $result = db_query_params ('INSERT INTO plugin_scmgit_personal_repos (group_id, user_id) VALUES ($1,$2)',
66 scm_header (array ('title' => _('SCM Repository'), 'group' => $group_id)) ;
67 echo _('You have now requested a personal Git repository for this project. If will be created shortly.') ;
75 exit_missing_param () ;
81 // c-file-style: "bsd"