readconfig;
my $dbh = opendb;
-
-print header( -charset => 'utf-8', );
-
-my $bugid = param("id");
-if ( !$bugid ) {
+sub fourohfour()
+{
+ my $id = shift;
+ print header( -charset => 'utf-8', -status => '404 Not Found');
print start_html(
- -title => $c{TrackerName} . ": No Bug Number Given",
+ -title => $c{TrackerName} . ": 404 - Not found",
-style => { 'src' => $c{StyleSheet} }
);
- print h1("No Bug Number Given");
- print p( ["Ooops. Bug id paramter missing."] );
+ print h1("404 - Not Found");
+ print p([ "No Bugs Here...", "Cannot find bug at: " .code(htmlsanit(url(-absolute=>1)))]);
print end_html;
exit(0);
}
-my $bug = Emesinae::Bug->new( $dbh, ID => $bugid );
-if ( !$bug ) {
- print start_html(
- -title => $c{TrackerName} . ": #$bugid - Unknown Bug Number",
- -style => { 'src' => $c{StyleSheet} }
- );
+my $bugid = url(-relative=>1);
+fourohfour() unless $bugid =~ m/[0-9]+/;
- print h1("#$bugid - Unknown Bug Number");
- print p( ["Ooops. This bug doesn't seem to exist."] );
- print end_html;
- exit(0);
-}
+my $bug = Emesinae::Bug->new( $dbh, ID => $bugid );
+fourohfour() unless $bug;
+print header( -charset => 'utf-8', );
print start_html(
-title => $c{TrackerName} . ": #$bugid - " . htmlsanit( $bug->{title} ),
-style => { 'src' => $c{StyleSheet} }
sub buglink {
my $b = shift;
my $t = shift or $b->{title};
- my $url = cgipath( "bug.cgi?id=" . $b->{id} );
+ my $url = cgipath( "bug/" . $b->{id} );
return a( { href => $url }, $t );
}
my $t = shift;
my %attr = @_;
- my $url = cgipath( "message.cgi?id=" . $m->{id} );
+ my $url = cgipath( "message/" . $m->{id} );
$url .= "&part=" . $attr{part} if $attr{part};
$url .= "&raw=" . $attr{raw} if $attr{raw};
- how and where to record their actions.
- bug-dist list is sufficient perhaps?
- SEO
- - use path based paramters (e.g. /bugs/1 etc) which is nicer for search engines.
- make sure there is an index page of all bugs for them to start from
- Enable Perl taint mode?
# Insert into /etc/apache2/sites-available/bugs.xenproject.org
- ScriptAlias /test/ /srv/test/lib/emesinae/cgi-bin/
+ ScriptAliasMatch /test/bug/.* /srv/test/lib/emesinae/cgi-bin/bug.cgi
+ ScriptAlias /test/ /srv/test/lib/emesinae/cgi-bin/bugs.cgi
<Directory "/srv/test/lib/emesinae/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
allow from all
</Directory>
- ScriptAlias /xen-devel/ /srv/xen-devel-bugs/lib/emesinae/cgi-bin/
+ ScriptAliasMatch /xen/bug/.* /srv/xen-devel-bugs/lib/emesinae/cgi-bin/bug.cgi
+ ScriptAlias /xen/ /srv/xen-devel-bugs/lib/emesinae/cgi-bin/bugs.cgi
<Directory "/srv/xen-devel-bugs/lib/emesinae/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
$c{ArchiveIncoming} = 1;
# Path component of the CGI URL
-$c{CGIPath} = "/xen-devel/";
+$c{CGIPath} = "/xen/";
$c{LockDir} = "/srv/xen-devel-bugs/var/lock/";
sub bugurl ($) {
my $bn = shift;
- return "http://" . $c{TrackerHost} . $c{CGIPath} . "bug.cgi?id=$bn";
+ return "http://" . $c{TrackerHost} . $c{CGIPath} . "bug/$bn";
}
push @reply, ( "", "Modified/created Bugs:" ) if %bugs;