[feladat @ 114]
authorpeter
Sun, 06 Jan 2008 11:49:17 +0000
changeset 67 2f8c29fc5e2e
parent 66 9e9876afefcc
child 68 0b8572de80f5
[feladat @ 114] Patch for ticket 19. Because of the use of the quote function, empty strings where converted to NULL as MDB2_PORTABILITY_EMPTY_TO_NULL is set by default. This problem also applied to the active state of an user.
inc/database.inc.php
inc/users.inc.php
--- a/inc/database.inc.php	Sat Jan 05 21:45:44 2008 +0000
+++ b/inc/database.inc.php	Sun Jan 06 11:49:17 2008 +0000
@@ -37,6 +37,7 @@
 
 $dsn = "$dbdsntype://$dbuser:$dbpass@$dbhost/$dbdatabase";
 $db = MDB2::connect($dsn);
+$db->setOption('portability', MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL);
 
 if (MDB2::isError($db))
 {
--- a/inc/users.inc.php	Sat Jan 05 21:45:44 2008 +0000
+++ b/inc/users.inc.php	Sun Jan 06 11:49:17 2008 +0000
@@ -214,7 +214,9 @@
 		{
 			error(ERR_INV_EMAIL);
 		}
-
+		if ($active != 1) {
+			$active = 0;
+		}
 		$db->query("INSERT INTO users (username, password, fullname, email, description, level, active) VALUES (".$db->quote($user).", '" . md5($password) . "', ".$db->quote($fullname).", ".$db->quote($email).", ".$db->quote($description).", ".$db->quote($level).", ".$db->quote($active).")");
 		return true;
 	}
@@ -240,7 +242,9 @@
 	{
 		error(ERR_INV_EMAIL);
 	}
-
+	if ($active != 1) {
+		$active = 0;
+	}
 	$sqlquery = "UPDATE users set username=".$db->quote($user).", fullname=".$db->quote($fullname).", email=".$db->quote($email).", level=".$db->quote($level).", description=".$db->quote($description).", active=".$db->quote($active);
 
 	if($password != "")