[Fusionforge-commits] r8690 - trunk/gforge/www/people

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Mon Jan 25 22:02:11 CET 2010


Author: aljeux
Date: 2010-01-25 22:02:11 +0100 (Mon, 25 Jan 2010)
New Revision: 8690

Modified:
   trunk/gforge/www/people/helpwanted-latest.php
   trunk/gforge/www/people/index.php
   trunk/gforge/www/people/people_utils.php
   trunk/gforge/www/people/viewprofile.php
Log:
Minor: SQL rewrite

Modified: trunk/gforge/www/people/helpwanted-latest.php
===================================================================
--- trunk/gforge/www/people/helpwanted-latest.php	2010-01-25 20:35:55 UTC (rev 8689)
+++ trunk/gforge/www/people/helpwanted-latest.php	2010-01-25 21:02:11 UTC (rev 8690)
@@ -39,12 +39,12 @@
 {
         echo '<p>';
 
-	$result=db_query_params("SELECT people_job.group_id,people_job.job_id,groups.group_name,groups.unix_group_name,people_job.title,people_job.post_date,people_job_category.name AS category_name 
+	$result=db_query_params('SELECT people_job.group_id,people_job.job_id,groups.group_name,groups.unix_group_name,people_job.title,people_job.post_date,people_job_category.name AS category_name 
 FROM people_job,people_job_category,groups 
 WHERE people_job.group_id=groups.group_id 
 AND people_job.category_id=people_job_category.category_id 
 AND people_job.status_id=1 
-ORDER BY post_date DESC",
+ORDER BY post_date DESC',
 array(),30);
         echo people_show_job_list($result) . '</p>';
 

Modified: trunk/gforge/www/people/index.php
===================================================================
--- trunk/gforge/www/people/index.php	2010-01-25 20:35:55 UTC (rev 8689)
+++ trunk/gforge/www/people/index.php	2010-01-25 21:02:11 UTC (rev 8690)
@@ -64,12 +64,12 @@
 
         echo '<h4>'._('Last posts').'</h4>';
 
-	$result=db_query_params("SELECT people_job.group_id,people_job.job_id,groups.group_name,groups.unix_group_name,people_job.title,people_job.post_date,people_job_category.name AS category_name 
+	$result=db_query_params('SELECT people_job.group_id,people_job.job_id,groups.group_name,groups.unix_group_name,people_job.title,people_job.post_date,people_job_category.name AS category_name 
 FROM people_job,people_job_category,groups 
 WHERE people_job.group_id=groups.group_id 
 AND people_job.category_id=people_job_category.category_id 
 AND people_job.status_id=1 
-ORDER BY post_date DESC", array(), 5);
+ORDER BY post_date DESC', array(), 5);
         echo people_show_job_list($result);
         echo '<p><a href="helpwanted-latest.php">['._('more latest posts').']</a></p>';
 

Modified: trunk/gforge/www/people/people_utils.php
===================================================================
--- trunk/gforge/www/people/people_utils.php	2010-01-25 20:35:55 UTC (rev 8689)
+++ trunk/gforge/www/people/people_utils.php	2010-01-25 21:02:11 UTC (rev 8690)
@@ -146,7 +146,7 @@
 }
 
 function people_edit_skill_inventory($user_id) {
-	$result=db_query_params("SELECT * FROM people_skill_inventory WHERE user_id=$1", array($user_id));
+	$result=db_query_params('SELECT * FROM people_skill_inventory WHERE user_id=$1', array($user_id));
 
 	$title_arr=array();
 	$title_arr[]=_('Skill');
@@ -198,11 +198,11 @@
 	global $feedback;
 	if (session_loggedin()) {
 		//check if they've already added this skill
-		$result=db_query_params("SELECT * FROM people_job_inventory WHERE job_id=$1 AND skill_id=$2", array($job_id, $skill_id));
+		$result=db_query_params('SELECT * FROM people_job_inventory WHERE job_id=$1 AND skill_id=$2', array($job_id, $skill_id));
 		if (!$result || db_numrows($result) < 1) {
 			//skill isn't already in this inventory
-			$result=db_query_params("INSERT INTO people_job_inventory (job_id,skill_id,skill_level_id,skill_year_id) 
-VALUES ($1, $2, $3, $4)", array($job_id, $skill_id, $skill_level_id, $skill_year_id));
+			$result=db_query_params('INSERT INTO people_job_inventory (job_id,skill_id,skill_level_id,skill_year_id) 
+VALUES ($1, $2, $3, $4)', array($job_id, $skill_id, $skill_level_id, $skill_year_id));
 			if (!$result || db_affected_rows($result) < 1) {
 				$feedback .= _('ERROR inserting into skill inventory');
 				echo db_error();
@@ -219,12 +219,12 @@
 }
 
 function people_show_job_inventory($job_id) {
-	$result=db_query_params("SELECT people_skill.name AS skill_name, people_skill_level.name AS level_name, people_skill_year.name AS year_name 
+	$result=db_query_params('SELECT people_skill.name AS skill_name, people_skill_level.name AS level_name, people_skill_year.name AS year_name 
 FROM people_skill_year,people_skill_level,people_skill,people_job_inventory 
 WHERE people_skill_year.skill_year_id=people_job_inventory.skill_year_id 
 AND people_skill_level.skill_level_id=people_job_inventory.skill_level_id 
 AND people_skill.skill_id=people_job_inventory.skill_id 
-AND people_job_inventory.job_id=$1", array($job_id));
+AND people_job_inventory.job_id=$1', array($job_id));
 
 	$title_arr=array();
 	$title_arr=array();
@@ -255,7 +255,7 @@
 }
 
 function people_verify_job_group($job_id,$group_id) {
-	$result=db_query_params("SELECT * FROM people_job WHERE job_id=$1 AND group_id=$2", array($job_id, $group_id));
+	$result=db_query_params('SELECT * FROM people_job WHERE job_id=$1 AND group_id=$2', array($job_id, $group_id));
 	if (!$result || db_numrows($result) < 1) {
 		return false;
 	} else {
@@ -264,7 +264,7 @@
 }
 
 function people_get_skill_name($skill_id) {
-	$result=db_query_params("SELECT name FROM people_skill WHERE skill_id=$1", array($skill_id));
+	$result=db_query_params('SELECT name FROM people_skill WHERE skill_id=$1', array($skill_id));
 	if (!$result || db_numrows($result) < 1) {
 		return _('Invalid ID');
 	} else {
@@ -273,7 +273,7 @@
 }
 
 function people_get_category_name($category_id) {
-	$result=db_query_params("SELECT name FROM people_job_category WHERE category_id=$1", array($category_id));
+	$result=db_query_params('SELECT name FROM people_job_category WHERE category_id=$1', array($category_id));
 	if (!$result || db_numrows($result) < 1) {
 		return 'Invalid ID';
 	} else {
@@ -287,7 +287,7 @@
 // table looking like poo.
 function people_edit_job_inventory($job_id,$group_id) {
 	global $HTML;
-	$result=db_query_params("SELECT * FROM people_job_inventory WHERE job_id=$1", array($job_id));
+	$result=db_query_params('SELECT * FROM people_job_inventory WHERE job_id=$1', array($job_id));
 
 	$title_arr=array();
 	$title_arr[]=_('Skill').utils_requiredField();
@@ -346,19 +346,12 @@
 
 	$return = $GLOBALS['HTML']->listTableTop ($title_arr);
 
-/*
-	$sql="SELECT pjc.category_id, pjc.name, count(*) as total 
-FROM people_job_category pjc,people_job pj 
-WHERE pjc.category_id=pj.category_id 
-AND pj.status_id=1 
-GROUP BY pjc.category_id, pjc.name";
-*/
-	$result= db_query_params("SELECT pjc.category_id, pjc.name, COUNT(pj.category_id) AS total 
+	$result= db_query_params('SELECT pjc.category_id, pjc.name, COUNT(pj.category_id) AS total 
 FROM people_job_category pjc LEFT JOIN people_job pj 
 ON pjc.category_id=pj.category_id 
 WHERE pjc.private_flag=0 
 AND (pj.status_id=1 OR pj.status_id IS NULL) 
-GROUP BY pjc.category_id, pjc.name", array());
+GROUP BY pjc.category_id, pjc.name', array());
 
 	$rows=db_numrows($result);
 	if (!$result || $rows < 1) {
@@ -376,24 +369,24 @@
 
 function people_show_project_jobs($group_id) {
 	//show open jobs for this project
-	$result = db_query_params("SELECT people_job.group_id,people_job.job_id,groups.group_name,groups.unix_group_name,people_job.title,people_job.post_date,people_job_category.name AS category_name 
+	$result = db_query_params('SELECT people_job.group_id,people_job.job_id,groups.group_name,groups.unix_group_name,people_job.title,people_job.post_date,people_job_category.name AS category_name 
 FROM people_job,people_job_category,groups 
 WHERE people_job.group_id=$1
 AND people_job.group_id=groups.group_id 
 AND people_job.category_id=people_job_category.category_id 
-AND people_job.status_id=1 ORDER BY post_date DESC", array($group_id));
+AND people_job.status_id=1 ORDER BY post_date DESC', array($group_id));
 
 	return people_show_job_list($result);
 }
 
 function people_show_category_jobs($category_id) {
 	//show open jobs for this category
-	$result=db_query_params("SELECT people_job.group_id,people_job.job_id,groups.unix_group_name,groups.group_name,people_job.title,people_job.post_date,people_job_category.name AS category_name 
+	$result=db_query_params('SELECT people_job.group_id,people_job.job_id,groups.unix_group_name,groups.group_name,people_job.title,people_job.post_date,people_job_category.name AS category_name 
 FROM people_job,people_job_category,groups 
 WHERE people_job.category_id=$1
 AND people_job.group_id=groups.group_id 
 AND people_job.category_id=people_job_category.category_id 
-AND people_job.status_id=1 ORDER BY post_date DESC", array($category_id));
+AND people_job.status_id=1 ORDER BY post_date DESC', array($category_id));
 
 	return people_show_job_list($result);
 }

Modified: trunk/gforge/www/people/viewprofile.php
===================================================================
--- trunk/gforge/www/people/viewprofile.php	2010-01-25 20:35:55 UTC (rev 8689)
+++ trunk/gforge/www/people/viewprofile.php	2010-01-25 21:02:11 UTC (rev 8690)
@@ -29,7 +29,7 @@
 	people_header(array('title'=>_('View a User Profile')));
 
 	//for security, include group_id
-	$result=db_query_params("SELECT * FROM users WHERE user_id=$1", array($user_id));
+	$result=db_query_params('SELECT * FROM users WHERE user_id=$1', array($user_id));
 	if (!$result || db_numrows($result) < 1) {
 		echo db_error();
 		$feedback .= _('User fetch FAILED');




More information about the Fusionforge-commits mailing list