[Fusionforge-commits] r8154 - trunk/gforge/www/export

Roland Mas lolando at libremir.placard.fr.eu.org
Wed Sep 23 17:18:39 CEST 2009


Author: lolando
Date: 2009-09-23 17:18:38 +0200 (Wed, 23 Sep 2009)
New Revision: 8154

Modified:
   trunk/gforge/www/export/rss20_newreleases.php
   trunk/gforge/www/export/rss20_news.php
Log:
db_query_params() migration

Modified: trunk/gforge/www/export/rss20_newreleases.php
===================================================================
--- trunk/gforge/www/export/rss20_newreleases.php	2009-09-23 15:18:31 UTC (rev 8153)
+++ trunk/gforge/www/export/rss20_newreleases.php	2009-09-23 15:18:38 UTC (rev 8154)
@@ -52,32 +52,35 @@
 print "  <lastBuildDate>".rss_date(time())."</lastBuildDate>\n";
 print "  <docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
 
-$res = db_query("SELECT groups.group_name AS group_name,"
-	. "frs_package.group_id AS group_id,"
-	. "groups.unix_group_name AS unix_group_name,"
-	. "groups.short_description AS short_description,"
-	. "groups.license AS license,"
-	. "users.user_name AS user_name,"
-	. "users.user_id AS user_id,"
-	. "users.realname AS realname,"
-        . "frs_package.name AS package_name,"
-	. "frs_release.package_id AS filemodule_id,"
-	. "frs_release.name AS module_name,"
-	. "frs_release.notes AS module_notes,"
-	. "frs_release.status_id AS release_status,"
-	. "frs_release.release_date AS release_date,"
-	. "frs_file.release_time AS release_time,"
-	. "frs_file.filename AS filename,"
-	. "frs_file.release_id AS filerelease_id "
-	. "FROM users,frs_file,frs_release,frs_package,groups WHERE "
-	. "frs_release.released_by=users.user_id AND "
-	. "frs_release.package_id=frs_package.package_id AND "
-	. "frs_package.group_id=groups.group_id AND "
-	. "frs_release.status_id=1 AND "
-	. "groups.is_public=1 AND "
-	. $where
-	. "frs_file.release_id=frs_release.release_id "
-	. "ORDER BY frs_file.release_time DESC",($limit * 3));
+$res = db_query_params ('SELECT groups.group_name AS group_name,
+	frs_package.group_id AS group_id,
+	groups.unix_group_name AS unix_group_name,
+	groups.short_description AS short_description,
+	groups.license AS license,
+	users.user_name AS user_name,
+	users.user_id AS user_id,
+	users.realname AS realname,
+        frs_package.name AS package_name,
+	frs_release.package_id AS filemodule_id,
+	frs_release.name AS module_name,
+	frs_release.notes AS module_notes,
+	frs_release.status_id AS release_status,
+	frs_release.release_date AS release_date,
+	frs_file.release_time AS release_time,
+	frs_file.filename AS filename,
+	frs_file.release_id AS filerelease_id
+FROM users,frs_file,frs_release,frs_package,groups
+WHERE frs_release.released_by=users.user_id
+  AND frs_release.package_id=frs_package.package_id
+  AND frs_package.group_id=groups.group_id
+  AND frs_release.status_id=1
+  AND groups.is_public=1
+  AND (package.group_id=$1 AND 1=$2)
+  AND frs_file.release_id=frs_release.release_id
+ORDER BY frs_file.release_time DESC',
+			array ($group_id,
+			       $group_id ? 1 : 0),
+			$limit * 3);
 
 
 // ## item outputs

Modified: trunk/gforge/www/export/rss20_news.php
===================================================================
--- trunk/gforge/www/export/rss20_news.php	2009-09-23 15:18:31 UTC (rev 8153)
+++ trunk/gforge/www/export/rss20_news.php	2009-09-23 15:18:38 UTC (rev 8154)
@@ -57,18 +57,22 @@
 print "  <docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
 print "  <generator>".$GLOBALS['sys_name']." RSS generator</generator>\n";
 
-$sql = "SELECT forum_id,summary,post_date,details,g.group_id,g.group_name,u.realname,u.user_name
-        FROM news_bytes, groups g,users u
-        WHERE news_bytes.group_id=g.group_id
-        AND u.user_id=news_bytes.submitted_by
-        AND g.is_public='1'
-        AND g.status='A'
-        AND news_bytes.is_approved <> '4'
-        $where
-        ORDER BY post_date DESC";
+$res = db_query_params ('SELECT forum_id,summary,post_date,details,g.group_id,g.group_name,u.realname,u.user_name
+FROM news_bytes, groups g,users u
+WHERE news_bytes.group_id=g.group_id
+AND u.user_id=news_bytes.submitted_by
+AND g.is_public=1
+AND g.status=$1
+AND news_bytes.is_approved <> 4
+AND (g.group_id=$group_id AND 1 = $3)
+AND (is_approved=1 AND 1 = $4)
+ORDER BY post_date DESC',
+			array ('A',
+			       $group_id,
+			       $group_id ? 1 : 0,
+			       $group_id ? 0 : 1),
+			$limit) ;
 
-$res = db_query($sql, $limit);
-
 // ## item outputs
 while ($row = db_fetch_array($res)) {
 	print "  <item>\n";




More information about the Fusionforge-commits mailing list