[Fusionforge-commits] r8165 - in trunk/gforge/www/people: . admin

Roland Mas lolando at libremir.placard.fr.eu.org
Thu Sep 24 16:10:34 CEST 2009


Author: lolando
Date: 2009-09-24 16:10:34 +0200 (Thu, 24 Sep 2009)
New Revision: 8165

Modified:
   trunk/gforge/www/people/admin/index.php
   trunk/gforge/www/people/editprofile.php
   trunk/gforge/www/people/skills_utils.php
Log:
db_query_params() migration

Modified: trunk/gforge/www/people/admin/index.php
===================================================================
--- trunk/gforge/www/people/admin/index.php	2009-09-24 14:10:26 UTC (rev 8164)
+++ trunk/gforge/www/people/admin/index.php	2009-09-24 14:10:34 UTC (rev 8165)
@@ -68,34 +68,6 @@
 			}
 
 			$feedback .= ' Skill Inserted ';
-/*
-		} else if (getStringFromRequest('people_cat_mod')) {
-			$cat_name = getStringFromRequest('cat_name');
-			$people_cat_id = getIntFromRequest('people_cat_id');
-
-			$sql="UPDATE people_category SET category_name='$cat_name' WHERE people_category_id='$people_cat_id' AND group_id='$group_id'";
-			$result=db_query($sql);
-			if (!$result || db_affected_rows($result) < 1) {
-				$feedback .= ' Error modifying bug category ';
-				echo db_error();
-			} else {
-				$feedback .= ' Bug Category Modified ';
-			}
-
-		} else if (getStringFromRequest('people_group_mod')) {
-			$group_name = getStringFromRequest('group_name');
-			$people_group_id = getIntFromRequest('people_group_id');
-			$group_id = getIntFromRequest('group_id');
-
-			$sql="UPDATE people_group SET group_name = '$group_name' WHERE people_group_id='$people_group_id' AND group_id='$group_id'";
-			$result=db_query($sql);
-			if (!$result || db_affected_rows($result) < 1) {
-				$feedback .= ' Error modifying bug cateogry ';
-				echo db_error();
-			} else {
-				$feedback .= ' Bug Category Modified ';
-			}
-*/
 		}
 
 	} 

Modified: trunk/gforge/www/people/editprofile.php
===================================================================
--- trunk/gforge/www/people/editprofile.php	2009-09-24 14:10:26 UTC (rev 8164)
+++ trunk/gforge/www/people/editprofile.php	2009-09-24 14:10:34 UTC (rev 8165)
@@ -167,13 +167,8 @@
 				if (!form_key_is_valid(getStringFromRequest('form_key'))) {
 					exit_form_double_submit();
 				}
-
-				$sql = "DELETE FROM skills_data where skills_data_id in(".$skill_delete[0];
-				for($i = 1; $i < $numItems; $i++) {
-					$sql .= ",".$skill_delete[$i];
-				}
-				$sql .=")";
-				$result=db_query($sql);
+				$result = db_query_params ('DELETE FROM skills_data where skills_data_id = ANY ($1)',
+							   array (db_int_array_to_any_clause ($skill_delete)));
 				if (!$result || db_affected_rows($result) < 1) {
 					echo db_error();
 					$feedback .= _('Failed to delete any skills');
@@ -182,13 +177,8 @@
 					$feedback = ngettext ('Skill deleted successfully', 'Skills deleted successfully', db_affected_rows($result));
 				}
 			} else {
-				$sql = "SELECT title FROM skills_data where skills_data_id in(".$skill_delete[0];
-				for($i = 1; $i < $numItems; $i++) {
-					$sql .= ",".$skill_delete[$i];
-				}
-				$sql .=")";
-				
-				$result=db_query($sql);
+				$result = db_query_params ('SELECT title FROM skills_data where skills_data_id = ANY ($1)',
+							   array (db_int_array_to_any_clause ($skill_delete)));
 				$rows = db_numrows($result);
 				if (!$result || $rows < 1) {
 					echo db_error();

Modified: trunk/gforge/www/people/skills_utils.php
===================================================================
--- trunk/gforge/www/people/skills_utils.php	2009-09-24 14:10:26 UTC (rev 8164)
+++ trunk/gforge/www/people/skills_utils.php	2009-09-24 14:10:34 UTC (rev 8165)
@@ -96,14 +96,8 @@
 
 function handle_multi_edit($skill_ids) {
 	global $HTML;
-	$numSkills = count($skill_ids);
-	$SQL = "select * from skills_data where skills_data_id in(".(int)$skill_ids[0];
-	for($i = 1; $i < $numSkills; $i++) {
-		$SQL .= ", ".(int)$skill_ids[$i];
-	}
-	$SQL .= ")";
-	
-	$result=db_query($SQL);
+	$result = db_query_params ('select * from skills_data where skills_data_id = ANY ($1)',
+				   array (db_int_array_to_any_clause ($skill_ids)));
 	$rows = db_numrows($result);
 	if (!$result || $rows < 1) {
 		echo db_error();




More information about the Fusionforge-commits mailing list