3 * Copyright 2005, Fabio Bertagnin
4 * Copyright 2011, Franck Villaume - Capgemini
5 * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
6 * http://fusionforge.org
8 * This file is part of FusionForge.
10 * FusionForge is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 require_once dirname(__FILE__)."/../../env.inc.php";
26 require_once $gfcommon.'include/pre.php';
28 // the header that displays for the project portion of the plugin
30 $user = session_get_user(); // get the session user
32 if (!$user || !is_object($user)) {
33 exit_error(_('Invalid User'), 'home');
34 } elseif ( $user->isError() ) {
35 exit_error($user->getErrorMessage, 'home');
36 } elseif ( !$user->isActive()) {
37 exit_error(_('User not active'), 'home');
40 $type = getStringFromRequest('type');
41 $id = getStringFromRequest('id');
42 $pluginname = getStringFromRequest('pluginname');
43 $quota_management = plugin_get_object($pluginname);
46 exit_missing_param($_SERVER['HTTP_REFERER'],array(_('No TYPE specified')),'home');
48 exit_missing_param($_SERVER['HTTP_REFERER'],array(_('No ID specified')),'home');
50 if ($type == 'group') {
51 $group = group_get_object($id);
55 if (!$group->usesPlugin($pluginname)) {//check if the group has the quota_management plugin active
56 exit_error(sprintf(_('First activate the %s plugin through the Project\'s Admin Interface'),$pluginnname),'home');
58 $userperm = $group->getPermission();//we'll check if the user belongs to the group (optional)
59 if (!$userperm->IsMember()) {
60 exit_permission_denied(_('You are not a member of this project'),'home');
62 $quota_management->quota_management_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($id))));
63 include 'quota_management/www/quota_project.php';
64 } elseif ($type == 'admin') {
65 $group = group_get_object($id);
69 if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the quota_management plugin active
70 exit_error(sprintf(_('First activate the %s plugin through the Project\'s Admin Interface'),$pluginnname),'home');
72 $userperm = $group->getPermission();//we'll check if the user belongs to the group
73 if ( !$userperm->IsMember()) {
74 exit_permission_denied(_('You are not a member of this project'),'home');
76 //only project admin can access here
77 if ( $userperm->isAdmin() ) {
78 $quota_management->quota_management_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($id))));
79 include 'quota_management/www/quota_project.php';
81 exit_permission_denied(_('You are not Admin of this project'), 'home');
86 site_project_footer(array());
90 // c-file-style: "bsd"