[Fusionforge-commits] r12393 - in trunk/src/plugins/mantisbt: action common www

Franck VILLAUME nerville at fusionforge.org
Sun Feb 27 11:52:26 CET 2011


Author: nerville
Date: 2011-02-27 11:52:25 +0100 (Sun, 27 Feb 2011)
New Revision: 12393

Modified:
   trunk/src/plugins/mantisbt/action/init.php
   trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php
   trunk/src/plugins/mantisbt/www/index.php
Log:
clean up & get init error

Modified: trunk/src/plugins/mantisbt/action/init.php
===================================================================
--- trunk/src/plugins/mantisbt/action/init.php	2011-02-26 18:26:20 UTC (rev 12392)
+++ trunk/src/plugins/mantisbt/action/init.php	2011-02-27 10:52:25 UTC (rev 12393)
@@ -32,7 +32,7 @@
 $confArr['mantisbtcreate'] = getIntFromRequest('mantisbtcreate');
 $confArr['mantisbtname'] = getStringFromRequest('mantisbtname');
 
-if (!$mantisbt->initialize($group_id,$confArr))
+if (!$mantisbt->initialize($group_id, $confArr))
 	session_redirect('/plugins/mantisbt/?type=group&group_id='.$group_id.'&pluginname=mantisbt&error_msg='.urlencode($group->getErrorMessage()));
 
 $feedback = _('MantisBT plugin successfully initialized.');

Modified: trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php
===================================================================
--- trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php	2011-02-26 18:26:20 UTC (rev 12392)
+++ trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php	2011-02-27 10:52:25 UTC (rev 12393)
@@ -476,13 +476,13 @@
 		$mantisbtConfArray = array();
 		$resIdProjetMantis = db_query_params('SELECT * FROM plugin_mantisbt WHERE id_group = $1', array($groupId));
 		if (!$resIdProjetMantis) {
-			$group->setError('getMantisBTId::error ' .db_error());
+			$group->setError('getMantisBTId::error '.db_error());
 			return $mantisbtConfArray;
 		}
 
 		$row = db_numrows($resIdProjetMantis);
 
-		if ($row == null || count($row)>2) {
+		if ($row == null || count($row) > 2) {
 			$mantisbtConfArray['id_mantisbt'] = 0;
 			return $mantisbtConfArray;
 		}
@@ -521,7 +521,7 @@
 			case 'project': {
 				global $group_id;
 				$params['group'] = $group_id;
-				$params['title'] = $this->name . ' Project Plugin!';
+				$params['title'] = $this->name.' Project Plugin!';
 				$params['pagename'] = $this->name;
 				$params['sectionvals'] = array(group_getname($group_id));
 				site_project_header($params);

Modified: trunk/src/plugins/mantisbt/www/index.php
===================================================================
--- trunk/src/plugins/mantisbt/www/index.php	2011-02-26 18:26:20 UTC (rev 12392)
+++ trunk/src/plugins/mantisbt/www/index.php	2011-02-27 10:52:25 UTC (rev 12393)
@@ -69,6 +69,9 @@
 		if (!$group->usesPlugin($mantisbt->name)) {//check if the group has the MantisBT plugin active
 			exit_error(sprintf(_('First activate the %s plugin through the Project\'s Admin Interface'), $mantisbt->name), 'home');
 		}
+		if ( $group->isError()) {
+			$error_msg .= $group->getErrorMessage();
+		}
 
 		$userperm = $group->getPermission($user);//we'll check if the user belongs to the group (optional)
 		if ( !$userperm->IsMember()) {
@@ -79,7 +82,11 @@
 
 		if ($mantisbtConf['id_mantisbt'] === 0) {
 			$warning_msg = _('The mantisbt plugin for this project is not initialized.');
-			session_redirect('/plugins/'.$mantisbt->name.'/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&view=init&warning_msg='.urlencode($warning_msg));
+			$redirect_url = '/plugins/'.$mantisbt->name.'/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&view=init&warning_msg='.urlencode($warning_msg);
+			if ($error_msg) {
+				$redirect_url .= '&error_msg='.urlencode($error_msg);
+			}
+			session_redirect($redirect_url);
 		}
 
 		if (!$mantisbtConf['sync_users']) {
@@ -164,6 +171,10 @@
 		if (!$group->usesPlugin($mantisbt->name)) {//check if the group has the MantisBT plugin active
 			exit_error(sprintf(_('First activate the %s plugin through the Project\'s Admin Interface'),$mantisbt->name),'home');
 		}
+		if ($group->isError()) {
+			$error_msg .= $group->getErrorMessage();
+		}
+
 		$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'));




More information about the Fusionforge-commits mailing list