[feladat @ 209]
authorpeter
Sat, 29 Mar 2008 18:01:53 +0000
changeset 109 34b2d49f52c6
parent 108 b1015b3055af
child 110 455405c757e1
[feladat @ 209] Modified some of the INSERT queries to make them compatible with pgSQL
inc/users.inc.php
--- a/inc/users.inc.php	Sat Mar 29 07:34:57 2008 +0000
+++ b/inc/users.inc.php	Sat Mar 29 18:01:53 2008 +0000
@@ -596,9 +596,8 @@
 
 	// Fix permission template name and description first. 
 
-	$query = "INSERT INTO perm_templ 
-			VALUES (
-				'', " 
+	$query = "INSERT INTO perm_templ (name, descr)
+			VALUES (" 
 				. $db->quote($details['templ_name']) . ", " 
 				. $db->quote($details['templ_descr']) . ")";
 
@@ -608,9 +607,9 @@
 	$perm_templ_id = $db->lastInsertId('perm_templ', 'id');
 
 	foreach ($details['perm_id'] AS $perm_id) {
-		$r_insert_values[] = "(''," . $db->quote($perm_templ_id) . "," . $db->quote($perm_id) . ")";
+		$r_insert_values[] = "(" . $db->quote($perm_templ_id) . "," . $db->quote($perm_id) . ")";
 	}
-	$query = "INSERT INTO perm_templ_items VALUES " . implode(',', $r_insert_values) ;
+	$query = "INSERT INTO perm_templ_items (templ_id, perm_id) VALUES " . implode(',', $r_insert_values) ;
 	$result = $db->query($query);
 	if (pear::iserror($response)) { error($response->getmessage()); return false; }
 
@@ -644,9 +643,9 @@
 	if (pear::iserror($response)) { error($response->getmessage()); return false; }
 
 	foreach ($details['perm_id'] AS $perm_id) {
-		$r_insert_values[] = "(''," . $db->quote($details['templ_id']) . "," . $db->quote($perm_id) . ")";
+		$r_insert_values[] = "(" . $db->quote($details['templ_id']) . "," . $db->quote($perm_id) . ")";
 	}
-	$query = "INSERT INTO perm_templ_items VALUES " . implode(',', $r_insert_values) ;
+	$query = "INSERT INTO perm_templ_items (templ_id, perm_id) VALUES " . implode(',', $r_insert_values) ;
 	$result = $db->query($query);
 	if (pear::iserror($response)) { error($response->getmessage()); return false; }
 
@@ -751,8 +750,7 @@
 		$active = 0;
 	}
 
-	$query = "INSERT INTO users VALUES ( "
-			. "'', "
+	$query = "INSERT INTO users (username, password, fullname, email, description, perm_templ, active) VALUES ("
 			. $db->quote($details['username']) . ", "
 			. $db->quote(md5($details['password'])) . ", "
 			. $db->quote($details['fullname']) . ", "