Skip to content

Commit

Permalink
Remove Unused Variables from Mantis Core
Browse files Browse the repository at this point in the history
  • Loading branch information
mantis committed Jan 26, 2014
1 parent 0ee5e93 commit 3a8474f
Show file tree
Hide file tree
Showing 29 changed files with 41 additions and 128 deletions.
2 changes: 0 additions & 2 deletions bug_actiongroup_update_severity_inc.php
Expand Up @@ -89,8 +89,6 @@ function action_update_severity_print_fields() {
* @return string|null On failure: the reason why the action could not be validated. On success: null.
*/
function action_update_severity_validate( $p_bug_id ) {
$f_severity = gpc_get_string( 'severity' );

$t_update_severity_threshold = config_get( 'update_bug_threshold' );
$t_bug_id = $p_bug_id;

Expand Down
8 changes: 3 additions & 5 deletions core/bug_api.php
Expand Up @@ -655,23 +655,23 @@ function update( $p_update_extended = false, $p_bypass_mail = false ) {

if( $t_old_data->description != $this->description ) {
if ( bug_revision_count( $c_bug_id, REV_DESCRIPTION ) < 1 ) {
$t_revision_id = bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_DESCRIPTION, $t_old_data->description, 0, $t_old_data->date_submitted );
bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_DESCRIPTION, $t_old_data->description, 0, $t_old_data->date_submitted );
}
$t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_DESCRIPTION, $this->description );
history_log_event_special( $c_bug_id, DESCRIPTION_UPDATED, $t_revision_id );
}

if( $t_old_data->steps_to_reproduce != $this->steps_to_reproduce ) {
if ( bug_revision_count( $c_bug_id, REV_STEPS_TO_REPRODUCE ) < 1 ) {
$t_revision_id = bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_STEPS_TO_REPRODUCE, $t_old_data->steps_to_reproduce, 0, $t_old_data->date_submitted );
bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_STEPS_TO_REPRODUCE, $t_old_data->steps_to_reproduce, 0, $t_old_data->date_submitted );
}
$t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_STEPS_TO_REPRODUCE, $this->steps_to_reproduce );
history_log_event_special( $c_bug_id, STEP_TO_REPRODUCE_UPDATED, $t_revision_id );
}

