[Fusionforge-commits] r8633 - trunk/gforge/www/project/admin

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Tue Jan 5 18:20:32 CET 2010


Author: aljeux
Date: 2010-01-05 18:20:31 +0100 (Tue, 05 Jan 2010)
New Revision: 8633

Modified:
   trunk/gforge/www/project/admin/roleedit.php
Log:
Prevent creation of empty role name

Modified: trunk/gforge/www/project/admin/roleedit.php
===================================================================
--- trunk/gforge/www/project/admin/roleedit.php	2010-01-05 17:20:24 UTC (rev 8632)
+++ trunk/gforge/www/project/admin/roleedit.php	2010-01-05 17:20:31 UTC (rev 8633)
@@ -67,25 +67,29 @@
 	}
 
 	if (getStringFromRequest('submit')) {
-		$role_name = getStringFromRequest('role_name');
-		if (!$role_id) {
-			$role_id=$role->create($role_name,$data);
+		$role_name = trim(getStringFromRequest('role_name'));
+		if (!$role_name) {
+			$feedback .= ' Missing Role Name ';
+		} else {
 			if (!$role_id) {
-				$feedback = $role->getErrorMessage();
+				$role_id=$role->create($role_name,$data);
+				if (!$role_id) {
+					$feedback .= $role->getErrorMessage();
+				} else {
+					$feedback = _('Successfully Created New Role');
+				}
 			} else {
-				$feedback = _('Successfully Created New Role');
+				if (!$role->update($role_name,$data)) {
+					$feedback .= $role->getErrorMessage();
+				} else {
+					$feedback = _('Successfully Updated Role');
+				}
 			}
-		} else {
-			if (!$role->update($role_name,$data)) {
-				$feedback = $role->getErrorMessage();
-			} else {
-				$feedback = _('Successfully Updated Role');
-			}
-		}
-		//plugin webcal
+			//plugin webcal
 			//change assistant for webcal
 			$params = getIntFromRequest('group_id');
-			plugin_hook('change_cal_permission_auto',$params);	
+			plugin_hook('change_cal_permission_auto',$params);
+		}
 	}
 }
 
@@ -111,7 +115,7 @@
 
 echo '
 <p>
-<form action="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&role_id='. $role_id .'" method="post">';
+<form action="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&amp;role_id='. $role_id .'" method="post">';
 
 if ($role_id != 'observer') {
 	echo '<p><strong>'._('Role Name').'</strong><br />




More information about the Fusionforge-commits mailing list