Permalink
Browse files

Merge pull request #153 from grangeway/grangeway-variable-naming

Code Guidelines: Fix naming of variable '$result' to $t_result #119
  • Loading branch information...
2 parents ef5b4e5 + 9ef51aa commit e842fdd25fd6c51c511596571f26c6566f83fa29 @grangeway grangeway committed Mar 29, 2014
Showing with 414 additions and 504 deletions.
  1. +2 −2 adm_config_report.php
  2. +4 −4 admin/copy_field.php
  3. +10 −10 admin/install.php
  4. +2 −2 admin/test_email.php
  5. +4 −4 admin/test_langs.php
  6. +3 −3 admin/upgrade_unattended.php
  7. +3 −3 api/soap/mc_api.php
  8. +4 −4 api/soap/mc_file_api.php
  9. +3 −3 api/soap/mc_issue_api.php
  10. +7 −6 api/soap/mc_project_api.php
  11. +0 −2 bug_actiongroup_update_severity_inc.php
  12. +2 −2 bug_reminder.php
  13. +3 −3 core/authentication_api.php
  14. +26 −28 core/bug_api.php
  15. +0 −2 core/bug_group_action_api.php
  16. +5 −5 core/bugnote_api.php
  17. +2 −2 core/category_api.php
  18. +1 −4 core/collapse_api.php
  19. +1 −1 core/columns_api.php
  20. +9 −12 core/config_api.php
  21. +10 −10 core/custom_field_api.php
  22. +5 −14 core/database_api.php
  23. +3 −3 core/email_api.php
  24. +4 −4 core/email_queue_api.php
  25. +3 −5 core/error_api.php
  26. +15 −19 core/file_api.php
  27. +30 −35 core/filter_api.php
  28. +2 −3 core/helper_api.php
  29. +3 −4 core/history_api.php
  30. +2 −8 core/html_api.php
  31. +2 −2 core/install_helper_functions_api.php
  32. +9 −9 core/news_api.php
  33. +9 −16 core/print_api.php
  34. +5 −5 core/profile_api.php
  35. +24 −25 core/project_api.php
  36. +2 −2 core/project_hierarchy_api.php
  37. +15 −21 core/relationship_api.php
  38. +0 −3 core/session_api.php
  39. +3 −3 core/sponsorship_api.php
  40. +1 −1 core/string_api.php
  41. +29 −50 core/summary_api.php
  42. +21 −23 core/tag_api.php
  43. +30 −36 core/user_api.php
  44. +2 −2 core/user_pref_api.php
  45. +0 −1 core/utility_api.php
  46. +8 −8 core/version_api.php
  47. +5 −5 excel_xml_export.php
  48. +2 −2 file_download.php
  49. +0 −1 library/disposable
  50. +0 −1 library/securimage
  51. +4 −4 lost_pwd.php
  52. +0 −1 manage_config_email_page.php
  53. +1 −1 manage_user_proj_delete.php
  54. +4 −4 manage_user_prune.php
  55. +3 −3 manage_user_update.php
  56. +28 −27 plugins/MantisGraph/core/graph_api.php
  57. +3 −3 plugins/XmlImportExport/XmlImportExport.php
  58. +8 −10 print_all_bug_options_inc.php
  59. +2 −2 print_all_bug_options_reset.php
  60. +2 −2 print_all_bug_options_update.php
  61. +4 −4 print_all_bug_page.php
  62. +3 −3 print_all_bug_page_word.php
  63. +6 −6 print_bugnote_inc.php
  64. +2 −2 proj_doc_delete.php
  65. +2 −2 proj_doc_edit_page.php
  66. +2 −2 proj_doc_page.php
  67. +3 −3 proj_doc_update.php
  68. +2 −2 summary_page.php
