Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix handling of boolean columns for PostgreSQL

  • Loading branch information...
commit f0c040e04e6bed9b704a7ffac8d8142e293ed2cc 2 parents ae288b0 + e48ac09
@dregad dregad authored
View
2  api/soap/mc_api.php
@@ -545,7 +545,7 @@ function mci_filter_db_get_available_queries( $p_project_id = null, $p_user_id =
AND (is_public = " . db_param() . "
OR user_id = " . db_param() . ")
ORDER BY is_public DESC, name ASC";
- $t_result = db_query_bound( $t_query, array( $t_project_id, true, $t_user_id ) );
+ $t_result = db_query_bound( $t_query, array( $t_project_id, db_prepare_bool( true ), $t_user_id ) );
$t_query_count = db_num_rows( $t_result );
for( $i = 0;$i < $t_query_count;$i++ ) {
View
4 core/constant_inc.php
@@ -459,8 +459,8 @@
# Versions
define( 'VERSION_ALL', null );
-define( 'VERSION_FUTURE', 0 );
-define( 'VERSION_RELEASED', 1 );
+define( 'VERSION_FUTURE', false );
+define( 'VERSION_RELEASED', true );
# Contexts for bug summary
define( 'SUMMARY_CAPTION', 1 );
View
2  core/filter_api.php
@@ -4780,7 +4780,7 @@ function filter_db_get_available_queries( $p_project_id = null, $p_user_id = nul
AND (is_public = " . db_param() . "
OR user_id = " . db_param() . ")
ORDER BY is_public DESC, name ASC";
- $t_result = db_query_bound( $t_query, array( $t_project_id, true, $t_user_id ) );
+ $t_result = db_query_bound( $t_query, array( $t_project_id, db_prepare_bool( true ), $t_user_id ) );
$t_query_count = db_num_rows( $t_result );
for( $i = 0; $i < $t_query_count; $i++ ) {
View
6 core/project_api.php
@@ -331,7 +331,7 @@ function validate_project_file_path( $p_file_path ) {
* @return integer
*/
function project_create( $p_name, $p_description, $p_status, $p_view_state = VS_PUBLIC, $p_file_path = '', $p_enabled = true, $p_inherit_global = true ) {
- $c_enabled = (bool)$p_enabled;
+ $c_enabled = db_prepare_bool( $p_enabled );
if( is_blank( $p_name ) ) {
trigger_error( ERROR_PROJECT_NAME_INVALID, ERROR );
@@ -423,8 +423,8 @@ function project_delete( $p_project_id ) {
*/
function project_update( $p_project_id, $p_name, $p_description, $p_status, $p_view_state, $p_file_path, $p_enabled, $p_inherit_global ) {
$p_project_id = (int)$p_project_id;
- $c_enabled = (bool)$p_enabled;
- $c_inherit_global = (bool)$p_inherit_global;
+ $c_enabled = db_prepare_bool( $p_enabled );
+ $c_inherit_global = db_prepare_bool( $p_inherit_global );
if( is_blank( $p_name ) ) {
trigger_error( ERROR_PROJECT_NAME_INVALID, ERROR );
View
4 core/user_api.php
@@ -536,7 +536,7 @@ function user_create( $p_username, $p_password, $p_email = '',
$t_password = auth_process_plain_password( $p_password );
- $c_enabled = (bool)$p_enabled;
+ $c_enabled = db_prepare_bool( $p_enabled );
user_ensure_name_valid( $p_username );
user_ensure_name_unique( $p_username );
@@ -560,7 +560,7 @@ function user_create( $p_username, $p_password, $p_email = '',
# Users are added with protected set to FALSE in order to be able to update
# preferences. Now set the real value of protected.
if( $p_protected ) {
- user_set_field( $t_user_id, 'protected', (bool)$p_protected );
+ user_set_field( $t_user_id, 'protected', db_prepare_bool( $p_protected ) );
}
# Send notification email
View
20 core/version_api.php
@@ -218,7 +218,8 @@ function version_ensure_unique( $p_version, $p_project_id = null ) {
*/
function version_add( $p_project_id, $p_version, $p_released = VERSION_FUTURE, $p_description = '', $p_date_order = null, $p_obsolete = false ) {
$c_project_id = (int)$p_project_id ;
- $c_released = (int)$p_released;
+ $c_released = db_prepare_bool( $p_released );
+ $c_obsolete = db_prepare_bool( $p_obsolete );
if( null === $p_date_order ) {
$c_date_order = db_now();
@@ -234,7 +235,7 @@ function version_add( $p_project_id, $p_version, $p_released = VERSION_FUTURE, $
( project_id, version, date_order, description, released, obsolete )
VALUES
(" . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )';
- db_query_bound( $t_query, array( $c_project_id, $p_version, $c_date_order, $p_description, $c_released, $p_obsolete ) );
+ db_query_bound( $t_query, array( $c_project_id, $p_version, $c_date_order, $p_description, $c_released, $c_obsolete ) );
$t_version_id = db_insert_id( $t_project_version_table );
@@ -260,8 +261,8 @@ function version_update( VersionData $p_version_info ) {
$c_version_name = $p_version_info->version;
$c_old_version_name = $t_old_version_name;
$c_description = $p_version_info->description;
- $c_released = (int)$p_version_info->released;
- $c_obsolete = (bool)$p_version_info->obsolete;
+ $c_released = db_prepare_bool( $p_version_info->released );
+ $c_obsolete = db_prepare_bool( $p_version_info->obsolete );
$c_date_order = $p_version_info->date_order;
$c_project_id = (int)$p_version_info->project_id;
@@ -474,12 +475,12 @@ function version_get_all_rows( $p_project_id, $p_released = null, $p_obsolete =
if( $p_released !== null ) {
$t_query .= " AND released = " . db_param();
- $t_query_params[] = (int)$p_released;
+ $t_query_params[] = db_prepare_bool( $p_released );
}
if( $p_obsolete !== null ) {
$t_query .= " AND obsolete = " . db_param();
- $t_query_params[] = (bool)$p_obsolete;
+ $t_query_params[] = db_prepare_bool( $p_obsolete );
}
$t_query .= " ORDER BY date_order DESC";
@@ -509,7 +510,7 @@ function version_get_all_rows_with_subs( $p_project_id, $p_released = null, $p_o
if( $p_released === null ) {
$t_released_where = '';
} else {
- $c_released = (int)$p_released;
+ $c_released = db_prepare_bool( $p_released );
$t_released_where = "AND ( released = " . db_param() . " )";
$t_query_params[] = $c_released;
}
@@ -518,7 +519,7 @@ function version_get_all_rows_with_subs( $p_project_id, $p_released = null, $p_o
$t_obsolete_where = '';
} else {
$t_obsolete_where = "AND ( obsolete = " . db_param() . " )";
- $t_query_params[] = $p_obsolete;
+ $t_query_params[] = db_prepare_bool( $p_obsolete );
}
$t_project_version_table = db_get_table( 'project_version' );
@@ -666,7 +667,8 @@ function version_get( $p_version_id ) {
function version_prepare_db( VersionData $p_version_info ) {
$p_version_info->id = (int)$p_version_info->id;
$p_version_info->project_id = (int)$p_version_info->project_id;
- $p_version_info->released = (int)$p_version_info->released;
+ $p_version_info->released = db_prepare_bool( $p_version_info->released );
+ $p_version_info->obsolete = db_prepare_bool( $p_version_info->obsolete );
return $p_version_info;
}
2  library/adodb
@@ -1 +1 @@
-Subproject commit c1abd33cf8f4c67a98f559a0028f39d8194b21f0
+Subproject commit 9346d288a1b7f7a50cc35b6a0e56d29e9d000ecf
View
4 manage_proj_ver_edit_page.php
@@ -91,7 +91,7 @@
</div>
<div class="field-container">
<label for="proj-version-released"><span><?php echo lang_get( 'released' ) ?></span></label>
- <span class="checkbox"><input type="checkbox" id="proj-version-released" name="released" <?php check_checked( (int)$t_version->released, VERSION_RELEASED ); ?> /></span>
+ <span class="checkbox"><input type="checkbox" id="proj-version-released" name="released" <?php check_checked( (boolean)$t_version->released, VERSION_RELEASED ); ?> /></span>
<span class="label-style"></span>
</div>
<div class="field-container">
@@ -99,7 +99,7 @@
<span class="checkbox"><input type="checkbox" id="proj-version-obsolete" name="obsolete" <?php check_checked( (boolean)$t_version->obsolete, true ); ?> /></span>
<span class="label-style"></span>
</div>
-
+
<?php event_signal( 'EVENT_MANAGE_VERSION_UPDATE_FORM', array( $t_version->id ) ); ?>
<span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'update_version_button' ) ?>" /></span>
</fieldset>
View
4 manage_user_update.php
@@ -125,8 +125,8 @@
$c_email = $t_email;
$c_username = $f_username;
$c_realname = $t_realname;
-$c_protected = (bool)$f_protected;
-$c_enabled = (bool)$f_enabled;
+$c_protected = db_prepare_bool( $f_protected );
+$c_enabled = db_prepare_bool( $f_enabled );
$c_user_id = (int)$f_user_id;
$c_access_level = (int)$f_access_level;

0 comments on commit f0c040e

Please sign in to comment.
Something went wrong with that request. Please try again.