5 * Copyright 2009-2010, Franck Villaume - Capgemini
6 * Copyright 2009, Fabien Dubois - Capgemini
7 * Copyright 2010, Antoine Mercadal - Capgemini
8 * http://fusionforge.org
10 * This file is part of FusionForge.
12 * FusionForge is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with FusionForge; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 require_once('../../env.inc.php');
28 require_once $gfcommon.'include/pre.php';
29 require_once $gfconfig.'plugins/mantisbt/config.php';
31 // the header that displays for the user portion of the plugin
32 function mantisbt_Project_Header($params) {
33 global $DOCUMENT_ROOT,$HTML,$id;
34 $params['toptab']='mantisbt';
37 * Show horizontal links
39 site_project_header($params);
42 // the header that displays for the project portion of the plugin
43 function mantisbt_User_Header($params) {
44 global $DOCUMENT_ROOT,$HTML,$user_id;
45 $params['toptab']='mantisbt';
46 $params['user']=$user_id;
48 * Show horizontal links
50 site_user_header($params);
53 if (!session_loggedin()) {
57 $user = session_get_user(); // get the session user
59 if (!$user || !is_object($user)) {
60 exit_error(_('Invalid User'),'home');
61 } else if ( $user->isError()) {
62 exit_error($user->isError(),'home');
63 } else if ( !$user->isActive()) {
64 exit_error(_('User not active'),'home');
67 $type = getStringFromRequest('type');
68 $id = getStringFromRequest('id');
69 $idProjetMantis = getIdProjetMantis($id);
70 $pluginname = getStringFromRequest('pluginname');
71 $feedback = htmlspecialchars(getStringFromRequest('feedback'));
72 $error_msg = htmlspecialchars(getStringFromRequest('error_msg'));
73 $warning_msg = htmlspecialchars(getStringFromRequest('warning_msg'));
76 $username = $user->getUnixName();
79 exit_missing_params($_SERVER['HTTP_REFERER'], array('No TYPE specified'),'mantisbt');
81 exit_missing_params($_SERVER['HTTP_REFERER'], array('No ID specified'),'mantisbt');
85 $group = group_get_object($id);
89 if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the MantisBT plugin active
90 exit_error(sprintf(_('First activate the %s plugin through the Project\'s Admin Interface'),$pluginname),'home');
92 $userperm = $group->getPermission($user);//we'll check if the user belongs to the group (optional)
93 if ( !$userperm->IsMember()) {
94 exit_permission_denied(_('You are not a member of this project'),'home');
98 $sort = getStringFromRequest('sort');
99 $dir = getStringFromRequest('dir');
100 $action = getStringFromRequest('action');
101 $idBug = getStringFromRequest('idBug');
102 $idNote = getStringFromRequest('idNote');
103 $idAttachment = getStringFromRequest('idAttachment');
104 $actionAttachment = getStringFromRequest('actionAttachment');
105 $page = getStringFromRequest('page');
107 // Si la variable $_GET['page'] existe...
108 if($page != null && $page != ''){
109 $pageActuelle=intval($page);
112 $pageActuelle=1; // La page actuelle est la n°1
117 if($idProjetMantis == 0){
118 exit_error(_('Uninitialized Project. Force his activation by desactivate/activate mantisbt for this project'),'home');
119 } else if (is_int($password)){
120 exit_error(_('Impossible de récupérer les identifiants de connexions depuis le LDAP'),'home');
123 mantisbt_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($id))));
124 include ('mantisbt/www/group/index.php');
129 $realuser = user_get_object($id);//
130 if (!($realuser) || !($realuser->usesPlugin($pluginname))) {
131 exit_error(sprintf(_('First activate the User\'s %s plugin through Account Maintenance Page'),$pluginname),'my');
133 if ( (!$user) || ($user->getID() != $id)) { // if someone else tried to access the private MantisBT part of this user
134 exit_permission_denied(sprintf(_('You cannot access other user\'s personal %s'),$pluginname),'my');
138 $username = $realuser->getUnixName();
141 $sort = getStringFromRequest('sort');
142 $dir = getStringFromRequest('dir');
143 $action = getStringFromRequest('action');
144 $idBug = getStringFromRequest('idBug');
146 $idNote = getStringFromRequest('idNote');
147 $page = getStringFromRequest('page');
148 // Si la variable $_GET['page'] existe...
149 if($page != null && $page != ''){
150 $pageActuelle=intval($page);
152 $pageActuelle=1; // La page actuelle est la n°1
157 if (!is_int($password)){
159 mantisbt_User_Header(array('title'=>'My '.$pluginname,'pagename'=>"$pluginname",'sectionvals'=>array($realuser->getUnixName())));
160 include ('mantisbt/www/user/index.php');
162 exit_error(_('Impossible de récupérer les identifiants de connexions depuis le LDAP'),'home');
167 $group = group_get_object($id);
171 if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the MantisBT plugin active
172 exit_error(sprintf(_('First activate the %s plugin through the Project\'s Admin Interface'),$pluginname),'home');
174 $userperm = $group->getPermission($user);//we'll check if the user belongs to the group
175 if ( !$userperm->IsMember()) {
176 exit_permission_denied(_('You are not a member of this project'));
178 //only project admin can access here
179 if ( $userperm->isAdmin() ) {
180 // DO THE STUFF FOR THE PROJECT ADMINISTRATION PART HERE
181 mantisbt_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($id))));
182 include ('mantisbt/www/admin/index.php');
184 exit_permission_denied(_('You are not Admin of this project'),'home');
191 site_project_footer(array());
195 // c-file-style: "bsd"