[Fusionforge-commits] r12400 - in trunk/src/plugins/mantisbt: action view/admin www www/admin

Franck VILLAUME nerville at fusionforge.org
Sun Feb 27 18:42:53 CET 2011


Author: nerville
Date: 2011-02-27 18:42:52 +0100 (Sun, 27 Feb 2011)
New Revision: 12400

Added:
   trunk/src/plugins/mantisbt/view/admin/viewConfiguration.php
Modified:
   trunk/src/plugins/mantisbt/action/addCategory.php
   trunk/src/plugins/mantisbt/action/deleteCategory.php
   trunk/src/plugins/mantisbt/view/admin/addCategory.php
   trunk/src/plugins/mantisbt/view/admin/addVersion.php
   trunk/src/plugins/mantisbt/view/admin/viewCategorie.php
   trunk/src/plugins/mantisbt/view/admin/viewVersion.php
   trunk/src/plugins/mantisbt/www/admin/index.php
   trunk/src/plugins/mantisbt/www/index.php
Log:
make it work ... numerous fix

Modified: trunk/src/plugins/mantisbt/action/addCategory.php
===================================================================
--- trunk/src/plugins/mantisbt/action/addCategory.php	2011-02-27 13:24:41 UTC (rev 12399)
+++ trunk/src/plugins/mantisbt/action/addCategory.php	2011-02-27 17:42:52 UTC (rev 12400)
@@ -1,6 +1,6 @@
 <?php
 /*
- * Copyright 2010, Franck Villaume - Capgemini
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  *
  * This file is part of FusionForge.
  *
@@ -20,20 +20,24 @@
  */
 
 /* addCategory action page */
