Skip to content

Commit

Permalink
remove a bunch of unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mantis committed Aug 14, 2012
1 parent c875184 commit ac184b1
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 39 deletions.
4 changes: 1 addition & 3 deletions core/custom_field_api.php
Expand Up @@ -779,7 +779,7 @@ function custom_field_get_id_from_name( $p_field_name, $p_truncated_length = nul
* @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 Expand Up @@ -933,7 +933,6 @@ function custom_field_get_value( $p_field_id, $p_bug_id ) {

$row = custom_field_cache_row( $p_field_id );

$t_access_level_r = $row['access_level_r'];
$t_default_value = $row['default_value'];

if( !custom_field_has_read_access( $p_field_id, $p_bug_id, auth_get_current_user_id() ) ) {
Expand Down Expand Up @@ -1067,7 +1066,6 @@ function custom_field_validate( $p_field_id, $p_value ) {
$result = db_query( $query, array( $p_field_id ) );
$row = db_fetch_array( $result );

$t_name = $row['name'];
$t_type = $row['type'];
$t_possible_values = $row['possible_values'];
$t_valid_regexp = $row['valid_regexp'];
Expand Down
11 changes: 3 additions & 8 deletions core/database_api.php
Expand Up @@ -129,15 +129,15 @@ function db_is_mssql() {
*/
function db_query( $p_query, $arr_parms = null, $p_limit = -1, $p_offset = -1 ) {
global $g_db;

if(( $p_limit != -1 ) || ( $p_offset != -1 ) ) {
$t_result = $g_db->SelectLimit( $p_query, $p_limit, $p_offset, $arr_parms );
} else {
$t_result = $g_db->Execute( $p_query, $arr_parms );
}

if( !$t_result ) {
throw new MantisBT\Exception\Database\QueryFailed();
throw new MantisBT\Exception\Database\QueryFailed( $p_query );
return false;
} else {
return $t_result;
Expand All @@ -150,8 +150,6 @@ function db_query( $p_query, $arr_parms = null, $p_limit = -1, $p_offset = -1 )
* @return array Database result
*/
function db_fetch_array( &$p_result ) {
global $g_db, $g_db_type;

return $p_result->fetch();
}

Expand Down Expand Up @@ -210,7 +208,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 All @@ -237,7 +235,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 @@ -269,8 +266,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
5 changes: 2 additions & 3 deletions core/file_api.php
Expand Up @@ -394,7 +394,7 @@ function file_delete_attachments( $p_bug_id ) {
# Delete the corresponding db records
$t_query = "DELETE FROM $t_bug_file_table
WHERE bug_id=%d";
$t_result = db_query( $t_query, array( $p_bug_id ) );
db_query( $t_query, array( $p_bug_id ) );

# db_query errors on failure so:
return true;
Expand Down Expand Up @@ -440,7 +440,7 @@ function file_delete_project_files( $p_project_id ) {

# Delete the corresponding db records
$t_query = 'DELETE FROM {project_file} WHERE project_id=%d';
$t_result = db_query( $t_query, array( (int) $p_project_id ) );
db_query( $t_query, array( (int) $p_project_id ) );
}

/**
Expand Down Expand Up @@ -926,7 +926,6 @@ function file_ensure_uploaded( $p_file ) {
function file_get_content( $p_file_id, $p_type = 'bug' ) {
# we handle the case where the file is attached to a bug
# or attached to a project as a project doc.
$query = '';
switch ( $p_type ) {
case 'bug':
$query = "SELECT * FROM {bug_file} WHERE id=%d";
Expand Down
1 change: 0 additions & 1 deletion core/helper_api.php
Expand Up @@ -87,7 +87,6 @@ function get_percentage_by_status() {
$t_query .= ' GROUP BY status';
$result = db_query( $t_query );

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

while( $row = db_fetch_array( $result ) ) {
Expand Down
18 changes: 9 additions & 9 deletions core/install_helper_functions_api.php
Expand Up @@ -264,7 +264,7 @@ function install_correct_multiselect_custom_fields_db_format() {
SET value = '$c_value'
WHERE field_id = $c_field_id
AND bug_id = $c_bug_id";
$t_update_result = db_query( $t_update_query );
db_query( $t_update_query );
}

# Remove vertical pipe | prefix and suffix from radio custom field values.
Expand All @@ -284,7 +284,7 @@ function install_correct_multiselect_custom_fields_db_format() {
SET value = '$c_value'
WHERE field_id = $c_field_id
AND bug_id = $c_bug_id";
$t_update_result = db_query( $t_update_query );
db_query( $t_update_query );
}

# Return 2 because that's what ADOdb/DataDict does when things happen properly
Expand Down Expand Up @@ -334,7 +334,7 @@ function install_stored_filter_migrate() {
$t_filter_string = $t_cookie_version . '#' . $t_filter_serialized;

$t_update_query = 'UPDATE {filters} SET filter_string=%s WHERE id=%d';
$t_update_result = db_query( $t_update_query, array( $t_filter_string, $t_row['id'] ) );
db_query( $t_update_query, array( $t_filter_string, $t_row['id'] ) );
}

# Return 2 because that's what ADOdb/DataDict does when things happen properly
Expand Down Expand Up @@ -410,10 +410,10 @@ function install_update_export_columns() {

$query = "INSERT INTO {config} (config_id, value, access_reqd, type, project_id, user_id ) VALUES ( %s,%s,%d,%d,%d,%d )";
$t_value = serialize( array_values( array_unique( $t_array ) ) );
$t_result3 = db_query( $query, array( 'export_columns', $t_value, $access_reqd, $type, $project_id, $user_id ) );
db_query( $query, array( 'export_columns', $t_value, $access_reqd, $type, $project_id, $user_id ) );

$query = "DELETE FROM {config} WHERE (config_id = 'csv_columns' or config_id = 'excel_columns') AND access_reqd=%d AND type=%d AND project_id=%d AND user_id=%d";
$t_result3 = db_query( $query, array( $access_reqd, $type, $project_id, $user_id ) );
db_query( $query, array( $access_reqd, $type, $project_id, $user_id ) );
}

# Return 2 because that's what ADOdb/DataDict does when things happen properly
Expand All @@ -434,10 +434,10 @@ function install_migrate_bug_text() {
$additional_information = $t_row['additional_information'];

$query = "UPDATE {bug} SET description=%s, steps_to_reproduce=%s, additional_information=%s WHERE bug_text_id=%d";
$t_result3 = db_query( $query, array( $description, $steps_to_reproduce, $additional_information, $text_id ) );
db_query( $query, array( $description, $steps_to_reproduce, $additional_information, $text_id ) );

$query = "DELETE FROM {bug_text} WHERE id=%d";
$t_result3 = db_query( $query, array( $text_id ) );
db_query( $query, array( $text_id ) );
}

# Return 2 because that's what ADOdb/DataDict does when things happen properly
Expand All @@ -456,10 +456,10 @@ function install_migrate_bugnote_text() {
$note = $t_row['note'];

$query = "UPDATE {bugnote} SET note=%s WHERE bugnote_text_id=%d";
$t_result3 = db_query( $query, array( $note, $text_id ) );
db_query( $query, array( $note, $text_id ) );

$query = "DELETE FROM {bugnote_text} WHERE id=%d";
$t_result3 = db_query( $query, array( $text_id ) );
db_query( $query, array( $text_id ) );
}

# Return 2 because that's what ADOdb/DataDict does when things happen properly
Expand Down
6 changes: 2 additions & 4 deletions core/ldap_api.php
Expand Up @@ -109,7 +109,7 @@ function ldap_email( $p_user_id ) {

$t_ldap_email_field = config_get( 'ldap_email_field' );

$t_email = ldap_get_field_from_username( $p_username, $t_ldap_email_field );
$t_email = ldap_get_field_from_username( $t_username, $t_ldap_email_field );
if ( $t_email === null ) {
return '';
}
Expand All @@ -127,7 +127,7 @@ function ldap_realname( $p_user_id ) {
$t_username = user_get_field( $p_user_id, 'username' );

$t_ldap_realname_field = config_get( 'ldap_realname_field' );
$t_realname = ldap_get_field_from_username( $p_username, $t_ldap_realname_field );
$t_realname = ldap_get_field_from_username( $t_username, $t_ldap_realname_field );
if ( $t_realname === null ) {
return '';
}
Expand Down Expand Up @@ -266,8 +266,6 @@ function ldap_authenticate( $p_user_id, $p_password ) {
* @return true: authenticated, false: failed to authenticate.
*/
function ldap_authenticate_by_username( $p_username, $p_password ) {
$c_username = ldap_escape_string( $p_username );

$t_dn = ldap_get_field_from_username( $p_username, 'dn' );
$t_authenticated = false;

Expand Down
2 changes: 0 additions & 2 deletions core/news_api.php
Expand Up @@ -177,8 +177,6 @@ function news_get_row( $p_news_id ) {
* @return int news count
*/
function news_get_count( $p_project_id, $p_sitewide = true ) {
$c_project_id = (int)$p_project_id;

$t_project_where = helper_project_specific_where( $p_project_id );

$t_query = "SELECT COUNT(*) FROM {news} WHERE $t_project_where";
Expand Down
5 changes: 2 additions & 3 deletions core/print_api.php
Expand Up @@ -1152,7 +1152,7 @@ function print_view_bug_sort_link( $p_string, $p_sort_field, $p_sort, $p_dir, $p
}
} else {
# Otherwise always start with ASCending
$t_dir = 'ASC';
$p_dir = 'ASC';
}

$t_sort_field = rawurlencode( $p_sort_field );
Expand All @@ -1169,7 +1169,7 @@ function print_view_bug_sort_link( $p_string, $p_sort_field, $p_sort, $p_dir, $p
}
} else {
# Otherwise always start with ASCending
$t_dir = 'ASC';
$p_dir = 'ASC';
}

$t_sort_field = rawurlencode( $p_sort_field );
Expand Down Expand Up @@ -1600,7 +1600,6 @@ function get_dropdown( $p_control_array, $p_control_name, $p_match = '', $p_add_
*/
function print_bug_attachments_list( $p_bug_id ) {
$t_attachments = file_get_visible_attachments( $p_bug_id );
$t_attachments_count = count( $t_attachments );
echo "\n<ul>";
foreach ( $t_attachments as $t_attachment ) {
echo "\n<li>";
Expand Down
4 changes: 2 additions & 2 deletions core/relationship_api.php
Expand Up @@ -225,7 +225,7 @@ function relationship_delete( $p_relationship_id ) {
$c_relationship_id = (int)$p_relationship_id;

$query = "DELETE FROM {bug_relationship} WHERE id=%d";
$result = db_query( $query, array( $c_relationship_id ) );
db_query( $query, array( $c_relationship_id ) );
}

/**
Expand All @@ -238,7 +238,7 @@ function relationship_delete_all( $p_bug_id ) {
$query = "DELETE FROM {bug_relationship}
WHERE source_bug_id=%d OR
destination_bug_id=%d";
$result = db_query( $query, array( $c_bug_id, $c_bug_id ) );
db_query( $query, array( $c_bug_id, $c_bug_id ) );
}

/**
Expand Down
2 changes: 0 additions & 2 deletions core/version_api.php
Expand Up @@ -439,8 +439,6 @@ function version_get_all_rows( $p_project_id, $p_released = null, $p_obsolete =
}
}

$c_project_id = (int)$p_project_id;

$t_project_where = version_get_project_where_clause( $p_project_id, $p_inherit );

$query = "SELECT * FROM {project_version} WHERE $t_project_where";
Expand Down
1 change: 0 additions & 1 deletion manage/config_email_page.php
Expand Up @@ -200,7 +200,6 @@ function show_notify_threshold( $p_access, $p_action ) {
* @param string section name
*/
function get_section_begin_for_email( $p_section_name ) {
global $t_project;
$t_access_levels = MantisEnum::getValues( config_get( 'access_levels_enum_string' ) );
echo '<table class="width100">';
echo '<tr><td class="form-title-caps" colspan="' . ( count( $t_access_levels ) + 7 ) . '">' . $p_section_name . '</td></tr>' . "\n";
Expand Down
2 changes: 1 addition & 1 deletion manage/config_workflow_page.php
Expand Up @@ -81,7 +81,7 @@ function set_overrides( $p_config ) {
* @param int to status id
*/
function show_flag( $p_from_status_id, $p_to_status_id ) {
global $t_can_change_workflow, $t_overrides, $t_file_workflow, $t_global_workflow, $t_project_workflow;
global $t_can_change_workflow, $t_file_workflow, $t_global_workflow, $t_project_workflow;
if ( $p_from_status_id <> $p_to_status_id ) {
$t_file = isset( $t_file_workflow['exit'][$p_from_status_id][$p_to_status_id] ) ? 1 : 0 ;
$t_global = isset( $t_global_workflow['exit'][$p_from_status_id][$p_to_status_id] ) ? 1 : 0 ;
Expand Down

0 comments on commit ac184b1

Please sign in to comment.