[Fusionforge-commits] r7092 - trunk/gforge/common/include

Roland Mas lolando at libremir.placard.fr.eu.org
Fri Feb 27 14:50:33 CET 2009


Author: lolando
Date: 2009-02-27 14:50:32 +0100 (Fri, 27 Feb 2009)
New Revision: 7092

Modified:
   trunk/gforge/common/include/Group.class.php
   trunk/gforge/common/include/PluginManager.class.php
   trunk/gforge/common/include/Role.class.php
   trunk/gforge/common/include/RoleObserver.class.php
   trunk/gforge/common/include/Stats.class.php
   trunk/gforge/common/include/User.class.php
   trunk/gforge/common/include/forms.php
Log:
Fixes and cleanups after the initial stage of the db_query_params() transition

Modified: trunk/gforge/common/include/Group.class.php
===================================================================
--- trunk/gforge/common/include/Group.class.php	2009-02-27 12:58:08 UTC (rev 7091)
+++ trunk/gforge/common/include/Group.class.php	2009-02-27 13:50:32 UTC (rev 7092)
@@ -374,7 +374,7 @@
 			//
 			// Now, make the user an admin
 			//
-			$res=db_query_params ('INSERT INTO user_group ( user_id, group_id, admin_flags,
+			$res=db_query_params ('INSERT INTO user_group (user_id, group_id, admin_flags,
 				cvs_flags, artifact_flags, forum_flags, role_id)
 				VALUES ($1, $2, $3, $4, $5, $6, $7)', 
 					      array ($user->getID(),
@@ -1364,7 +1364,7 @@
 		//	Delete FRS Packages
 		//
 		//$frspf = new FRSPackageFactory($this);
-		$res = db_query_params ('SELECT * FROM frs_package WHERE group_id=$A',
+		$res = db_query_params ('SELECT * FROM frs_package WHERE group_id=$1',
 					array ($this->getID())) ;
 //echo 'frs_package'.db_error();
 		//$frsp_arr =& $frspf->getPackages();
@@ -1525,12 +1525,12 @@
 	/**
 	 *	addUser - controls adding a user to a group.
 	 *  
-	 *  @param	string	Unix name of the user to add OR integer user_id.
+	 *      @param	string	Unix name of the user to add OR integer user_id.
 	 *	@param	int	The role_id this user should have.
 	 *	@return	boolean	success.
 	 *	@access public.
 	 */
-	function addUser($user_unix_name,$role_id) {
+	function addUser($user_identifier,$role_id) {
 		global $SYS;
 		/*
 			Admins can add users to groups
@@ -1546,10 +1546,10 @@
 		/*
 			get user id for this user's unix_name
 		*/
-		if (is_int ($user_unix_name)) {
-			$res_newuser = db_query_params ('SELECT * FROM users WHERE user_id=$1', array ($user_unix_name)) ;
+		if (is_int ($user_identifier)) { // user_id or user_name
+			$res_newuser = db_query_params ('SELECT * FROM users WHERE user_id=$1', array ($user_identifier)) ;
 		} else {
-			$res_newuser = db_query_params ('SELECT * FROM users WHERE user_name=$1', array ($user_unix_name)) ;
+			$res_newuser = db_query_params ('SELECT * FROM users WHERE user_name=$1', array ($user_identifier)) ;
 		}
 		if (db_numrows($res_newuser) > 0) {
 			//
@@ -1689,7 +1689,7 @@
 		//
 		//	audit trail
 		//
-		$this->addHistory('Added User',$user_unix_name);
+		$this->addHistory('Added User',$user_identifier);
 		db_commit();
 		return true;
 	}

Modified: trunk/gforge/common/include/PluginManager.class.php
===================================================================
--- trunk/gforge/common/include/PluginManager.class.php	2009-02-27 12:58:08 UTC (rev 7091)
+++ trunk/gforge/common/include/PluginManager.class.php	2009-02-27 13:50:32 UTC (rev 7092)
@@ -2,7 +2,7 @@
 /**
  * FusionForge plugin system
  *
- * Copyright 2002-2009, Roland Mas
+ * Copyright 2002, 2009, Roland Mas
  *
  * This file is part of FusionForge.
  *

Modified: trunk/gforge/common/include/Role.class.php
===================================================================
--- trunk/gforge/common/include/Role.class.php	2009-02-27 12:58:08 UTC (rev 7091)
+++ trunk/gforge/common/include/Role.class.php	2009-02-27 13:50:32 UTC (rev 7092)
@@ -141,8 +141,6 @@
 				if (!$uvalue) {
 					$uvalue=0;
 				}
-				$sql="INSERT INTO role_setting (role_id,section_name,ref_id,value) 
-					values ('$role_id','$usection_name', '$uref_id','$uvalue')";
 				$res = db_query_params ('INSERT INTO role_setting (role_id,section_name,ref_id,value) VALUES ($1,$2,$3,$4)',
 							array ($role_id,
 							       $usection_name,

Modified: trunk/gforge/common/include/RoleObserver.class.php
===================================================================
--- trunk/gforge/common/include/RoleObserver.class.php	2009-02-27 12:58:08 UTC (rev 7091)
+++ trunk/gforge/common/include/RoleObserver.class.php	2009-02-27 13:50:32 UTC (rev 7092)
@@ -239,14 +239,6 @@
 						if ($updated['forum'][$uref_id]) {
 							continue;
 						}
-						$sql="UPDATE forum_group_list
-							SET 
-							is_public='".$data['forumpublic'][$uref_id]."',
-							allow_anonymous='".$data['forumanon'][$uref_id]."'
-							WHERE
-							group_forum_id='$uref_id'
-							AND group_id='".$this->Group->getID()."'";
-//echo "\n<br>$sql";
 						$res = db_query_params ('UPDATE forum_group_list SET is_public=$1, allow_anonymous=$2 WHERE group_forum_id=$3 AND group_id=$4',
 									array ($data['forumpublic'][$uref_id],
 									       $data['forumanon'][$uref_id],

Modified: trunk/gforge/common/include/Stats.class.php
===================================================================
--- trunk/gforge/common/include/Stats.class.php	2009-02-27 12:58:08 UTC (rev 7091)
+++ trunk/gforge/common/include/Stats.class.php	2009-02-27 13:50:32 UTC (rev 7092)
@@ -81,8 +81,8 @@
 	*/
 	function getTopMessagesPosted() {
 		return db_query_params ('SELECT g.unix_group_name, g.group_name, SUM(s.msg_posted) AS items FROM stats_project s, groups g WHERE s.group_id=g.group_id AND g.is_public=1 AND g.status=$1 GROUP BY g.unix_group_name, g.group_name ORDER BY items DESC',
-					array ('A')
-					, 100) ;
+					array ('A'),
+					100) ;
 	}
 
 	/**

Modified: trunk/gforge/common/include/User.class.php
===================================================================
--- trunk/gforge/common/include/User.class.php	2009-02-27 12:58:08 UTC (rev 7091)
+++ trunk/gforge/common/include/User.class.php	2009-02-27 13:50:32 UTC (rev 7092)
@@ -1222,7 +1222,7 @@
 
 		db_begin();
 		$md5_pw = md5 ($passwd) ;
-		$unix_pw = account_genunixpw($passwd) ;
+		$unix_pw = account_genunixpw ($passwd) ;
 
 		$res = db_query_params ('UPDATE users SET user_pw=$1, unix_pw=$2 WHERE user_id=$3',
 					array ($md5_pw,

Modified: trunk/gforge/common/include/forms.php
===================================================================
--- trunk/gforge/common/include/forms.php	2009-02-27 12:58:08 UTC (rev 7091)
+++ trunk/gforge/common/include/forms.php	2009-02-27 13:50:32 UTC (rev 7092)
@@ -41,8 +41,7 @@
 			$sql = "SELECT * FROM form_keys WHERE `key`='".$key."'";
 			$res=db_query($sql);
 		} else {
-			$sql = 'SELECT * FROM form_keys WHERE key=$1';
-			$res=db_query_params ($sql, array ($key));
+			$res = db_query_params ('SELECT * FROM form_keys WHERE key=$1', array ($key));
 		}
 		if (!db_numrows($res)) {
 			$is_new=true;	
@@ -77,8 +76,7 @@
 		$sql = "SELECT * FROM form_keys WHERE `key`='$key' and is_used=0 FOR UPDATE";
 		$res=db_query($sql);
 	} else {
-		$sql = 'SELECT * FROM form_keys WHERE key=$1 and is_used=0 FOR UPDATE';
-		$res=db_query_params($sql, array ($key));
+		$res = db_query_params ('SELECT * FROM form_keys WHERE key=$1 and is_used=0 FOR UPDATE', array ($key));
 	}
 	if (!$res || !db_numrows($res)) {
 		db_rollback();
@@ -88,8 +86,7 @@
 		$sql = "UPDATE form_keys SET is_used=1 WHERE `key`='$key'";
 		$res=db_query($sql);
 	} else {
-		$sql = 'UPDATE form_keys SET is_used=1 WHERE key=$1';
-		$res=db_query_params ($sql, array ($key));
+		$res = db_query_params ('UPDATE form_keys SET is_used=1 WHERE key=$1', array ($key));
 	}
 	if (!$res) {
 		db_rollback();
@@ -114,8 +111,7 @@
 		$sql = "SELECT * FROM form_keys WHERE `key`='$key' FOR UPDATE";
 		$res=db_query($sql);
 	} else {
-		$sql = 'SELECT * FROM form_keys WHERE key=$1 FOR UPDATE';
-		$res=db_query_params($sql, array ($key));
+		$res = db_query_params ('SELECT * FROM form_keys WHERE key=$1 FOR UPDATE', array ($key));
 	}
 	if (!$res || !db_numrows($res)) {
 		db_rollback();
@@ -125,8 +121,7 @@
 		$sql = "UPDATE form_keys SET is_used=0 WHERE `key`='$key'";
 		$res=db_query($sql);
 	} else {
-		$sql = 'UPDATE form_keys SET is_used=0 WHERE key=$1';
-		$res=db_query_params ($sql, array ($key));
+		$res = db_query_params ('UPDATE form_keys SET is_used=0 WHERE key=$1', array ($key));
 	}
 	if (!$res) {
 		db_rollback();




More information about the Fusionforge-commits mailing list