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

Roland Mas lolando at libremir.placard.fr.eu.org
Fri Jun 19 11:56:32 CEST 2009


Author: lolando
Date: 2009-06-19 11:56:32 +0200 (Fri, 19 Jun 2009)
New Revision: 7868

Modified:
   trunk/gforge/www/people/editjob.php
   trunk/gforge/www/people/editprofile.php
   trunk/gforge/www/people/helpwanted-latest.php
   trunk/gforge/www/people/index.php
   trunk/gforge/www/people/people_utils.php
   trunk/gforge/www/people/viewjob.php
Log:
Semi-automated string reformatting which will help for the db_query_params() transition

Modified: trunk/gforge/www/people/editjob.php
===================================================================
--- trunk/gforge/www/people/editjob.php	2009-06-19 09:56:24 UTC (rev 7867)
+++ trunk/gforge/www/people/editjob.php	2009-06-19 09:56:32 UTC (rev 7868)
@@ -53,8 +53,8 @@
 		if (!form_key_is_valid(getStringFromRequest('form_key'))) {
 			exit_form_double_submit();
 		}
-		$sql="INSERT INTO people_job (group_id,created_by,title,description,post_date,status_id,category_id) ".
-			"VALUES ('$group_id','". user_getid() ."','".htmlspecialchars($title)."','".htmlspecialchars($description)."','".time()."','1','$category_id')";
+		$sql="INSERT INTO people_job (group_id,created_by,title,description,post_date,status_id,category_id) 
+VALUES ('$group_id','". user_getid() ."','".htmlspecialchars($title)."','".htmlspecialchars($description)."','".time()."','1','$category_id')";
 		$result=db_query($sql);
 		if (!$result || db_affected_rows($result) < 1) {
 			$feedback .= _('JOB insert FAILED');
@@ -74,8 +74,8 @@
 			exit_error(_('error - missing info'),_('Fill in all required fields'));
 		}
 