View
@@ -266,7 +266,7 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
FROM $t_config_table
$t_where
ORDER BY user_id, project_id, config_id ";
-$result = db_query_bound( $query, $t_param );
+$t_result = db_query_bound( $query, $t_param );
?>
<!-- FILTER FORM -->
@@ -359,7 +359,7 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
# db contains a large number of configurations
$t_form_security_token = form_security_token( 'adm_config_delete' );
-while( $row = db_fetch_array( $result ) ) {
+while( $row = db_fetch_array( $t_result ) ) {
extract( $row, EXTR_PREFIX_ALL, 'v' );
?>
View
@@ -68,13 +68,13 @@
$t_bug_table = db_get_table( 'bug' );
$query = 'SELECT * FROM ' . $t_string_table . ' WHERE field_id = ' . db_param() . ' and value <> ' . db_param();
-$result = @db_query_bound( $query, array( $f_source_field_id, '' ) );
-if( FALSE == $result ) {
+$t_result = @db_query_bound( $query, array( $f_source_field_id, '' ) );
+if( FALSE == $t_result ) {
echo '<p>No fields need to be updated.</p>';
}
else {
- $count = db_num_rows( $result );
+ $count = db_num_rows( $t_result );
echo '<p>Found ' . $count . ' fields to be updated.</p>';
$t_failures = 0;
@@ -86,7 +86,7 @@
}
for( $i = 0;$i < $count;$i++ ) {
- $row = db_fetch_array( $result );
+ $row = db_fetch_array( $t_result );
extract( $row, EXTR_PREFIX_ALL, 'v' );
# trace bug id back to project
View
@@ -370,8 +370,8 @@ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_mes
$f_db_exists = true;
}
if( $f_db_type == 'db2' ) {
- $result = $g_db->execute( 'set schema ' . $f_db_schema );
- if( $result === false ) {
+ $t_result = $g_db->execute( 'set schema ' . $f_db_schema );
+ if( $t_result === false ) {
print_test_result( BAD, true, 'set schema failed: ' . $g_db->errorMsg() );
}
} else {
@@ -400,8 +400,8 @@ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_mes
if( $t_result == true ) {
$t_db_open = true;
if( $f_db_type == 'db2' ) {
- $result = $g_db->execute( 'set schema ' . $f_db_schema );
- if( $result === false ) {
+ $t_result = $g_db->execute( 'set schema ' . $f_db_schema );
+ if( $t_result === false ) {
print_test_result( BAD, true, 'set schema failed: ' . $g_db->errorMsg() );
}
} else {
@@ -782,8 +782,8 @@ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_mes
$t_result = @$g_db->Connect( $f_hostname, $f_db_username, $f_db_password, $f_database_name );
if( $f_db_type == 'db2' ) {
- $result = $g_db->execute( 'set schema ' . $f_db_schema );
- if( $result === false ) {
+ $t_result = $g_db->execute( 'set schema ' . $f_db_schema );
+ if( $t_result === false ) {
echo $g_db->errorMsg();
}
}
@@ -832,8 +832,8 @@ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_mes
}
if( $f_db_type == 'db2' ) {
- $result = $g_db->execute( 'set schema ' . $f_db_schema );
- if( $result === false ) {
+ $t_result = $g_db->execute( 'set schema ' . $f_db_schema );
+ if( $t_result === false ) {
echo $g_db->errorMsg();
}
}
@@ -1181,8 +1181,8 @@ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_mes
}
if( $f_db_type == 'db2' ) {
- $result = $g_db->execute( 'set schema ' . $f_db_schema );
- if( $result === false ) {
+ $t_result = $g_db->execute( 'set schema ' . $f_db_schema );
+ if( $t_result === false ) {
echo $g_db->errorMsg();
}
}
View
@@ -53,9 +53,9 @@
$t_email_data->body = 'Your PHP mail settings appear to be correctly set.';
$t_email_data->metadata['priority'] = config_get( 'mail_priority' );
$t_email_data->metadata['charset'] = 'utf-8';
- $result = email_send( $t_email_data );
+ $t_result = email_send( $t_email_data );
- if( !$result ) {
+ if( !$t_result ) {
echo ' PROBLEMS SENDING MAIL TO: ' . config_get_global( 'webmaster_email' ) . '. Please check your php/mail server settings.<br />';
} else {
echo ' mail() send successful.<br />';
View
@@ -156,10 +156,10 @@ function checkfile( $p_path, $p_file, $p_quiet = false ) {
$file = $p_path . $p_file;
set_error_handler( 'lang_error_handler' );
- $result = checktoken( $file, ($p_file == STRINGS_ENGLISH ) );
+ $t_result = checktoken( $file, ($p_file == STRINGS_ENGLISH ) );
restore_error_handler();
- if( !$result ) {
+ if( !$t_result ) {
print_error( "Language file '$p_file' failed at phase 1.", 'FAILED' );
if( $p_quiet ) {
return false;
@@ -175,12 +175,12 @@ function checkfile( $p_path, $p_file, $p_quiet = false ) {
set_error_handler( 'lang_error_handler' );
ob_start();
- $result = eval( "require_once( '$file' );" );
+ $t_result = eval( "require_once( '$file' );" );
$data = ob_get_contents();
ob_end_clean();
restore_error_handler();
- if( $result === false ) {
+ if( $t_result === false ) {
print_error( "Language file '$p_file' failed at eval", 'FAILED' );
if( $p_quiet ) {
return false;
@@ -51,7 +51,7 @@
/**
* Print the result of an upgrade step.
*
- * @param integer $result GOOD or BAD.
+ * @param integer $p_result GOOD or BAD.
* @param bool $p_hard_fail If result is BAD, sets the global failure flag.
* @param string $p_message The message describing the upgrade step.
* @access private
@@ -76,11 +76,11 @@ function print_test_result( $p_result, $p_hard_fail = true, $p_message = '' ) {
echo "\n";
}
-$result = @db_connect( config_get_global( 'dsn', false ), config_get_global( 'hostname' ),
+$t_result = @db_connect( config_get_global( 'dsn', false ), config_get_global( 'hostname' ),
config_get_global( 'db_username' ), config_get_global( 'db_password' ),
config_get_global( 'database_name' ) );
-if( false == $result ) {
+if( false == $t_result ) {
echo "Opening connection to database " .
config_get_global( 'database_name' ) .
" on host " . config_get_global( 'hostname' ) .
View
@@ -411,11 +411,11 @@ function mci_filter_db_get_available_queries( $p_project_id = null, $p_user_id =
AND (is_public = " . db_prepare_bool(true) . "
OR user_id = " . db_param() . ")
ORDER BY is_public DESC, name ASC";
- $result = db_query_bound( $query, array( $t_project_id, $t_user_id ) );
- $query_count = db_num_rows( $result );
+ $t_result = db_query_bound( $query, array( $t_project_id, $t_user_id ) );
+ $query_count = db_num_rows( $t_result );
for( $i = 0;$i < $query_count;$i++ ) {
- $row = db_fetch_array( $result );
+ $row = db_fetch_array( $t_result );
$t_filter_detail = explode( '#', $row['filter_string'], 2 );
if ( !isset($t_filter_detail[1]) ) {
View
@@ -131,7 +131,7 @@ function mci_file_add( $p_id, $p_name, $p_content, $p_file_type, $p_table, $p_ti
if( 'bug' == $p_table ) {
# bump the last_updated date
- $result = bug_update_date( $t_issue_id );
+ bug_update_date( $t_issue_id );
# add history entry
history_log_event_special( $t_issue_id, FILE_ADDED, $p_name );
@@ -166,13 +166,13 @@ function mci_file_get( $p_file_id, $p_type, $p_user_id ) {
return SoapObjectsFactory::newSoapFault( 'Server', 'Invalid file type '.$p_type. ' .' );
}
- $result = db_query_bound( $t_query, array( $p_file_id ) );
+ $t_result = db_query_bound( $t_query, array( $p_file_id ) );
- if ( $result->EOF ) {
+ if ( $t_result->EOF ) {
return SoapObjectsFactory::newSoapFault( 'Client', 'Unable to find an attachment with type ' . $p_type. ' and id ' . $p_file_id . ' .' );
}
- $row = db_fetch_array( $result );
+ $row = db_fetch_array( $t_result );
if ( $p_type == 'doc' ) {
$t_project_id = $row['project_id'];
@@ -556,12 +556,12 @@ function mc_issue_get_id_from_summary( $p_username, $p_password, $p_summary ) {
FROM $t_bug_table
WHERE summary = " . db_param();
- $result = db_query_bound( $query, array( $p_summary ), 1 );
+ $t_result = db_query_bound( $query, array( $p_summary ), 1 );
- if( db_num_rows( $result ) == 0 ) {
+ if( db_num_rows( $t_result ) == 0 ) {
return 0;
} else {
- while(( $row = db_fetch_array( $result ) ) !== false ) {
+ while(( $row = db_fetch_array( $t_result ) ) !== false ) {
$t_issue_id = (int) $row['id'];
$t_project_id = bug_get_field( $t_issue_id, 'project_id' );
$g_project_override = $t_project_id;
@@ -722,12 +722,13 @@ function mc_project_get_attachments( $p_username, $p_password, $p_project_id ) {
( ( pult.user_id = " . db_param() . " ) AND ( pult.access_level $t_access_clause ) ) OR
( ut.access_level = " . db_param() . " ) )
ORDER BY pt.name ASC, pft.title ASC";
- $result = db_query_bound( $query, array( $t_user_id, $t_user_id, $t_pub, $t_user_id, $t_admin ) );
- $num_files = db_num_rows( $result );
- $t_result = array();
+ $t_result = db_query_bound( $query, array( $t_user_id, $t_user_id, $t_pub, $t_user_id, $t_admin ) );
+ $num_files = db_num_rows( $t_result );
+
+ $t_attachments = array();
for( $i = 0;$i < $num_files;$i++ ) {
- $row = db_fetch_array( $result );
+ $row = db_fetch_array( $t_result );
$t_attachment = array();
$t_attachment['id'] = $row['id'];
@@ -739,10 +740,10 @@ function mc_project_get_attachments( $p_username, $p_password, $p_project_id ) {
$t_attachment['date_submitted'] = SoapObjectsFactory::newDateTimeVar( $row['date_added'] );
$t_attachment['download_url'] = mci_get_mantis_path() . 'file_download.php?file_id=' . $row['id'] . '&amp;type=doc';
$t_attachment['user_id'] = $row['user_id'];
- $t_result[] = $t_attachment;
+ $t_attachments[] = $t_attachment;
}
- return $t_result;
+ return $t_attachments;
}
function mc_project_get_all_subprojects( $p_username, $p_password, $p_project_id ) {
@@ -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;
View
@@ -91,14 +91,14 @@
}
}
-$result = email_bug_reminder( $f_to, $f_bug_id, $f_body );
+$t_result = email_bug_reminder( $f_to, $f_bug_id, $f_body );
# Add reminder as bugnote if store reminders option is ON.
if ( ON == config_get( 'store_reminders' ) ) {
# Build list of recipients, truncated to note_attr fields's length
$t_attr = '|';
$t_length = 0;
- foreach( $result as $t_id ) {
+ foreach( $t_result as $t_id ) {
$t_recipient = $t_id . '|';
$t_length += strlen( $t_recipient );
if( $t_length > 250 ) {
@@ -777,11 +777,11 @@ function auth_is_cookie_valid( $p_cookie_string ) {
$query = "SELECT *
FROM $t_user_table
WHERE cookie_string=" . db_param();
- $result = db_query_bound( $query, array( $p_cookie_string ) );
+ $t_result = db_query_bound( $query, array( $p_cookie_string ) );
# return true if a matching cookie was found
- if( 1 == db_num_rows( $result ) ) {
- user_cache_database_result( db_fetch_array( $result ) );
+ if( 1 == db_num_rows( $t_result ) ) {
+ user_cache_database_result( db_fetch_array( $t_result ) );
return true;
} else {
return false;
Oops, something went wrong.

0 comments on commit e842fdd

Please sign in to comment.