[Fusionforge-commits] r7867 - in trunk/gforge/www/news: . admin

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


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

Modified:
   trunk/gforge/www/news/admin/index.php
   trunk/gforge/www/news/submit.php
Log:
Semi-automated db_query_params() transition for simple cases

Modified: trunk/gforge/www/news/admin/index.php
===================================================================
--- trunk/gforge/www/news/admin/index.php	2009-06-19 09:56:15 UTC (rev 7866)
+++ trunk/gforge/www/news/admin/index.php	2009-06-19 09:56:24 UTC (rev 7867)
@@ -68,7 +68,8 @@
 			}
 
 			//foundry stuff - remove this news from the foundry so it has to be re-approved by the admin
-			db_query("DELETE FROM foundry_news WHERE news_id='$id'");
+			db_query_params ('DELETE FROM foundry_news WHERE news_id=$1',
+			array($id));
 
 			if (!$summary) {
 				$summary='(none)';
@@ -79,8 +80,8 @@
 			
 			$sanitizer = new TextSanitizer();
 			$details = $sanitizer->SanitizeHtml($details);
-			$sql="UPDATE news_bytes SET is_approved='$status', summary='".htmlspecialchars($summary)."', ".
-				"details='".$details."' WHERE id='$id' AND group_id='$group_id'";
+			$sql="UPDATE news_bytes SET is_approved='$status', summary='".htmlspecialchars($summary)."', 
+details='".$details."' WHERE id='$id' AND group_id='$group_id'";
 			$result=db_query($sql);
 
 			if (!$result || db_affected_rows($result) < 1) {
@@ -198,8 +199,8 @@
 				*/
 				$sanitizer = new TextSanitizer();
 				$details = $sanitizer->SanitizeHtml($details);
-				$sql="UPDATE news_bytes SET is_approved='1', post_date='".time()."', ".
-					"summary='".htmlspecialchars($summary)."', details='".$details."' WHERE id='$id'";
+				$sql="UPDATE news_bytes SET is_approved='1', post_date='".time()."', 
+summary='".htmlspecialchars($summary)."', details='".$details."' WHERE id='$id'";
 				$result=db_query($sql);
 				if (!$result || db_affected_rows($result) < 1) {
 					$feedback .= _('Error On Update:');
@@ -230,9 +231,9 @@
 				Move msg to rejected status
 			*/
 			$news_id = getArrayFromRequest('news_id');
-			$sql="UPDATE news_bytes "
-			     ."SET is_approved='2' "
-			     ."WHERE id IN ('".implode("','",$news_id)."')";
+			$sql="UPDATE news_bytes 
+SET is_approved='2' 
+WHERE id IN ('".implode("','",$news_id)."')";
 			$result=db_query($sql);
 			if (!$result || db_affected_rows($result) < 1) {
 				$feedback .= _('Error On Update:');
@@ -250,9 +251,9 @@
 			Show the submit form
 		*/
 
-		$sql="SELECT groups.unix_group_name,groups.group_id,news_bytes.* ".
-			"FROM news_bytes,groups WHERE id='$id' ".
-			"AND news_bytes.group_id=groups.group_id ";
+		$sql="SELECT groups.unix_group_name,groups.group_id,news_bytes.* 
+FROM news_bytes,groups WHERE id='$id' 
+AND news_bytes.group_id=groups.group_id ";
 		$result=db_query($sql);
 		if (db_numrows($result) < 1) {
 			exit_error(_('Error'), _('NewsByte not found'));

Modified: trunk/gforge/www/news/submit.php
===================================================================
--- trunk/gforge/www/news/submit.php	2009-06-19 09:56:15 UTC (rev 7866)
+++ trunk/gforge/www/news/submit.php	2009-06-19 09:56:24 UTC (rev 7867)
@@ -72,8 +72,8 @@
 	   			$new_id=$f->getID();
 				$sanitizer = new TextSanitizer();
 				$details = $sanitizer->SanitizeHtml($details);
-				$sql="INSERT INTO news_bytes (group_id,submitted_by,is_approved,post_date,forum_id,summary,details) ".
-					" VALUES ($1, $2, $3, $4, $5, $6, $7)";
+				$sql="INSERT INTO news_bytes (group_id,submitted_by,is_approved,post_date,forum_id,summary,details) 
+ VALUES ($1, $2, $3, $4, $5, $6, $7)";
 				$result=db_query_params($sql,
 					array($group_id, user_getid(), 0, time(), $new_id, htmlspecialchars($summary), $details));
 	   			if (!$result) {




More information about the Fusionforge-commits mailing list