# HG changeset patch # User peter # Date 1199620157 0 # Node ID 2f8c29fc5e2e9b18f33c40b83fea2ec4ec4575d8 # Parent 9e9876afefcc959d4151800b5f8131bbf260a2a2 [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. diff -r 9e9876afefcc -r 2f8c29fc5e2e inc/database.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)) { diff -r 9e9876afefcc -r 2f8c29fc5e2e inc/users.inc.php --- 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 != "")