]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
security check for legal products in place. bug charts are not
authorharrison%netscape.com <>
Tue, 27 Oct 1998 18:43:01 +0000 (18:43 +0000)
committerharrison%netscape.com <>
Tue, 27 Oct 1998 18:43:01 +0000 (18:43 +0000)
available as an option if collectstats.pl has never been run.
added quip support.

reports.cgi

index 707de6ac0995343e9ccef4264ec5181a16c92a2d..1ac1883b37e9bce4b76eb92cb0995f1d42798d62 100755 (executable)
@@ -64,10 +64,7 @@ else
        }
 
 ConnectToDatabase();
-
-# $::FORM{'product'} = "Mozilla";
-# &show_chart(); 
-# exit;
+GetVersionTable();
 
 if (! defined $::FORM{'product'})
        {
@@ -112,9 +109,8 @@ FIN
 
 sub choose_product
        {
-       GetVersionTable();
-       
        my $product_popup = make_options (\@::legal_product, $::legal_product[0]);
+       my $charts = (-d $dir) ? "<option value=\"show_chart\">Bug Charts" : "";
 
        print <<FIN;
 <center>
@@ -134,13 +130,14 @@ $product_popup
 <td align=center>
 <select name="output">
 <option value="most_doomed">Bug Counts
-<option value="show_chart">Bug Charts
+$charts
 </select>
 <tr>
 <td align=center><b>Switches:</b></td>
 <td align=left>
 <input type=checkbox name=links value=1>&nbsp;Links to Bugs<br>
 <input type=checkbox name=nobanner value=1>&nbsp;No Banner<br>
+<input type=checkbox name=quip value=1>&nbsp;Include Quip<br>
 </td>
 </tr>
 <tr>
@@ -196,6 +193,7 @@ FIN
        
        my $c = 0;
 
+       my $quip = "Summary";
        my $bugs_count = 0;
        my $bugs_new_this_week = 0;
        my $bugs_reopened = 0;
@@ -224,12 +222,26 @@ FIN
                $bugs_totals{$who}{$st} ++;
                }
 
+       if ($::FORM{'quip'})
+               {
+               if (open (COMMENTS, "<data/comments")) 
+                       {
+       my @cdata;
+                       while (<COMMENTS>) 
+                               {
+                               push @cdata, $_;
+                               }
+                       close COMMENTS;
+                       $quip = "<i>" . $cdata[int(rand($#cdata + 1))] . "</i>";
+                       }
+               } 
+
        #########################
        # start painting report #
        #########################
 
        print <<FIN;
-<h1>Summary</h1>
+<h1>$quip</h1>
 <table border=1 cellpadding=5>
 <tr>
 <td align=right><b>New Bugs This Week</b></td>
@@ -363,6 +375,12 @@ FIN
 FIN
        }
 
+sub is_legal_product
+       {
+       my $product = shift;
+       return grep { $_ eq $product} @::legal_product;
+       }
+
 sub header
        {
        print <<FIN;
@@ -377,6 +395,11 @@ sub show_chart
        {
   my $when = localtime (time);
 
+       if (! is_legal_product ($::FORM{'product'}))
+               {
+               &die_politely ("Unknown product: $::FORM{'product'}");
+               }
+
   print <<FIN;
 <center>
 FIN
@@ -428,7 +451,6 @@ FIN
                "title" => "Bug Charts for $::FORM{'product'}",
                "x_label" => "Dates",
                "y_label" => "Bug Count",
-               "grey_background" => 1,
                "legend_labels" => \@labels,
                );