+global $mantisbt;
+global $mantisbtConf;
+global $username;
+global $password;
 
 $nameCategory = $_POST['nameCategory'];
 
 if (!empty($nameCategory)) {
 	try {
-		$clientSOAP = new SoapClient(forge_get_config('server_url','mantisbt')."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
-		$clientSOAP->__soapCall('mc_project_add_category', array("username" => $username, "password" => $password, "p_project_id" => $idProjetMantis, "p_category_name" => $nameCategory));
+		$clientSOAP = new SoapClient($mantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
+		$clientSOAP->__soapCall('mc_project_add_category', array("username" => $username, "password" => $password, "p_project_id" => $mantisbtConf['id_mantisbt'], "p_category_name" => $nameCategory));
 	} catch (SoapFault $soapFault) {
 		$error_msg = _('Task failed:').' '.$soapFault->faultstring;
-		session_redirect('plugins/mantisbt/?type=admin&id='.$id.'&pluginname=mantisbt&error_msg='.urlencode($error_msg));
+		session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&error_msg='.urlencode($error_msg));
 	}
 	$feedback = _('Category added successfully');
-	session_redirect('plugins/mantisbt/?type=admin&id='.$id.'&pluginname=mantisbt&feedback='.urlencode($feedback));
+	session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&feedback='.urlencode($feedback));
 }
 $warning_msg = _('Missing category name');
-session_redirect('plugins/mantisbt/?type=admin&id='.$id.'&pluginname=mantisbt&warning_msg='.urlencode($warning_msg));
+session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&warning_msg='.urlencode($warning_msg));
 ?>

Modified: trunk/src/plugins/mantisbt/action/deleteCategory.php
===================================================================
--- trunk/src/plugins/mantisbt/action/deleteCategory.php	2011-02-27 13:24:41 UTC (rev 12399)
+++ trunk/src/plugins/mantisbt/action/deleteCategory.php	2011-02-27 17:42:52 UTC (rev 12400)
@@ -1,9 +1,9 @@
 <?php
-
 /*
- * Copyright 2010, Capgemini
- * Authors: Franck Villaume - capgemini
+ * MantisBT plugin
  *
+ * Copyright 2010-2011, Franck Villaume - Capgemini
+ *
  * This file is part of FusionForge.
  *
  * FusionForge is free software; you can redistribute it and/or modify
@@ -22,21 +22,25 @@
  */
 
 /* deleteCategory action page */
+global $mantisbt;
+global $mantisbtConf;
+global $username;
+global $password;
 
 $deleteCategory = $_POST['deleteCategory'];
 
 if ($deleteCategory) {
     try {
-	    $clientSOAP = new SoapClient("http://".forge_get_config('server','mantisbt')."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
-	    $clientSOAP->__soapCall('mc_project_delete_category', array("username" => $username, "password" => $password, "p_project_id" => $idProjetMantis, "p_category_name" => $deleteCategory));
+	    $clientSOAP = new SoapClient($mantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
+	    $clientSOAP->__soapCall('mc_project_delete_category', array("username" => $username, "password" => $password, "p_project_id" => $mantisbtConf['id_mantisbt'], "p_category_name" => $deleteCategory));
     } catch (SoapFault $soapFault) {
-        $msg = 'Error : '.$soapFault->faultstring;
-        session_redirect('plugins/mantisbt/?type=admin&id='.$id.'&pluginname=mantisbt&error_msg='.urlencode($msg));
+        $msg = _('Error:').' '.$soapFault->faultstring;
+        session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&error_msg='.urlencode($msg));
     }
-    $feedback = 'Opération réussie';
-    session_redirect('plugins/mantisbt/?type=admin&id='.$id.'&pluginname=mantisbt&feedback='.urlencode($feedback));
+    $feedback = sprintf(_('Category %s deleted successfully'), $deleteCategory);
+    session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&feedback='.urlencode($feedback));
 } else {
-    $warning = 'Param&egravetres manquants';
-    session_redirect('plugins/mantisbt/?type=admin&id='.$id.'&pluginname=mantisbt&warning_msg='.urlencode($warning));
+    $warning = _('Missing parameters to delete category');
+    session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&warning_msg='.urlencode($warning));
 }
 ?>

Modified: trunk/src/plugins/mantisbt/view/admin/addCategory.php
===================================================================
--- trunk/src/plugins/mantisbt/view/admin/addCategory.php	2011-02-27 13:24:41 UTC (rev 12399)
+++ trunk/src/plugins/mantisbt/view/admin/addCategory.php	2011-02-27 17:42:52 UTC (rev 12400)
@@ -1,6 +1,8 @@
 <?php
 /*
- * Copyright 2010, Franck Villaume - Capgemini
+ * MantisBT plugin
+ *
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  * http://fusionforge.org
  *
  * This file is part of FusionForge.
@@ -21,14 +23,18 @@
  */
 
 global $HTML;
+global $group_id;
+global $mantisbt;
 /* add category to a dedicated project */
 
-echo '<form method="POST" name="addCategory" action="index.php?type=admin&id='.$id.'&pluginname=mantisbt&action=addCategory">';
+echo '<form method="POST" name="addCategory" action="index.php?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&action=addCategory">';
+echo '<table><tr>';
 echo $HTML->boxTop(_('Add a new category'));
 echo '<td><input name="nameCategory" type="text"></input></td>';
 echo '<td>';
 echo '<input type="submit" value="'. _('Add') .'" />';
 echo '</td>';
 echo $HTML->boxBottom();
+echo '</tr></table>';
 echo '</form>';
 ?>

Modified: trunk/src/plugins/mantisbt/view/admin/addVersion.php
===================================================================
--- trunk/src/plugins/mantisbt/view/admin/addVersion.php	2011-02-27 13:24:41 UTC (rev 12399)
+++ trunk/src/plugins/mantisbt/view/admin/addVersion.php	2011-02-27 17:42:52 UTC (rev 12400)
@@ -1,6 +1,8 @@
 <?php
 /*
- * Copyright 2010, Franck Villaume - Capgemini
+ * MantisBT plugin
+ *
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  * http://fusionforge.org
  *
  * This file is part of FusionForge.
@@ -24,8 +26,11 @@
 
 global $HTML;
 global $group;
+global $group_id;
+global $mantisbt;
 
-echo '<form method="POST" name="addVersion" action="index.php?type=admin&id='.$id.'&pluginname=mantisbt&action=addVersion">';
+echo '<form method="POST" name="addVersion" action="index.php?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&action=addVersion">';
+echo '<table><tr>';
 echo $HTML->boxTop(_('Add a new version'));
 echo '<td>';
 echo '<input name="version" type="text" size="10" />';
@@ -37,5 +42,6 @@
 echo '<input type="submit" value="'. _('Add') .'" />';
 echo '</td>';
 echo $HTML->boxBottom();
+echo '</tr></table>';
 echo '</form>';
 ?>

Modified: trunk/src/plugins/mantisbt/view/admin/viewCategorie.php
===================================================================
--- trunk/src/plugins/mantisbt/view/admin/viewCategorie.php	2011-02-27 13:24:41 UTC (rev 12399)
+++ trunk/src/plugins/mantisbt/view/admin/viewCategorie.php	2011-02-27 17:42:52 UTC (rev 12400)
@@ -1,6 +1,8 @@
 <?php
 /*
- * Copyright 2010, Franck Villaume - Capgemini
+ * MantisBT plugin
+ *
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  * http://fusionforge.org
  *
  * This file is part of FusionForge.
@@ -22,62 +24,57 @@
 
 /* view categorie in MantisBt for the dedicated group */
 global $HTML;
-global $idProjetMantis;
+global $mantisbt;
+global $mantisbtConf;
+global $username;
+global $password;
+global $group_id;
 
 try {
 	/* do not recreate $clientSOAP object if already created by other pages */
 	if (!isset($clientSOAP))
-		$clientSOAP = new SoapClient(forge_get_config('server_url','mantisbt')."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
+		$clientSOAP = new SoapClient($mantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
 
-	$listCategories = $clientSOAP->__soapCall('mc_project_get_categories', array("username" => $username, "password" => $password, "project_id" => $idProjetMantis));
+	$listCategories = $clientSOAP->__soapCall('mc_project_get_categories', array("username" => $username, "password" => $password, "project_id" => $mantisbtConf['id_mantisbt']));
 } catch (SoapFault $soapFault) {
 	echo '<div class="warning" >'. _('Technical error occurs during data retrieving:'). ' ' .$soapFault->faultstring.'</div>';
 	$errorPage = true;
 }
 
 if (!isset($errorPage)){
-	echo $HTML->boxTop('Gestion des categories');
-	echo	'<table class="innertabs">';
-	echo		'<tr>';
-	echo			'<td class="FullBoxTitle">Catégorie</td>';
-	echo			'<td colspan="3" class="FullBoxTitle">Actions</td>';
-	echo		'</tr>';
-	$i = 0;
-	foreach ($listCategories as $key => $category){ 
-		if ( $i % 2 == 0 ) {
-			echo '<tr class="LignePaire">';
-		} else {
-			echo '<tr class="LigneImpaire">';
+	echo $HTML->boxTop(_('Manage categories'));
+	// General category is shared so no edit...
+	if (sizeof($listCategories) > 1) {
+		echo	'<table class="innertabs">';
+		echo		'<tr>';
+		echo			'<td class="FullBoxTitle">'._('Category').'</td>';
+		echo			'<td colspan="2" class="FullBoxTitle">'._('Actions').'</td>';
+		echo		'</tr>';
+		$i = 1;
+		foreach ($listCategories as $key => $category){
+			echo '<tr '.$HTML->boxGetAltRowStyle($i).'">';
+			if ( $category != 'General' ) {
+				echo '<td class="InText">'.$category.'</td>';
+				echo '<td>';
+				echo '<form method="POST" action="?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&action=renameCategory">';
+				echo '<input type="hidden" name="renameCategory" value="'.htmlspecialchars($category).'" />';
+				echo '<input name="newCategoryName" type="text"></input>';
+				echo '<input type="submit" value="'._('Rename').'" />';
+				echo '</td>';
+				echo '</form>';
+				echo '<td class="InText">';
+				echo '<form method="POST" action="?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&action=deleteCategory">';
+				echo '<input type="hidden" name="deleteCategory" value="'.htmlspecialchars($category).'" />';
+				echo '<input type="submit" value="'._('Delete').'" />';
+				echo '</form>';
+				echo '</td></tr>';
+				$i++;
+			}
 		}
-		if ( $category != 'General' ) {
-			echo '<td class="InText">'.$category.'</td>';
-			echo '<td>';
-
-			echo '<form method="POST" name="rename'.$i.'" action="index.php?type=admin&id='.$id.'&pluginname=mantisbt&action=renameCategory">';
-			echo '<input type="hidden" name="renameCategory" value="'.htmlspecialchars($category).'" />';
-			echo '<input name="newCategoryName" type="text"></input>';
-			echo '</td><td>';
-			print'<div style="float:left"><img src="'.util_make_url('themes/gforge/images/bouton_gauche.png').'"></img></div>
-				<div style="background: url('.util_make_url('themes/gforge/images/bouton_centre.png').');vertical-align:top;display:inline;font-size:15px">
-				<a href="javascript:document.rename'.$i.'.submit();" style="color:white;font-size:0.8em;font-weight:bold;">Renommer</a>
-				</div>
-				<div style="display:inline"><img src="'.util_make_url('themes/gforge/images/bouton_droit.png').'"></img></div>';
-			echo '</td>';
-			echo '</form>';
-			echo '<td class="InText">';
-			echo '<form method="POST" name="delete'.$i.'" action="index.php?type=admin&id='.$id.'&pluginname=mantisbt&action=deleteCategory">';
-			echo '<input type="hidden" name="deleteCategory" value="'.htmlspecialchars($category).'" />';
-			print'<div style="float:left"><img src="'.util_make_url('themes/gforge/images/bouton_gauche.png').'"></img></div>
-				<div style="background: url('.util_make_url('themes/gforge/images/bouton_centre.png').');vertical-align:top;display:inline;font-size:15px">
-				<a href="javascript:document.delete'.$i.'.submit();" style="color:white;font-size:0.8em;font-weight:bold;">Supprimer</a>
-				</div>
-				<div style="display:inline"><img src="'.util_make_url('themes/gforge/images/bouton_droit.png').'"></img></div>';
-			echo '</form>';
-			echo '</td></tr>';
-			$i++;
-		}
+		echo '</table>';
+	} else {
+		echo '<p class="warning">'._('No Categories').'</p>';
 	}
-	echo '</table>';
 	echo $HTML->boxBottom();
 }
 ?>

Copied: trunk/src/plugins/mantisbt/view/admin/viewConfiguration.php (from rev 12392, trunk/src/plugins/mantisbt/view/admin/viewVersion.php)
===================================================================
--- trunk/src/plugins/mantisbt/view/admin/viewConfiguration.php	                        (rev 0)
+++ trunk/src/plugins/mantisbt/view/admin/viewConfiguration.php	2011-02-27 17:42:52 UTC (rev 12400)
@@ -0,0 +1,35 @@
+<?php
+/*
+ * Copyright 2010-2011, Franck Villaume - Capgemini
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+/* view version of a dedicated group in MantisBt */
+
+/* main display */
+global $HTML;
+global $mantisbt;
+global $mantisbtConf;
+global $username;
+global $password;
+
+echo $HTML->boxTop(_('Manage configuration'));
+echo 'TO BE IMPLEMENTED';
+echo $HTML->boxBottom();
+?>

Modified: trunk/src/plugins/mantisbt/view/admin/viewVersion.php
===================================================================
--- trunk/src/plugins/mantisbt/view/admin/viewVersion.php	2011-02-27 13:24:41 UTC (rev 12399)
+++ trunk/src/plugins/mantisbt/view/admin/viewVersion.php	2011-02-27 17:42:52 UTC (rev 12400)
@@ -1,6 +1,6 @@
 <?php
 /*
- * Copyright 2010, Franck Villaume - Capgemini
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  * http://fusionforge.org
  *
  * This file is part of FusionForge.
@@ -24,54 +24,61 @@
 
 /* main display */
 global $HTML;
-global $idProjetMantis;
+global $mantisbt;
+global $mantisbtConf;
+global $username;
+global $password;
 
 try {
 	/* do not recreate $clientSOAP object if already created by other pages */
 	if (!isset($clientSOAP))
-		$clientSOAP = new SoapClient(forge_get_config('server_url','mantisbt')."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
+		$clientSOAP = new SoapClient($mantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
 
-	$listVersions = $clientSOAP->__soapCall('mc_project_get_versions', array("username" => $username, "password" => $password, "project_id" => $idProjetMantis));
+	$listVersions = $clientSOAP->__soapCall('mc_project_get_versions', array("username" => $username, "password" => $password, "project_id" => $mantisbtConf['id_mantisbt']));
 } catch  (SoapFault $soapFault) {
 	echo '<div class="warning" >'. _('Technical error occurs during data retrieving:'). ' ' .$soapFault->faultstring.'</div>';
 	$errorPage = true;
 }
 
 if (!isset($errorPage)){
-	echo $HTML->boxTop('Gestion des Versions');
-	echo '<table class="innertabs">';
-	echo	'<tr>';
-	echo		'<td class="FullBoxTitle">Version</td>';
-	echo		'<td class="FullBoxTitle">Date Livraison</td>';
-	echo		'<td class="FullBoxTitle">Type</td>';
-	echo 		'<td class="FullBoxTitle">Action</td>';
-	echo	'</tr>';
-	$i = 0;
-	foreach ($listVersions as $key => $version){
-		if ( $i % 2 == 0 ) {
-			echo '<tr class="LignePaire">';
-		} else {
-			echo '<tr class="LigneImpaire">';
+	echo $HTML->boxTop(_('Manage versions'));
+	if (sizeof($listVersions)) {
+		echo '<table class="innertabs">';
+		echo	'<tr>';
+		echo		'<td class="FullBoxTitle">'._('Version').'</td>';
+		echo		'<td class="FullBoxTitle">'._('Target Date').'</td>';
+		echo		'<td class="FullBoxTitle">'._('Type').'</td>';
+		echo 		'<td class="FullBoxTitle">'._('Action').'</td>';
+		echo	'</tr>';
+		$i = 0;
+		foreach ($listVersions as $key => $version){
+			if ( $i % 2 == 0 ) {
+				echo '<tr class="LignePaire">';
+			} else {
+				echo '<tr class="LigneImpaire">';
+			}
+			echo '<td class="InText">'.$version->name.'</td>';
+			echo '<td class="InText">'.strftime("%d/%m/%Y",strtotime($version->date_order)).'</td>';
+			/* est-ce une version release ? */
+			if ( $version->released ) {
+				echo '<td class="InText">Release</td>';
+			/* juste une milestone alors */
+			} else {
+				echo '<td class="InText">Milestone</td>';
+			}
+			echo '<td>';
+			print'<div style="float:left"><img src="'.util_make_url('themes/gforge/images/bouton_gauche.png').'"></img></div>
+				<div style="background: url('.util_make_url('themes/gforge/images/bouton_centre.png').');vertical-align:top;display:inline;font-size:15px">
+				<a href="?type='.$type.'&id='.$id.'&pluginname='.$pluginname.'&view=editVersion&idVersion='.$version->id.'" style="color:white;font-size:0.8em;font-weight:bold;">Modifier</a>
+				</div>
+				<div style="display:inline"><img src="'.util_make_url('themes/gforge/images/bouton_droit.png').'"></img></div>';
+			echo '</td></tr>';
+			$i++;
 		}
-		echo '<td class="InText">'.$version->name.'</td>';
-		echo '<td class="InText">'.strftime("%d/%m/%Y",strtotime($version->date_order)).'</td>';
-		/* est-ce une version release ? */
-		if ( $version->released ) {
-			echo '<td class="InText">Release</td>';
-		/* juste une milestone alors */
-		} else {
-			echo '<td class="InText">Milestone</td>';
-		}
-		echo '<td>';
-		print'<div style="float:left"><img src="'.util_make_url('themes/gforge/images/bouton_gauche.png').'"></img></div>
-			<div style="background: url('.util_make_url('themes/gforge/images/bouton_centre.png').');vertical-align:top;display:inline;font-size:15px">
-			<a href="?type='.$type.'&id='.$id.'&pluginname='.$pluginname.'&view=editVersion&idVersion='.$version->id.'" style="color:white;font-size:0.8em;font-weight:bold;">Modifier</a>
-			</div>
-			<div style="display:inline"><img src="'.util_make_url('themes/gforge/images/bouton_droit.png').'"></img></div>';
-		echo '</td></tr>';
-		$i++;
+		echo '</table>';
+	} else {
+		echo '<p class="warning">'._('No versions').'</p>';
 	}
-	echo '</table>';
 	echo $HTML->boxBottom();
 }
 

Modified: trunk/src/plugins/mantisbt/www/admin/index.php
===================================================================
--- trunk/src/plugins/mantisbt/www/admin/index.php	2011-02-27 13:24:41 UTC (rev 12399)
+++ trunk/src/plugins/mantisbt/www/admin/index.php	2011-02-27 17:42:52 UTC (rev 12400)
@@ -56,6 +56,7 @@
 			echo '</td><td valign="top">';
 			include ("mantisbt/view/admin/addVersion.php");
 			echo '</td></tr></table>';
+			include ("mantisbt/view/admin/viewConfiguration.php");
 		}
 		break;
 	}

Modified: trunk/src/plugins/mantisbt/www/index.php
===================================================================
--- trunk/src/plugins/mantisbt/www/index.php	2011-02-27 13:24:41 UTC (rev 12399)
+++ trunk/src/plugins/mantisbt/www/index.php	2011-02-27 17:42:52 UTC (rev 12400)
@@ -45,9 +45,21 @@
 $type = getStringFromRequest('type');
 $group_id = getIntFromRequest('group_id');
 if (!$type) {
-	exit_missing_params($_SERVER['HTTP_REFERER'], array('No TYPE specified'), 'mantisbt');
+	if (forge_get_config('use_ssl'))
+		$url = "https://";
+	else
+		$url = "http://";
+
+	$url .= forge_get_config('web_host');
+	exit_missing_param(substr($_SERVER['HTTP_REFERER'], strlen($url)), array('No TYPE specified'), 'mantisbt');
 } elseif (!$group_id) {
-	exit_missing_params($_SERVER['HTTP_REFERER'], array('No GROUP_ID specified'), 'mantisbt');
+	if (forge_get_config('use_ssl'))
+		$url = "https://";
+	else
+		$url = "http://";
+
+	$url .= forge_get_config('web_host');
+	exit_missing_param(substr($_SERVER['HTTP_REFERER'], strlen($url)), array('No GROUP_ID specified'), 'mantisbt');
 }
 
 $user_id = getIntFromRequest('user_id');
@@ -177,18 +189,27 @@
 
 		$userperm = $group->getPermission($user);//we'll check if the user belongs to the group
 		if (!$userperm->IsMember()) {
-			exit_permission_denied(_('You are not a member of this project'));
+			exit_permission_denied(_('You are not a member of this project'), 'home');
 		}
 
 		switch ($action) {
-			case "init":
+			case "init": {
+				global $gfplugins;
+				include($gfplugins.$mantisbt->name.'/action/'.$action.'.php');
+				break;
+			}
 			case "addCategory":
 			case "addVersion":
 			case "renameCategory":
 			case "deleteCategory":
 			case "deleteVersion":
-			case "updateVersion":  {
+			case "updateVersion": {
 				global $gfplugins;
+				$mantisbtConf = $mantisbt->getMantisBTConf();
+				if (!$mantisbtConf['sync_users']) {
+					$username = $mantisbtConf['soap_user'];
+					$password = $mantisbtConf['soap_password'];
+				}
 				include($gfplugins.$mantisbt->name.'/action/'.$action.'.php');
 				break;
 			}
@@ -196,20 +217,24 @@
 
 		$mantisbt->getHeader('project');
 		//only project admin can access here
-		if ($userperm->isAdmin()) {
-			switch ($view) {
-				case "init": {
-					$mantisbt->getInitDisplay();
-					break;
+		if (!$userperm->isAdmin()) {
+			exit_permission_denied(_('You are not Admin of this project'), 'mantisbt');
+		}
+
+		switch ($view) {
+			case "init": {
+				$mantisbt->getInitDisplay();
+				break;
+			}
+			default: {
+				$mantisbtConf = $mantisbt->getMantisBTConf();
+				if (!$mantisbtConf['sync_users']) {
+					$username = $mantisbtConf['soap_user'];
+					$password = $mantisbtConf['soap_password'];
 				}
-				default: {
-					$mantisbtConf = $mantisbt->getMantisBTConf();
-					$mantisbt->getAdminView();
-					break;
-				}
+				$mantisbt->getAdminView();
+				break;
 			}
-		} else {
-			exit_permission_denied(_('You are not Admin of this project'), 'home');
 		}
 		break;
 	}




More information about the Fusionforge-commits mailing list