Skip to content

Commit

Permalink
changes to enum function usage. Ma de it more consistent
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@880 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed Apr 4, 2002
1 parent 44229a1 commit b777219
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions core_helper_API.php
Expand Up @@ -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];
}
Expand Down Expand Up @@ -489,15 +489,15 @@ 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;
}
}

# 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;
Expand Down
4 changes: 2 additions & 2 deletions core_html_API.php
Expand Up @@ -517,10 +517,10 @@ function print_status_colors() {
PRINT "<p>";
PRINT "<table class=\"width100\" cellspacing=\"1\">";
PRINT "<tr>";
$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";
Expand Down
2 changes: 1 addition & 1 deletion core_print_API.php
Expand Up @@ -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] );
Expand Down
4 changes: 2 additions & 2 deletions core_summary_API.php
Expand Up @@ -15,15 +15,15 @@ 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
if ($g_project_cookie_val=='0000000') $specific_where = " 1=1";
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
Expand Down
40 changes: 20 additions & 20 deletions summary_graph_functions.php
Expand Up @@ -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";
Expand All @@ -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");
Expand Down Expand Up @@ -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 );
Expand All @@ -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");
Expand Down Expand Up @@ -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
Expand All @@ -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(*)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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 );
Expand All @@ -316,15 +316,15 @@ function create_cumulative_bydate(){
$metrics[$index][1]++;
} else {
$metrics[] = array($t_date_string, 1, 0, 0);
}
}
}

$t_clo_val = CLOSED;
$t_res_val = RESOLVED;
### 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 );
Expand All @@ -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];
}

}
Expand All @@ -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");
Expand Down

0 comments on commit b777219

Please sign in to comment.