diff --git a/core_helper_API.php b/core_helper_API.php index 0a8d2416e4..a152492b18 100644 --- a/core_helper_API.php +++ b/core_helper_API.php @@ -336,10 +336,10 @@ function get_default_project( $p_user_id ) { # -------------------- # Get the string associated with the $p_enum value function get_enum_to_string( $p_enum_string, $p_num ) { - $t_arr = explode( ",", $p_enum_string ); + $t_arr = explode_enum_string( $p_enum_string ); $enum_count = count( $t_arr ); for ($i=0;$i<$enum_count;$i++) { - $t_s = explode( ":", $t_arr[$i] ); + $t_s = explode_enum_arr( $t_arr[$i] ); if ( $t_s[0] == $p_num ) { return $t_s[1]; } @@ -489,7 +489,7 @@ function file_type_check( $p_file_name ) { $t_extension = $t_ext_array[$last_position]; # check against disallowed files - $t_disallowed_arr = explode( ",", $g_disallowed_files ); + $t_disallowed_arr = explode_enum_string( $g_disallowed_files ); foreach ( $t_disallowed_arr as $t_val ) { if ( $t_val == $t_extension ) { return false; @@ -497,7 +497,7 @@ function file_type_check( $p_file_name ) { } # check against allowed files - $t_allowed_arr = explode( ",", $g_allowed_files ); + $t_allowed_arr = explode_enum_string( $g_allowed_files ); # if the allowed list is populated then the file must be in the list. if ( empty( $g_allowed_files ) ) { return true; diff --git a/core_html_API.php b/core_html_API.php index b54f27b296..bdd15745c9 100644 --- a/core_html_API.php +++ b/core_html_API.php @@ -517,10 +517,10 @@ function print_status_colors() { PRINT "

"; PRINT ""; PRINT ""; - $t_arr = explode( ",", $g_status_enum_string ); + $t_arr = explode_enum_string( $g_status_enum_string ); $enum_count = count( $t_arr ); for ($i=0;$i<$enum_count;$i++) { - $t_s = explode( ":", $t_arr[$i] ); + $t_s = explode_enum_arr( $t_arr[$i] ); $t_val = get_enum_element( "status", $t_s[0] ); $t_color = "#ffffff"; diff --git a/core_print_API.php b/core_print_API.php index e992afb875..2a4c85e36b 100644 --- a/core_print_API.php +++ b/core_print_API.php @@ -209,7 +209,7 @@ function print_field_option_list( $p_list, $p_item="" ) { global $g_mantis_bug_table; $t_category_string = get_enum_string( $g_mantis_bug_table, $p_list ); - $t_arr = explode( ",", $t_category_string ); + $t_arr = explode_enum_string( $t_category_string ); $entry_count = count( $t_arr ); for ($i=0;$i<$entry_count;$i++) { $t_s = str_replace( "'", "", $t_arr[$i] ); diff --git a/core_summary_API.php b/core_summary_API.php index 81617c9977..1e2773af06 100644 --- a/core_summary_API.php +++ b/core_summary_API.php @@ -15,7 +15,7 @@ function print_bug_enum_summary( $p_enum_string, $p_enum ) { global $g_mantis_bug_table, $g_primary_color1, $g_primary_color2, $g_project_cookie_val, $g_summary_pad; - $t_arr = explode( ",", $p_enum_string ); + $t_arr = explode_enum_string( $p_enum_string ); $enum_count = count( $t_arr ); #checking if it's a per project statistic or all projects @@ -23,7 +23,7 @@ function print_bug_enum_summary( $p_enum_string, $p_enum ) { else $specific_where = " project_id='$g_project_cookie_val'"; for ($i=0;$i<$enum_count;$i++) { - $t_s = explode( ":", $t_arr[$i] ); + $t_s = explode_enum_arr( $t_arr[$i] ); $query = "SELECT COUNT(*) FROM $g_mantis_bug_table diff --git a/summary_graph_functions.php b/summary_graph_functions.php index 8b5a8e7227..2099ee27d1 100644 --- a/summary_graph_functions.php +++ b/summary_graph_functions.php @@ -15,15 +15,15 @@ function create_bug_enum_summary( $p_enum_string, $p_enum ) { $enum_name = Null; $enum_name_count = Null; - $t_arr = explode( ",", $p_enum_string ); + $t_arr = explode_enum_string( $p_enum_string ); $enum_count = count( $t_arr ); for ($i=0;$i<$enum_count;$i++) { - $t_s = explode( ":", $t_arr[$i] ); + $t_s = explode_enum_arr( $t_arr[$i] ); $enum_name[] = get_enum_to_string( $p_enum_string, $t_s[0] ); if ($g_project_cookie_val=='0000000') $specific_where = ""; else $specific_where = " AND project_id='$g_project_cookie_val'"; - + $query = "SELECT COUNT(*) FROM $g_mantis_bug_table WHERE $p_enum='$t_s[0]' $specific_where"; @@ -37,7 +37,7 @@ function graph_bug_enum_summary( $p_title="" ){ global $enum_name, $enum_name_count; $graph = new Graph(300,380); - $graph->img->SetMargin(40,40,40,170); + $graph->img->SetMargin(40,40,40,170); $graph->img->SetAntiAliasing(); $graph->SetScale("textlin"); $graph->SetMarginColor("white"); @@ -96,7 +96,7 @@ function create_developer_summary() { $query = "SELECT COUNT(*) FROM $g_mantis_bug_table - WHERE handler_id='$v_id' AND + WHERE handler_id='$v_id' AND (status='$t_res_val' OR status='$t_clo_val' ) $specific_where"; $result2 = db_query( $query ); $resolved_buff = db_result( $result2, 0, 0 ); @@ -116,7 +116,7 @@ function graph_developer_summary( ){ global $developer_name, $total_bug_count, $open_bug_count, $resolved_bug_count, $s_by_developer; $graph = new Graph(300,380); - $graph->img->SetMargin(40,40,40,170); + $graph->img->SetMargin(40,40,40,170); $graph->img->SetAntiAliasing(); $graph->SetScale("textlin"); $graph->SetMarginColor("white"); @@ -157,7 +157,7 @@ function create_reporter_summary() { global $g_mantis_bug_table, $g_mantis_user_table, $g_project_cookie_val, $reporter_name, $reporter_count; - + $query = "SELECT id, username FROM $g_mantis_user_table @@ -168,7 +168,7 @@ function create_reporter_summary() { for ($i=0;$i<$user_count;$i++) { $row = db_fetch_array( $result ); extract( $row, EXTR_PREFIX_ALL, "v" ); - + if ($g_project_cookie_val=='0000000') $specific_where = ""; else $specific_where = " AND project_id='$g_project_cookie_val'"; $query = "SELECT COUNT(*) @@ -218,7 +218,7 @@ function create_category_summary() { global $g_mantis_bug_table, $g_mantis_user_table, $g_mantis_project_category_table, $g_project_cookie_val, $category_name, $category_bug_count; - + if ($g_project_cookie_val=='0000000') $specific_where = "1=1"; else $specific_where = " project_id='$g_project_cookie_val'"; $query = "SELECT DISTINCT category @@ -246,7 +246,7 @@ function graph_category_summary(){ global $category_name, $category_bug_count, $s_by_category; $graph = new Graph(300,380); - $graph->img->SetMargin(40,40,40,170); + $graph->img->SetMargin(40,40,40,170); $graph->img->SetAntiAliasing(); $graph->SetScale("textlin"); $graph->SetMarginColor("white"); @@ -292,15 +292,15 @@ function find_date_in_metrics($aDate){ function create_cumulative_bydate(){ global $metrics, $g_mantis_bug_table, $g_project_cookie_val; - $t_clo_val = CLOSED; + $t_clo_val = CLOSED; $t_res_val = RESOLVED; - + if ($g_project_cookie_val=='0000000') $specific_where = " 1=1 "; else $specific_where = " project_id='$g_project_cookie_val' "; - + ### Get all the submitted dates $query = "SELECT UNIX_TIMESTAMP(date_submitted) as date_submitted - FROM $g_mantis_bug_table WHERE $specific_where + FROM $g_mantis_bug_table WHERE $specific_where ORDER BY date_submitted"; $result = db_query( $query ); $bug_count = db_num_rows( $result ); @@ -316,7 +316,7 @@ function create_cumulative_bydate(){ $metrics[$index][1]++; } else { $metrics[] = array($t_date_string, 1, 0, 0); - } + } } $t_clo_val = CLOSED; @@ -324,7 +324,7 @@ function create_cumulative_bydate(){ ### Get all the resolved dates $query = "SELECT UNIX_TIMESTAMP(last_updated) as last_updated FROM $g_mantis_bug_table - WHERE $specific_where AND + WHERE $specific_where AND (status='$t_res_val' OR status='$t_clo_val') ORDER BY last_updated"; $result = db_query( $query ); @@ -348,9 +348,9 @@ function create_cumulative_bydate(){ $metrics_count = count($metrics); for ($i=1;$i<$metrics_count;$i++) { - $metrics[$i][1] = $metrics[$i][1] + $metrics[$i-1][1]; - $metrics[$i][2] = $metrics[$i][2] + $metrics[$i-1][2]; - $metrics[$i][3] = $metrics[$i][1] - $metrics[$i][2]; + $metrics[$i][1] = $metrics[$i][1] + $metrics[$i-1][1]; + $metrics[$i][2] = $metrics[$i][2] + $metrics[$i-1][2]; + $metrics[$i][3] = $metrics[$i][1] - $metrics[$i][2]; } } @@ -367,7 +367,7 @@ function graph_cumulative_bydate(){ } $graph = new Graph(300,380); - $graph->img->SetMargin(40,40,40,170); + $graph->img->SetMargin(40,40,40,170); $graph->img->SetAntiAliasing(); $graph->SetScale("linlin"); $graph->SetMarginColor("white");