if( $t_old_data->additional_information != $this->additional_information ) {
if ( bug_revision_count( $c_bug_id, REV_ADDITIONAL_INFO ) < 1 ) {
$t_revision_id = bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_ADDITIONAL_INFO, $t_old_data->additional_information, 0, $t_old_data->date_submitted );
bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_ADDITIONAL_INFO, $t_old_data->additional_information, 0, $t_old_data->date_submitted );
}
$t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_ADDITIONAL_INFO, $this->additional_information );
history_log_event_special( $c_bug_id, ADDITIONAL_INFO_UPDATED, $t_revision_id );
Expand Down Expand Up @@ -1073,11 +1073,9 @@ function bug_copy( $p_bug_id, $p_target_project_id = null, $p_copy_custom_fields
global $g_db;

$t_mantis_custom_field_string_table = db_get_table( 'custom_field_string' );
$t_mantis_bug_file_table = db_get_table( 'bug_file' );
$t_mantis_bugnote_table = db_get_table( 'bugnote' );
$t_mantis_bugnote_text_table = db_get_table( 'bugnote_text' );
$t_mantis_bug_history_table = db_get_table( 'bug_history' );
$t_mantis_db = $g_db;

$t_bug_id = (int)$p_bug_id;
$t_target_project_id = (int)$p_target_project_id;
Expand Down
2 changes: 0 additions & 2 deletions core/bug_group_action_api.php
Expand Up @@ -102,8 +102,6 @@ function bug_group_action_print_bug_list( $p_bug_ids_array ) {
$t_i = 1;

foreach( $p_bug_ids_array as $t_bug_id ) {
$t_class = sprintf( "row-%d", ( $t_i++ % 2 ) + 1 );

# choose color based on status
$status_label = html_get_status_css_class( bug_get_field( $t_bug_id, 'status' ), auth_get_current_user_id(), bug_get_field( $t_bug_id, 'project_id' ) );

Expand Down
2 changes: 1 addition & 1 deletion core/bugnote_api.php
Expand Up @@ -326,7 +326,7 @@ function bugnote_delete_all( $p_bug_id ) {
# Delete the corresponding bugnotes
$query = "DELETE FROM $t_bugnote_table
WHERE bug_id=" . db_param();
$result = db_query_bound( $query, array( (int)$p_bug_id ) );
db_query_bound( $query, array( (int)$p_bug_id ) );

# db_query errors on failure so:
return true;
Expand Down
5 changes: 1 addition & 4 deletions core/collapse_api.php
Expand Up @@ -130,8 +130,6 @@ function collapse_icon( $p_name, $p_section = '' ) {
return;
}

$t_block = ( is_blank( $p_section ) ? $p_name : $p_section . '_' . $p_name );

global $g_open_collapse_section;

if( $g_open_collapse_section === true ) {
Expand All @@ -157,7 +155,7 @@ function collapse_end( $p_name, $p_section = '' ) {
global $g_current_collapse_section, $g_open_collapse_section;

$t_block = ( is_blank( $p_section ) ? $p_name : $p_section . '_' . $p_name );
$t_display = collapse_display( $t_block );
collapse_display( $t_block );

# Make sure a section is opened, and it is the same section.
if( $t_block !== $g_current_collapse_section ) {
Expand Down Expand Up @@ -210,7 +208,6 @@ function collapse_cache_token() {
return;
}

$t_user_id = auth_get_current_user_id();
$t_token = token_get_value( TOKEN_COLLAPSE );

if( !is_null( $t_token ) ) {
Expand Down
2 changes: 1 addition & 1 deletion core/columns_api.php
Expand Up @@ -1040,7 +1040,7 @@ function print_column_plugin( $p_column_object, $p_bug, $p_columns_target = COLU
* @access public
*/
function print_column_edit( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
global $t_icon_path, $t_update_bug_threshold;
global $t_icon_path;

echo '<td class="column-edit">';

Expand Down
17 changes: 7 additions & 10 deletions core/config_api.php
Expand Up @@ -230,7 +230,7 @@ function config_get_access( $p_option, $p_user = null, $p_project = null ) {
global $g_cache_config, $g_cache_config_access, $g_cache_filled;

if( !$g_cache_filled ) {
$t = config_get( $p_option, -1, $p_user, $p_project );
config_get( $p_option, -1, $p_user, $p_project );
}

# prepare the user's list
Expand Down Expand Up @@ -286,7 +286,7 @@ function config_is_set( $p_option, $p_user = null, $p_project = null ) {
global $g_cache_config, $g_cache_filled;

if( !$g_cache_filled ) {
$t = config_get( $p_option, -1, $p_user, $p_project );
config_get( $p_option, -1, $p_user, $p_project );
}

# prepare the user's list
Expand Down Expand Up @@ -404,7 +404,7 @@ function config_set( $p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PR
);
}

$result = db_query_bound( $t_set_query, $t_params );
db_query_bound( $t_set_query, $t_params );
}

config_set_cache( $p_option, $c_value, $t_type, $p_user, $p_project, $p_access );
Expand Down Expand Up @@ -501,8 +501,6 @@ function config_can_delete( $p_option ) {
* @param int $p_project project id
*/
function config_delete( $p_option, $p_user = ALL_USERS, $p_project = ALL_PROJECTS ) {
global $g_cache_config, $g_cache_config_access;

# bypass table lookup for certain options
$t_bypass_lookup = !config_can_set_in_database( $p_option );

Expand All @@ -516,7 +514,7 @@ function config_delete( $p_option, $p_user = ALL_USERS, $p_project = ALL_PROJECT
WHERE config_id = " . db_param() . " AND
project_id=" . db_param() . " AND
user_id=" . db_param();
$result = db_query_bound( $query, array( $p_option, $p_project, $p_user ) );
db_query_bound( $query, array( $p_option, $p_project, $p_user ) );
}

config_flush_cache( $p_option, $p_user, $p_project );
Expand Down Expand Up @@ -547,9 +545,8 @@ function config_delete_for_user( $p_option, $p_user_id ) {
*/
function config_delete_project( $p_project = ALL_PROJECTS ) {
$t_config_table = db_get_table( 'config' );
$query = "DELETE FROM $t_config_table
WHERE project_id=" . db_param();
$result = db_query_bound( $query, array( $p_project ) );
$query = "DELETE FROM $t_config_table WHERE project_id=" . db_param();
db_query_bound( $query, array( $p_project ) );

# flush cache here in case some of the deleted configs are in use.
config_flush_cache();
Expand All @@ -564,7 +561,7 @@ function config_delete_project( $p_project = ALL_PROJECTS ) {
* @param int $p_project project id
*/
function config_flush_cache( $p_option = '', $p_user = ALL_USERS, $p_project = ALL_PROJECTS ) {
global $g_cache_config, $g_cache_config_access, $g_cache_filled;
global $g_cache_filled;

if( '' !== $p_option ) {
unset( $GLOBALS['g_cache_config'][$p_option][$p_user][$p_project] );
Expand Down
2 changes: 0 additions & 2 deletions core/current_user_api.php
Expand Up @@ -209,8 +209,6 @@ function current_user_ensure_unprotected() {
*/
function current_user_get_bug_filter( $p_project_id = null ) {
$f_filter_string = gpc_get_string( 'filter', '' );
$t_view_all_cookie = '';
$t_cookie_detail = '';
$t_filter = '';

if( !is_blank( $f_filter_string ) ) {
Expand Down
2 changes: 1 addition & 1 deletion core/custom_field_api.php
Expand Up @@ -625,7 +625,7 @@ function custom_field_get_id_from_name( $p_field_name ) {
* @access public
*/
function custom_field_get_linked_ids( $p_project_id = ALL_PROJECTS ) {
global $g_cache_cf_linked, $g_cache_custom_field;
global $g_cache_cf_linked;

if( !isset( $g_cache_cf_linked[$p_project_id] ) ) {

Expand Down
11 changes: 1 addition & 10 deletions core/database_api.php
Expand Up @@ -152,7 +152,6 @@ function db_is_connected() {
* @return bool indicating if php current supports the given database type
*/
function db_check_database_support( $p_db_type ) {
$t_support = false;
switch( $p_db_type ) {
case 'mysql':
$t_support = function_exists( 'mysql_connect' );
Expand Down Expand Up @@ -443,8 +442,6 @@ function db_param() {
* @return int Record Count
*/
function db_num_rows( $p_result ) {
global $g_db;

return $p_result->RecordCount();
}

Expand Down Expand Up @@ -543,8 +540,6 @@ function db_fetch_array( &$p_result ) {
* @return mixed Database result
*/
function db_result( $p_result, $p_index1 = 0, $p_index2 = 0 ) {
global $g_db;

if( $p_result && ( db_num_rows( $p_result ) > 0 ) ) {
$p_result->Move( $p_index1 );
$t_result = $p_result->GetArray();
Expand All @@ -569,7 +564,6 @@ function db_result( $p_result, $p_index1 = 0, $p_index2 = 0 ) {
*/
function db_insert_id( $p_table = null, $p_field = "id" ) {
global $g_db;
$t_db_type = config_get_global( 'db_type' );

if( isset( $p_table ) ) {
if( db_is_oracle() ) {
Expand Down Expand Up @@ -620,7 +614,7 @@ function db_table_exists( $p_table_name ) {
* @return bool indicating whether the index exists
*/
function db_index_exists( $p_table_name, $p_index_name ) {
global $g_db, $g_db_schema;
global $g_db;

if( is_blank( $p_index_name ) || is_blank( $p_table_name ) ) {
return false;
Expand Down Expand Up @@ -651,7 +645,6 @@ function db_index_exists( $p_table_name, $p_index_name ) {
* @return bool indicating whether the field exists
*/
function db_field_exists( $p_field_name, $p_table_name ) {
global $g_db;
$columns = db_field_names( $p_table_name );
return in_array( $p_field_name, $columns );
}
Expand Down Expand Up @@ -839,8 +832,6 @@ function db_prepare_bool( $p_bool ) {
* @return string Formatted Date for DB insertion e.g. 1970-01-01 00:00:00 ready for database insertion
*/
function db_now() {
global $g_db;

return time();
}

Expand Down
4 changes: 1 addition & 3 deletions core/error_api.php
Expand Up @@ -71,8 +71,7 @@
* @uses html_api.php (optional)
*/
function error_handler( $p_type, $p_error, $p_file, $p_line, $p_context ) {
global $g_error_parameters, $g_error_handled, $g_error_proceed_url;
global $g_lang_overrides;
global $g_error_parameters, $g_error_handled;
global $g_error_send_page_header;

# check if errors were disabled with @ somewhere in this call chain
Expand All @@ -99,7 +98,6 @@ function error_handler( $p_type, $p_error, $p_file, $p_line, $p_context ) {
$t_lang_pushed = true;
}

$t_short_file = basename( $p_file );
$t_method_array = config_get_global( 'display_errors' );
if( isset( $t_method_array[$p_type] ) ) {
$t_method = $t_method_array[$p_type];
Expand Down
9 changes: 3 additions & 6 deletions core/file_api.php
Expand Up @@ -56,8 +56,6 @@
* @return string
*/
function file_get_display_name( $p_filename ) {
$t_array = explode( '-', $p_filename, 2 );

# Check if it's a project document filename (doc-0000000-filename)
# or a bug attachment filename (0000000-filename)
# for newer filenames, the filename in schema is correct.
Expand Down Expand Up @@ -458,7 +456,7 @@ function file_delete_project_files( $p_project_id ) {
# Delete the corresponding db records
$query = "DELETE FROM $t_project_file_table
WHERE project_id=" . db_param();
$result = db_query_bound( $query, array( (int) $p_project_id ) );
db_query_bound( $query, array( (int) $p_project_id ) );
}

/**
Expand Down Expand Up @@ -490,7 +488,7 @@ function file_ftp_connect() {
*/
function file_ftp_put( $p_conn_id, $p_remote_filename, $p_local_filename ) {
helper_begin_long_process();
$upload = ftp_put( $p_conn_id, $p_remote_filename, $p_local_filename, FTP_BINARY );
ftp_put( $p_conn_id, $p_remote_filename, $p_local_filename, FTP_BINARY );
}

/**
Expand All @@ -501,7 +499,7 @@ function file_ftp_put( $p_conn_id, $p_remote_filename, $p_local_filename ) {
*/
function file_ftp_get( $p_conn_id, $p_local_filename, $p_remote_filename ) {
helper_begin_long_process();
$download = ftp_get( $p_conn_id, $p_local_filename, $p_remote_filename, FTP_BINARY );
ftp_get( $p_conn_id, $p_local_filename, $p_remote_filename, FTP_BINARY );
}

/**
Expand Down Expand Up @@ -1181,7 +1179,6 @@ function file_copy_attachments( $p_source_bug_id, $p_dest_bug_id ) {

$t_project_id = bug_get_field( $p_source_bug_id, 'project_id' );

$t_bug_file = array();
for( $i = 0;$i < $t_count;$i++ ) {
$t_bug_file = db_fetch_array( $result );

Expand Down
19 changes: 7 additions & 12 deletions core/filter_api.php
Expand Up @@ -1421,9 +1421,7 @@ function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p
$t_available_statuses = MantisEnum::getValues( config_get( 'status_enum_string' ) );

if( 'simple' == $t_filter['_view_type'] ) {

# simple filtering: if showing any, restrict by the hide status value, otherwise ignore the hide
$t_any_found = false;
$t_this_status = $t_filter[FILTER_PROPERTY_STATUS][0];
$t_this_hide_status = $t_filter[FILTER_PROPERTY_HIDE_STATUS][0];

Expand Down Expand Up @@ -4215,9 +4213,7 @@ function print_filter_show_sort() {
* @param int $p_field_id
*/
function print_filter_custom_field_date( $p_field_num, $p_field_id ) {
global $t_filter, $t_accessible_custom_fields_names, $t_accessible_custom_fields_types, $t_accessible_custom_fields_values, $t_accessible_custom_fields_ids, $t_select_modifier;

$t_js_toggle_func = 'toggle_custom_date_field_' . $p_field_id . '_controls';
global $t_filter, $t_accessible_custom_fields_values;

# Resort the values so there ordered numerically, they are sorted as strings otherwise which
# may be wrong for dates before early 2001.
Expand Down Expand Up @@ -4335,7 +4331,7 @@ function print_filter_custom_field_date( $p_field_num, $p_field_id ) {
* print project field
*/
function print_filter_project_id() {
global $t_select_modifier, $t_filter, $f_view_type;
global $t_select_modifier, $t_filter;
?>
<!-- Project -->
<select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PROJECT_ID;?>[]">
Expand All @@ -4349,7 +4345,7 @@ function print_filter_project_id() {
}

function print_filter_match_type() {
global $t_select_modifier, $t_filter, $f_view_type;
global $t_select_modifier, $t_filter;
?>
<!-- Project -->
<select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_MATCH_TYPE;?>">
Expand Down Expand Up @@ -4687,14 +4683,13 @@ function filter_db_can_delete_filter( $p_filter_id ) {
function filter_db_delete_filter( $p_filter_id ) {
$t_filters_table = db_get_table( 'filters' );
$c_filter_id = (int)$p_filter_id;
$t_user_id = auth_get_current_user_id();

if( !filter_db_can_delete_filter( $c_filter_id ) ) {
return false;
}

$query = 'DELETE FROM ' . $t_filters_table . ' WHERE id=' . db_param();
$result = db_query_bound( $query, array( $c_filter_id ) );
$t_query = 'DELETE FROM ' . $t_filters_table . ' WHERE id=' . db_param();
db_query_bound( $t_query, array( $c_filter_id ) );

# db_query errors on failure so:
return true;
Expand All @@ -4707,10 +4702,10 @@ function filter_db_delete_current_filters() {
$t_filters_table = db_get_table( 'filters' );
$t_all_id = ALL_PROJECTS;

$query = "DELETE FROM $t_filters_table
$t_query = "DELETE FROM $t_filters_table
WHERE project_id<=" . db_param() . "
AND name=" . db_param();
$result = db_query_bound( $query, array( $t_all_id, '' ) );
db_query_bound( $t_query, array( $t_all_id, '' ) );
}

/**
Expand Down
1 change: 0 additions & 1 deletion core/helper_api.php
Expand Up @@ -142,7 +142,6 @@ function get_percentage_by_status() {
$query .= ' GROUP BY status';
$result = db_query_bound( $query );

$t_bug_count = 0;
$t_status_count_array = array();

while( $row = db_fetch_array( $result ) ) {
Expand Down

0 comments on commit 3a8474f

Please sign in to comment.