Skip to content

Commit

Permalink
Remove filter_is_cookie_valid
Browse files Browse the repository at this point in the history
This function is no longer needed.
  • Loading branch information
cproensa authored and atrol committed Mar 4, 2018
1 parent 9b5cbfb commit 4f2df23
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
2 changes: 0 additions & 2 deletions core/current_user_api.php
Expand Up @@ -249,8 +249,6 @@ function current_user_get_bug_filter( $p_project_id = null ) {
$t_filter = json_decode( $t_token, true );
}
$t_filter = filter_ensure_valid_filter( $t_filter );
} else if( !filter_is_cookie_valid() ) {
$t_filter = filter_get_default();
} else {
$t_user_id = auth_get_current_user_id();
$t_filter = user_get_bug_filter( $t_user_id, $p_project_id );
Expand Down
34 changes: 0 additions & 34 deletions core/filter_api.php
Expand Up @@ -1003,40 +1003,6 @@ function filter_serialize( $p_filter_array ) {
return $t_settings_string;
}

/**
* Check if the filter cookie exists and is of the correct version.
* @return boolean
*/
function filter_is_cookie_valid() {
$t_view_all_cookie_id = gpc_get_cookie( config_get_global( 'view_all_cookie' ), '' );
$t_view_all_cookie = filter_db_get_filter_string( $t_view_all_cookie_id );

# check to see if the cookie does not exist
if( is_blank( $t_view_all_cookie ) ) {
return false;
}

# check to see if new cookie is needed
$t_setting_arr = explode( '#', $t_view_all_cookie, 2 );
if( ( $t_setting_arr[0] == 'v1' ) || ( $t_setting_arr[0] == 'v2' ) || ( $t_setting_arr[0] == 'v3' ) || ( $t_setting_arr[0] == 'v4' ) ) {
return false;
}

# We shouldn't need to do this anymore, as filters from v5 onwards should cope with changing
# filter indices dynamically
$t_filter_cookie_arr = array();
if( isset( $t_setting_arr[1] ) ) {
$t_filter_cookie_arr = json_decode( $t_setting_arr[1], true );
} else {
return false;
}
if( $t_filter_cookie_arr['_version'] != FILTER_VERSION ) {
return false;
}

return true;
}

/**
* Get the filter db row $p_filter_id
* using the cached row if it's available
Expand Down

0 comments on commit 4f2df23

Please sign in to comment.