[Fusionforge-commits] r8070 - in trunk/gforge/www/project: . admin report

Julien HEYMAN jheyman at libremir.placard.fr.eu.org
Tue Sep 1 11:18:21 CEST 2009


Author: jheyman
Date: 2009-09-01 11:18:21 +0200 (Tue, 01 Sep 2009)
New Revision: 8070

Modified:
   trunk/gforge/www/project/admin/database.php
   trunk/gforge/www/project/admin/editimages.php
   trunk/gforge/www/project/admin/massfinish.php
   trunk/gforge/www/project/admin/project_admin_utils.php
   trunk/gforge/www/project/memberlist.php
   trunk/gforge/www/project/report/index.php
Log:
Ongoing migration to db_query_params()

Modified: trunk/gforge/www/project/admin/database.php
===================================================================
--- trunk/gforge/www/project/admin/database.php	2009-09-01 07:12:16 UTC (rev 8069)
+++ trunk/gforge/www/project/admin/database.php	2009-09-01 09:18:21 UTC (rev 8070)
@@ -60,9 +60,8 @@
 	$dbname = prdb_namespace_seek($dbname);
 	$randompw = random_pwgen();
 
-	$sql = "INSERT INTO prdb_dbs(group_id,dbname,dbusername,dbuserpass,requestdate,dbtype,created_by,state)
-			VALUES($1, $2, $2, $3, $4, $5, $6 ,2)";
-	$res = db_query_params($sql, array($group_id, $dbname, $randompw, time(), $newdbtypeid, $LUSER->getID()));
+	$res = db_query_params("INSERT INTO prdb_dbs(group_id,dbname,dbusername,dbuserpass,requestdate,dbtype,created_by,state)
+			VALUES($1, $2, $2, $3, $4, $5, $6 ,2)", array($group_id, $dbname, $randompw, time(), $newdbtypeid, $LUSER->getID()));
 
 	if (!$res || db_affected_rows($res) < 1) {
 		$feedback .= _('Cannot add database entry').': '.db_error();
@@ -196,14 +195,13 @@
 <?php
 }
 
-$sql="
+$res_db = db_query_params("
 	SELECT * 
 	FROM prdb_dbs,prdb_states,prdb_types 
 	WHERE group_id=$1
 	AND stateid=state 
 	AND dbtype=dbtypeid
-";
-$res_db = db_query_params($sql, array($group_id));
+", array($group_id));
 
 if (db_numrows($res_db) > 0) {
 

Modified: trunk/gforge/www/project/admin/editimages.php
===================================================================
--- trunk/gforge/www/project/admin/editimages.php	2009-09-01 07:12:16 UTC (rev 8069)
+++ trunk/gforge/www/project/admin/editimages.php	2009-09-01 09:18:21 UTC (rev 8070)
@@ -68,33 +68,32 @@
 
 	if (check_file_size($size)) {
 		$curtime = time();
-		$sql="";
 		$width = ((!$width) ? "0" : $width);
 		$height = ((!$height) ? "0" : $height);
 		if (!$id) {
-			$sql="	INSERT INTO db_images
-					(group_id,description,bin_data,
-					 filename,filesize,filetype,
-					 width,height,upload_date,version)
-					VALUES
-					($1, $2, $3, $4, $5, $6, $7, $8, $9, 1)";
-			$res = db_query_params($sql, array($group_id, $description, $data, $input_file['name'],
-			                         $size, $input_file['type'], $width, $height, $curtime));
+			$res = db_query_params("INSERT INTO db_images
+                              (group_id,description,bin_data,
+                              filename, filesize, filetype,
+                              width,height,upload_date,version)
+                              VALUES
+                              ($1, $2, $3, $4, $5, $6, $7, $8, $9, 1)",
+                              array($group_id, $description, $data, $input_file['name'],
+                              $size, $input_file['type'], $width, $height, $curtime));
 		} else {
-			$sql="	UPDATE db_images
-					SET description=$1,
-					 bin_data=$2,
-					 filename=$3,
-					 filesize=$4,
-					 filetype=$5,
-					 width=$6,
-					 height=$7,
-					 upload_date=$8,
-					 version=version+1
-					WHERE group_id=$9
-					AND id=$10";
-			$res = db_query_params($sql, array($description, $data, $input_file['name'], $size,
-			                         $input_file['type'], $width, $height, $curtime, $group_id, $id);
+			$res = db_query_params("UPDATE db_images
+		                          SET description=$1,
+		                           bin_data=$2,
+		                           filename=$3,
+		                           filesize=$4,
+		                           filetype=$5,
+		                           width=$6,
+		                           height=$7,
+		                           upload_date=$8,
+		                           version=version+1
+		                          WHERE group_id=$9
+		                          AND id=$10",
+		                          array($description, $data, $input_file['name'], $size,
+		                          $input_file['type'], $width, $height, $curtime, $group_id, $id));
 		}
 
 

Modified: trunk/gforge/www/project/admin/massfinish.php
===================================================================
--- trunk/gforge/www/project/admin/massfinish.php	2009-09-01 07:12:16 UTC (rev 8069)
+++ trunk/gforge/www/project/admin/massfinish.php	2009-09-01 09:18:21 UTC (rev 8070)
@@ -60,8 +60,8 @@
 } else {
 	$arr=explode(',',$accumulated_ids);
 	$res=db_query_params("SELECT user_id,user_name,realname FROM users
-		WHERE status='A' and type_id='1' and user_id IN ($1)
-		ORDER BY realname ASC", array(implode('\',\'',$arr)));
+		WHERE status='A' and type_id='1' and user_id = ANY ($1)
+		ORDER BY realname ASC", array(db_int_array_to_any_clause($arr)));
 }
 
 project_admin_header(array('title'=>_('Edit Role'),'group'=>$group_id));

Modified: trunk/gforge/www/project/admin/project_admin_utils.php
===================================================================
--- trunk/gforge/www/project/admin/project_admin_utils.php	2009-09-01 07:12:16 UTC (rev 8069)
+++ trunk/gforge/www/project/admin/project_admin_utils.php	2009-09-01 09:18:21 UTC (rev 8070)
@@ -126,11 +126,10 @@
 */
 
 function group_get_history ($group_id=false) {
-	$sql="SELECT group_history.field_name,group_history.old_value,group_history.adddate,users.user_name 
+return db_query_params("SELECT group_history.field_name,group_history.old_value,group_history.adddate,users.user_name
 FROM group_history,users 
 WHERE group_history.mod_by=users.user_id 
-AND group_id=$1 ORDER BY group_history.adddate DESC";
-	return db_query_params($sql, array($group_id));
+AND group_id=$1 ORDER BY group_history.adddate DESC", array($group_id));
 }		   
 	
 function group_add_history ($field_name,$old_value,$group_id) {

Modified: trunk/gforge/www/project/memberlist.php
===================================================================
--- trunk/gforge/www/project/memberlist.php	2009-09-01 07:12:16 UTC (rev 8069)
+++ trunk/gforge/www/project/memberlist.php	2009-09-01 09:18:21 UTC (rev 8070)
@@ -38,16 +38,6 @@
 
 echo _('<p>If you would like to contribute to this project by becoming a developer, contact one of the project admins, designated in bold text below.</p>');
 
-// list members
-$query = "SELECT users.*,user_group.admin_flags,role.role_name AS role
-	FROM users,user_group 
-	LEFT JOIN role ON user_group.role_id=role.role_id
-	WHERE users.user_id=user_group.user_id 
-	AND user_group.group_id=$1
-	AND users.status='A'
-	ORDER BY users.user_name ";
-
-
 $title_arr=array();
 $title_arr[]=_('Developer');
 $title_arr[]=_('Username');
@@ -58,7 +48,14 @@
 
 echo $GLOBALS['HTML']->listTableTop ($title_arr);
 
-$res_memb = db_query_params($query, array($group_id));
+// list members
+$res_memb = db_query_params("SELECT users.*,user_group.admin_flags,role.role_name AS role
+	FROM users,user_group
+	LEFT JOIN role ON user_group.role_id=role.role_id
+	WHERE users.user_id=user_group.user_id
+	AND user_group.group_id=$1
+	AND users.status='A'
+	ORDER BY users.user_name ", array($group_id));
 $i=0;
 while ( $row_memb=db_fetch_array($res_memb) ) {
 	echo '<tr '.$HTML->boxGetAltRowStyle($i++).'>';

Modified: trunk/gforge/www/project/report/index.php
===================================================================
--- trunk/gforge/www/project/report/index.php	2009-09-01 07:12:16 UTC (rev 8069)
+++ trunk/gforge/www/project/report/index.php	2009-09-01 09:18:21 UTC (rev 8070)
@@ -140,16 +140,14 @@
 
 
 // list members
-$query = "SELECT users.*,user_group.admin_flags,people_job_category.name AS role
+$res_memb = db_query_params("SELECT users.*,user_group.admin_flags,people_job_category.name AS role
 	FROM users,user_group 
 	LEFT JOIN people_job_category ON user_group.member_role=people_job_category.category_id
 	WHERE users.user_id=user_group.user_id 
 	AND user_group.group_id=$1
 	AND users.status='A'
-	ORDER BY users.user_name ";
+	ORDER BY users.user_name ", array($group_id));
 
-$res_memb = db_query_params($query, array($group_id));
-
 while ( $row_memb=db_fetch_array($res_memb) ) {
 	echo '
 		<tr>';




More information about the Fusionforge-commits mailing list