-		$sql="UPDATE people_job SET title='".htmlspecialchars($title)."',description='".htmlspecialchars($description)."',status_id='$status_id',category_id='$category_id' ".
-			"WHERE job_id='$job_id' AND group_id='$group_id'";
+		$sql="UPDATE people_job SET title='".htmlspecialchars($title)."',description='".htmlspecialchars($description)."',status_id='$status_id',category_id='$category_id' 
+WHERE job_id='$job_id' AND group_id='$group_id'";
 		$result=db_query($sql);
 		if (!$result || db_affected_rows($result) < 1) {
 			$feedback = _('JOB update FAILED');
@@ -110,8 +110,8 @@
 		}
 
 		if (people_verify_job_group($job_id,$group_id)) {
-			$sql="UPDATE people_job_inventory SET skill_level_id='$skill_level_id',skill_year_id='$skill_year_id' ".
-				"WHERE job_id='$job_id' AND job_inventory_id='$job_inventory_id'";
+			$sql="UPDATE people_job_inventory SET skill_level_id='$skill_level_id',skill_year_id='$skill_year_id' 
+WHERE job_id='$job_id' AND job_inventory_id='$job_inventory_id'";
 			$result=db_query($sql);
 			if (!$result || db_affected_rows($result) < 1) {
 				$feedback .= _('JOB skill update FAILED');

Modified: trunk/gforge/www/people/editprofile.php
===================================================================
--- trunk/gforge/www/people/editprofile.php	2009-06-19 09:56:24 UTC (rev 7867)
+++ trunk/gforge/www/people/editprofile.php	2009-06-19 09:56:32 UTC (rev 7868)
@@ -33,8 +33,8 @@
 			exit_form_double_submit();
 		}
 		
-		$sql="UPDATE users SET people_view_skills='$people_view_skills'".
-			"WHERE user_id='".user_getid()."'";
+		$sql="UPDATE users SET people_view_skills='$people_view_skills'
+WHERE user_id='".user_getid()."'";
 		$result=db_query($sql);
 		if (!$result || db_affected_rows($result) < 1) {
 			form_release_key(getStringFromRequest("form_key"));
@@ -79,8 +79,8 @@
 			if (db_numrows($result) >= 1) {
 				$feedback .= '';	/* don't tell them anything! */
 			} else {		  
-				$sql = "INSERT into skills_data (user_id, type, title, start, finish, keywords) values".
-					   "(".user_getid().",".$type.",'".$title."',".$start.",".$finish.",'".$keywords."')";
+				$sql = "INSERT into skills_data (user_id, type, title, start, finish, keywords) values
+(".user_getid().",".$type.",'".$title."',".$start.",".$finish.",'".$keywords."')";
 			   
 				$result=db_query($sql);
 				if (!$result || db_affected_rows($result) < 1) {
@@ -122,9 +122,9 @@
 
 					$keywords[$i] = str_replace("\n", " ", $keywords[$i]);  /* strip out any backspace characters. */
 					$title[$i] = str_replace("\n", " ", $title[$i]);
-					$sql="UPDATE skills_data SET type='$type[$i]',title='$title[$i]',start='$startY[$i]$startM[$i]',".
-						"finish='$endY[$i]$endM[$i]',keywords='$keywords[$i]' ".
-						"WHERE skills_data_id='$skill_edit[$i]'";
+					$sql="UPDATE skills_data SET type='$type[$i]',title='$title[$i]',start='$startY[$i]$startM[$i]',
+finish='$endY[$i]$endM[$i]',keywords='$keywords[$i]' 
+WHERE skills_data_id='$skill_edit[$i]'";
 
 					$result=db_query($sql);
 					if (!$result || db_affected_rows($result) < 1) {
@@ -293,34 +293,33 @@
 
 				$HTML->multiTableRow('',$cell_data,TRUE);
 
-		echo	"<tr>".
-					"<td>".html_build_select_box($skills, "type", 1, false, "")."</td>".
-					"<td>".html_build_select_box_from_arrays($monthArrayVals,$monthArray, "startM", date("m"), false, "").
-						html_build_select_box_from_arrays($yearArray,$yearArray, "startY", 0, false, "")."</td>".
-					"<td>".html_build_select_box_from_arrays($monthArrayVals,$monthArray, "endM", date("m"), false, "").
-						html_build_select_box_from_arrays($yearArray,$yearArray, "endY", 0, false, "")."</td>".
-				"</tr>".
-			"</table>".
-				
-				"<table border=0 >";
+		echo	"<tr>
+<td>".html_build_select_box($skills, "type", 1, false, "")."</td>
+<td>".html_build_select_box_from_arrays($monthArrayVals,$monthArray, "startM", date("m"), false, "").
+						html_build_select_box_from_arrays($yearArray,$yearArray, "startY", 0, false, "")."</td>
+<td>".html_build_select_box_from_arrays($monthArrayVals,$monthArray, "endM", date("m"), false, "").
+						html_build_select_box_from_arrays($yearArray,$yearArray, "endY", 0, false, "")."</td>
+</tr>
+</table>
+<table border=0 >";
 
 				$cell_data = array();
 				$cell_data[] = array(_('Title (max 100 characters)'));
 				echo $HTML->multiTableRow('',$cell_data,TRUE);
 
-				echo "<tr>".
-						"<td><input type=text name=\"title\" size=100></td>".
-					"</tr>";
+				echo "<tr>
+<td><input type=text name=\"title\" size=100></td>
+</tr>";
 				$cell_data = array();
 				$cell_data[] = array(_('Keywords (max 255 characters)'));
 				echo $HTML->multiTableRow('',$cell_data,TRUE);
-				echo "<tr>".
-						"<td><textarea name=\"keywords\" rows=\"3\" cols=\"85\" wrap=\"soft\"></textarea></td>".
-					"</tr>".
-					"<tr>".
-						"<td><input type=submit name=\"AddSkill\" value=\""._('Add This Skill')."\"></td>".
-					"</tr>".
-				 "</table>";
+				echo "<tr>
+<td><textarea name=\"keywords\" rows=\"3\" cols=\"85\" wrap=\"soft\"></textarea></td>
+</tr>
+<tr>
+<td><input type=submit name=\"AddSkill\" value=\""._('Add This Skill')."\"></td>
+</tr>
+</table>";
 		
 		echo '</form>';
 		

Modified: trunk/gforge/www/people/helpwanted-latest.php
===================================================================
--- trunk/gforge/www/people/helpwanted-latest.php	2009-06-19 09:56:24 UTC (rev 7867)
+++ trunk/gforge/www/people/helpwanted-latest.php	2009-06-19 09:56:32 UTC (rev 7868)
@@ -39,12 +39,12 @@
 {
         echo '<p>';
 
-	$sql="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";
+	$sql="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";
 	$result=db_query($sql,30);
         echo people_show_job_list($result) . '</p>';
 

Modified: trunk/gforge/www/people/index.php
===================================================================
--- trunk/gforge/www/people/index.php	2009-06-19 09:56:24 UTC (rev 7867)
+++ trunk/gforge/www/people/index.php	2009-06-19 09:56:32 UTC (rev 7868)
@@ -64,12 +64,12 @@
 
         echo '<h4>'._('Last posts').'</h4>';
 
-	$sql="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";
+	$sql="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";
 	$result=db_query($sql,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	2009-06-19 09:56:24 UTC (rev 7867)
+++ trunk/gforge/www/people/people_utils.php	2009-06-19 09:56:32 UTC (rev 7868)
@@ -99,8 +99,8 @@
 		$result=db_query($sql);
 		if (!$result || db_numrows($result) < 1) {
 			//skill not already in inventory
-			$sql="INSERT INTO people_skill_inventory (user_id,skill_id,skill_level_id,skill_year_id) ".
-				"VALUES ('". user_getid() ."','$skill_id','$skill_level_id','$skill_year_id')";
+			$sql="INSERT INTO people_skill_inventory (user_id,skill_id,skill_level_id,skill_year_id) 
+VALUES ('". user_getid() ."','$skill_id','$skill_level_id','$skill_year_id')";
 			$result=db_query($sql);
 			if (!$result || db_affected_rows($result) < 1) {
 				$feedback .= _('ERROR inserting into skill inventory');
@@ -118,12 +118,12 @@
 }
 
 function people_show_skill_inventory($user_id) {
-	$sql="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_skill_inventory ".
-		"WHERE people_skill_year.skill_year_id=people_skill_inventory.skill_year_id ".
-		"AND people_skill_level.skill_level_id=people_skill_inventory.skill_level_id ".
-		"AND people_skill.skill_id=people_skill_inventory.skill_id ".
-		"AND people_skill_inventory.user_id='$user_id'";
+	$sql="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_skill_inventory 
+WHERE people_skill_year.skill_year_id=people_skill_inventory.skill_year_id 
+AND people_skill_level.skill_level_id=people_skill_inventory.skill_level_id 
+AND people_skill.skill_id=people_skill_inventory.skill_id 
+AND people_skill_inventory.user_id='$user_id'";
 	$result=db_query($sql);
 
 	$title_arr=array();
@@ -211,8 +211,8 @@
 		$result=db_query($sql);
 		if (!$result || db_numrows($result) < 1) {
 			//skill isn't already in this inventory
-			$sql="INSERT INTO people_job_inventory (job_id,skill_id,skill_level_id,skill_year_id) ".
-				"VALUES ('$job_id','$skill_id','$skill_level_id','$skill_year_id')";
+			$sql="INSERT INTO people_job_inventory (job_id,skill_id,skill_level_id,skill_year_id) 
+VALUES ('$job_id','$skill_id','$skill_level_id','$skill_year_id')";
 			$result=db_query($sql);
 			if (!$result || db_affected_rows($result) < 1) {
 				$feedback .= _('ERROR inserting into skill inventory');
@@ -230,12 +230,12 @@
 }
 
 function people_show_job_inventory($job_id) {
-	$sql="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='$job_id'";
+	$sql="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='$job_id'";
 	$result=db_query($sql);
 
 	$title_arr=array();
@@ -363,18 +363,18 @@
 	$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";
+	$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";
 */
-	$sql="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";
+	$sql="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";
 
 	$result=db_query($sql);
 	$rows=db_numrows($result);
@@ -393,12 +393,12 @@
 
 function people_show_project_jobs($group_id) {
 	//show open jobs for this project
-	$sql="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='$group_id' ".
-		"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";
+	$sql="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='$group_id' 
+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";
 	$result=db_query($sql);
 
 	return people_show_job_list($result);
@@ -406,12 +406,12 @@
 
 function people_show_category_jobs($category_id) {
 	//show open jobs for this category
-	$sql="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='$category_id' ".
-		"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";
+	$sql="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='$category_id' 
+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";
 	$result=db_query($sql);
 
 	return people_show_job_list($result);

Modified: trunk/gforge/www/people/viewjob.php
===================================================================
--- trunk/gforge/www/people/viewjob.php	2009-06-19 09:56:24 UTC (rev 7867)
+++ trunk/gforge/www/people/viewjob.php	2009-06-19 09:56:32 UTC (rev 7868)
@@ -41,15 +41,15 @@
 	*/
 
 	//for security, include group_id
-	$sql="SELECT groups.group_name,people_job_category.name AS category_name,".
-		"people_job_status.name AS status_name,people_job.title,".
-		"people_job.description,people_job.post_date,users.user_name,users.user_id ".
-		"FROM people_job,groups,people_job_status,people_job_category,users ".
-		"WHERE people_job_category.category_id=people_job.category_id ".
-		"AND people_job_status.status_id=people_job.status_id ".
-		"AND users.user_id=people_job.created_by ".
-		"AND groups.group_id=people_job.group_id ".
-		"AND people_job.job_id='$job_id' AND people_job.group_id='$group_id'";
+	$sql="SELECT groups.group_name,people_job_category.name AS category_name,
+people_job_status.name AS status_name,people_job.title,
+people_job.description,people_job.post_date,users.user_name,users.user_id 
+FROM people_job,groups,people_job_status,people_job_category,users 
+WHERE people_job_category.category_id=people_job.category_id 
+AND people_job_status.status_id=people_job.status_id 
+AND users.user_id=people_job.created_by 
+AND groups.group_id=people_job.group_id 
+AND people_job.job_id='$job_id' AND people_job.group_id='$group_id'";
 	$result=db_query($sql);
 	if (!$result || db_numrows($result) < 1) {
 		people_header(array('title'=>_('View a Job')));




More information about the Fusionforge-commits mailing list