5 print header . start_html("Error");
6 print "An error occurred. Dammit.\n";
7 print "Error was: $msg.\n";
15 print header . start_html("Sorry");
16 print "Sorry bug #$msg doesn't seem to be in the $archive database.\n";
25 my %status = getbugstatus($ref, $archive );
28 if ($status{severity} eq 'normal') {
30 } elsif (grep($status{severity} eq $_, @debbugs::gStrongSeverities)) {
31 $showseverity = "<strong>Severity: $status{severity}</strong>;\n";
33 $showseverity = "Severity: <em>$status{severity}</em>;\n";
36 $result .= "Package: <a href=\"" . pkgurl($status{"package"}) . "\"><strong>"
37 . htmlsanit($status{"package"}) . "</strong></a>;\n"
38 if (length($status{"package"}));
39 $result .= $showseverity;
40 $result .= "Reported by: " . htmlsanit($status{originator});
41 $result .= ";\nKeywords: " . htmlsanit($status{keywords})
42 if (length($status{keywords}));
44 my @merged= split(/ /,$status{mergedwith});
46 my $mseparator= ";\nmerged with ";
48 $result .= $mseparator."<A href=\"" . bugurl($m) . "\">#$m</A>";
53 if (length($status{done})) {
54 $result .= ";\n<strong>Done:</strong> " . htmlsanit($status{done});
55 } elsif (length($status{forwarded})) {
56 $result .= ";\n<strong>Forwarded</strong> to "
57 . htmlsanit($status{forwarded});
59 my $daysold = int((time - $status{date}) / 86400); # seconds to days
63 $font = "em" if ($daysold > 30);
64 $font = "strong" if ($daysold > 60);
65 $efont = "</$font>" if ($font);
66 $font = "<$font>" if ($font);
68 my $yearsold = int($daysold / 364);
69 $daysold = $daysold - $yearsold * 364;
71 $result .= ";\n $font";
72 $result .= "1 year and " if ($yearsold == 1);
73 $result .= "$yearsold years and " if ($yearsold > 1);
74 $result .= "1 day old" if ($daysold == 1);
75 $result .= "$daysold days old" if ($daysold != 1);
87 my $params = "pkg=$ref";
88 foreach my $val (@_) { 1 }
90 return $debbugs::gCGIDomain . "pkgreport.cgi" . "?" . "$params";
93 %saniarray= ('<','lt', '>','gt', '&','amp', '"','quot');
98 while ($in =~ m/[<>&"]/) {
99 $out.= $`. '&'. $saniarray{$&}. ';';
108 my $params = "bug=$ref";
109 foreach my $val (@_) {
110 $params .= "\&msg=$1" if ($val =~ /^msg=([0-9]+)/);
111 $params .= "\&archive=yes" if ($val =~ /^archive=1/);
114 return $debbugs::gCGIDomain . "bugreport.cgi" . "?" . "$params";
119 return $debbugs::gCGIDomain . "package.cgi" . "?" . "package=$ref";
125 opendir(D, "$debbugs::gSpoolDir/db") || &quit("opendir db: $!");
126 @bugs = sort { $a <=> $b }
128 (grep m/^[0-9]+\.status$/,
138 if ( $archive ) { open I, "<$debbugs::gSpoolDir/index.archive" || &quit("bugindex: $!"); }
139 else { open I, "<$debbugs::gSpoolDir/index.db" || &quit("bugindex: $!"); }
142 { if (/^$pkg\s+(\d+)\s+(.+)/)
144 my $tmpstr = sprintf( "%d: %s", $1, $2 );
145 $descstr{ $1 } = $tmpstr;
154 if ( $archive ) { open I, "<$debbugs::gSpoolDir/index.archive" || &quit("bugindex: $!"); }
155 else { open I, "<$debbugs::gSpoolDir/index.db" || &quit("bugindex: $!"); }
156 while(<I>) { $descstr{ $1 } = 1 if (/^(\S+)/); }
164 while ($input =~ m/\W/)
165 { $encoded.=$`.sprintf("-%02x_",unpack("C",$&));
169 $encoded =~ s/-2e_/\./g;
170 $encoded =~ s/^([^,]+)-20_-3c_(.*)-40_(.*)-3e_/$1,$2,$3,/;
171 $encoded =~ s/^(.*)-40_(.*)-20_-28_([^,]+)-29_$/,$1,$2,$3/;
172 $encoded =~ s/-20_/_/g;
173 $encoded =~ s/-([^_]+)_-/-$1/g;
179 open(MM,"$gMaintainerFile") || &quit("open $gMaintainerFile: $!");
181 m/^(\S+)\s+(\S.*\S)\s*$/ || &quit("$gMaintainerFile: \`$_'");
198 { my $archdir = $bugnum % 100;
199 open(S,"$gSpoolDir/archive/$archdir/$bugnum.status" ) || &abort("$bugnum", "archive" );
201 { open(S,"$gSpoolDir/db/$bugnum.status") || &abort("$bugnum"); }
202 my @lines = qw(originator date subject msgid package keywords done
203 forwarded mergedwith severity);
206 $status{shift @lines} = $_;
209 $status{shift @lines} = '' while(@lines);
211 $status{package} =~ s/\s*$//;
212 $status{package} = 'unknown' if ($status{package} eq '');
213 $status{severity} = 'normal' if ($status{severity} eq '');
215 $status{pending} = 'pending';
216 $status{pending} = 'forwarded' if (length($status{forwarded}));
217 $status{pending} = 'done' if (length($status{done}));
226 { my $archdir = $bugnum % 100;
227 return "$gSpoolDir/archive/$archdir/$bugnum.log";
228 } else { return "$gSpoolDir/db/$bugnum.log"; }