diff -ruaN mantisbt-svn5752.orig/core/database_api.php mantisbt-svn5752/core/database_api.php --- mantisbt-svn5752.orig/core/database_api.php 2008-10-11 00:10:54.000000000 +0300 +++ mantisbt-svn5752/core/database_api.php 2009-05-16 19:16:50.000000000 +0300 @@ -285,6 +285,8 @@ for( $i = 0;$i < $params;$i++ ) { if( $arr_parms[$i] === false ) { $arr_parms[$i] = 0; + } else if( $arr_parms[$i] === true ) { + $arr_parms[$i] = 1; } } } @@ -462,11 +464,11 @@ * @param string $p_table a valid database table name * @return int last successful insert id */ -function db_insert_id( $p_table = null ) { +function db_insert_id($p_table = null, $p_field = "id") { global $g_db; if( isset( $p_table ) && db_is_pgsql() ) { - $query = "SELECT currval('" . $p_table . "_id_seq')"; + $query = "SELECT currval('".$p_table."_".$p_field."_seq')"; $result = db_query_bound( $query ); return db_result( $result ); } @@ -739,7 +741,20 @@ * @todo Use/Behaviour of this function should be reviewed before 1.2.0 final */ function db_prepare_bool( $p_bool ) { - return (int) (bool) $p_bool; + if (db_is_pgsql()) { + if( $p_bool ) + { + return 'true'; + } + else + { + return 'false'; + } + } + else + { + return (int)(bool)$p_bool; + } } /** diff -ruaN mantisbt-svn5752.orig/core/email_queue_api.php mantisbt-svn5752/core/email_queue_api.php --- mantisbt-svn5752.orig/core/email_queue_api.php 2008-10-11 00:10:54.000000000 +0300 +++ mantisbt-svn5752/core/email_queue_api.php 2009-05-16 18:26:06.000000000 +0300 @@ -88,7 +88,7 @@ )"; db_query_bound( $query, Array( $c_email, $c_subject, $c_body, db_now(), $c_metadata ) ); - return db_insert_id( $t_email_table ); + return db_insert_id( $t_email_table, "email_id" ); } function email_queue_row_to_object( $p_row ) { diff -ruaN mantisbt-svn5752.orig/core/user_api.php mantisbt-svn5752/core/user_api.php --- mantisbt-svn5752.orig/core/user_api.php 2008-10-25 19:32:32.000000000 +0300 +++ mantisbt-svn5752/core/user_api.php 2009-05-16 18:25:32.000000000 +0300 @@ -469,7 +469,7 @@ # Users are added with protected set to FALSE in order to be able to update # preferences. Now set the real value of protected. if( $c_protected ) { - user_set_field( $t_user_id, 'protected', 1 ); + user_set_field( $t_user_id, 'protected', $c_protected ); } # Send notification email