[Fusionforge-commits] r8191 - trunk/gforge/plugins/webcalendar/script

Roland Mas lolando at libremir.placard.fr.eu.org
Fri Sep 25 15:53:31 CEST 2009


Author: lolando
Date: 2009-09-25 15:53:31 +0200 (Fri, 25 Sep 2009)
New Revision: 8191

Modified:
   trunk/gforge/plugins/webcalendar/script/webcalendar-init.php
Log:
db_query_params() migration

Modified: trunk/gforge/plugins/webcalendar/script/webcalendar-init.php
===================================================================
--- trunk/gforge/plugins/webcalendar/script/webcalendar-init.php	2009-09-25 13:53:21 UTC (rev 8190)
+++ trunk/gforge/plugins/webcalendar/script/webcalendar-init.php	2009-09-25 13:53:31 UTC (rev 8191)
@@ -2,28 +2,28 @@
 
 
 //create the config file for webcalendar
-$fichier_conf = "<?php\n" .
-		"install_password: 764b9c698569b4e77fd69db363fef414" .
-		"\ndb_type: postgresql" .
-		"\ndb_host: ".$sys_gfdbhost.
-		"\ndb_database: ".$sys_gfdbname.
-		"\ndb_login: ".$sys_gfdbuser.
-		"\ndb_password: ".$sys_gfdbpasswd.
-		"\ndb_persistent: true" .
-		"\nsingle_user_login:" . 
-		"\nreadonly: false" .
-		"\nuse_http_auth: false" .
-		"\nsingle_user: false" .
-		"\nuser_inc: user.php" .
-		"\n?>" ;
+$fichier_conf = "<?php
+install_password: 764b9c698569b4e77fd69db363fef414
+db_type: postgresql
+db_host: $sys_gfdbhost
+db_database: $sys_gfdbname
+db_login: $sys_gfdbuser
+db_password: $sys_gfdbpasswd
+db_persistent: true
+single_user_login: 
+readonly: false
+use_http_auth: false
+single_user: false
+user_inc: user.php
+?>" ;
 
 $handle = fopen($sys_plugins_path . '/' . $pluginname . "/www/includes/settings.php", "w");
 fwrite($handle,$fichier_conf);
 fclose($handle);
 
 //user
-$query = "SELECT user_name,user_pw,email,user_id FROM users WHERE NOT user_name='None' ";
-$res = db_query($query);
+$res = db_query_params ('SELECT user_name,user_pw,email,user_id FROM users WHERE NOT user_name=$1 ',
+			array ('None'));
 echo db_error();
 while ($row = db_fetch_array($res)) {
 	//verify if admin
@@ -42,8 +42,8 @@
 
 //group
 
-$query2 = "SELECT  unix_group_name,groups.group_id,group_name,email FROM groups,users,user_group WHERE groups.group_id >5 AND groups.group_id = user_group.group_id AND user_group.user_id = users.user_id AND user_group.admin_flags = 'A' ";
-$res2 = db_query($query2);
+$res2 = db_query_params ('SELECT  unix_group_name,groups.group_id,group_name,email FROM groups,users,user_group WHERE groups.group_id >5 AND groups.group_id = user_group.group_id AND user_group.user_id = users.user_id AND user_group.admin_flags = $1 ',
+			array ('A'));
 while ($row2 = db_fetch_array($res2)) {
 	$cal_query2 = "INSERT INTO webcal_user (cal_login, cal_passwd, cal_firstname,cal_email) VALUES ('" . $row2['unix_group_name'] . "','qdkqshjddoshd','" . addslashes($row2['group_name']) . "','" . $row2['email'] . "')";
 
@@ -54,8 +54,7 @@
 	$res_user_group = db_query($query_user_group);
 	
 	//get the email of the admin
-	$query_mail ="SELECT cal_email FROM webcal_user WHERE  cal_login = '".$row2['unix_group_name']."'";			
-	$res_mail = db_query($query_mail);
+		$res_mail = db_query("SELECT cal_email FROM webcal_user WHERE  cal_login = '".$row2['unix_group_name']."'");
 	$row_mail = db_fetch_array($res_mail);	
 	$mail = $row_mail['cal_email'];
 	
@@ -88,8 +87,9 @@
 
 //link
 
-$query_hierarchy = "select p1.group_id as father_id,p1.unix_group_name as father_unix_name,p1.group_name as father_name,p2.group_id as son_id,p2.unix_group_name as son_unix_name,p2.group_name as son_name from groups as p1,groups as p2,plugin_projects_hierarchy where p1.group_id=plugin_projects_hierarchy.project_id and p2.group_id=plugin_projects_hierarchy.sub_project_id and plugin_projects_hierarchy.activated='t' AND plugin_projects_hierarchy.link_type='shar'";
-$res_hierarchy = db_query($query_hierarchy);
+$res_hierarchy = db_query_params ('select p1.group_id as father_id,p1.unix_group_name as father_unix_name,p1.group_name as father_name,p2.group_id as son_id,p2.unix_group_name as son_unix_name,p2.group_name as son_name from groups as p1,groups as p2,plugin_projects_hierarchy where p1.group_id=plugin_projects_hierarchy.project_id and p2.group_id=plugin_projects_hierarchy.sub_project_id and plugin_projects_hierarchy.activated=$1 AND plugin_projects_hierarchy.link_type=$2',
+			array ('t',
+				'shar'));
 if($res_hierarchy){
 		while($row_hierarchy = db_fetch_array($res_hierarchy)) {
 			$query_entry = "SELECT cal_id FROM webcal_entry_user WHERE cal_login = '".$row_hierarchy['son_unix_name']."' AND cal_status = 'A'" ;
@@ -106,9 +106,8 @@
 
 //admin
 	
-$query_flags = "SELECT value, user_id, group_id FROM user_group,role_setting WHERE role_setting.role_id = user_group.role_id AND role_setting.section_name = 'webcal'" ;				
-				//$query_flags = "SELECT admin_flags FROM user_group WHERE user_id = '".$params[0]."' AND group_id = '".$params[1]."'";
-				$res = db_query($query_flags);
+				$res = db_query_params ('SELECT value, user_id, group_id FROM user_group,role_setting WHERE role_setting.role_id = user_group.role_id AND role_setting.section_name = $1',
+			array ('webcal'));
 				if($res){
 						while( $row_flags = db_fetch_array($res)){
 						




More information about the Fusionforge-commits mailing list