diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi index 9dc300d450..9448b72798 100755 --- a/gitweb/gitweb.cgi +++ b/gitweb/gitweb.cgi @@ -81,14 +81,6 @@ if (defined $action) { } } -our $order = $cgi->param('o'); -if (defined $order) { - if ($order =~ m/[^0-9a-zA-Z_]/) { - undef $order; - die_error(undef, "Invalid order parameter."); - } -} - our $project = ($cgi->param('p') || $ENV{'PATH_INFO'}); if (defined $project) { $project =~ s|^/||; $project =~ s|/$||; @@ -1297,10 +1289,15 @@ sub git_logo { } sub git_project_list { + my $order = $cgi->param('o'); + if (defined $order && $order !~ m/project|descr|owner|age/) { + die_error(undef, "Invalid order parameter '$order'."); + } + my @list = git_read_projects(); my @projects; if (!@list) { - die_error(undef, "No project found."); + die_error(undef, "No projects found."); } foreach my $pr (@list) { my $head = git_read_head($pr->{'path'}); @@ -1322,6 +1319,7 @@ sub git_project_list { } push @projects, $pr; } + git_header_html(); if (-f $home_text) { print "
Project | \n"; } else { - print "" . $cgi->a({-class => "header", -href => "$my_uri?" . esc_param("o=project")}, "Project") . " | \n"; + print "" . + $cgi->a({-href => "$my_uri?" . esc_param("o=project"), + -class => "header"}, "Project") . + " | \n"; } - if (defined($order) && ($order eq "descr")) { + if ($order eq "descr") { @projects = sort {$a->{'descr'} cmp $b->{'descr'}} @projects; print "Description | \n"; } else { - print "" . $cgi->a({-class => "header", -href => "$my_uri?" . esc_param("o=descr")}, "Description") . " | \n"; + print "" . + $cgi->a({-href => "$my_uri?" . esc_param("o=descr"), + -class => "header"}, "Description") . + " | \n"; } - if (defined($order) && ($order eq "owner")) { + if ($order eq "owner") { @projects = sort {$a->{'owner'} cmp $b->{'owner'}} @projects; print "Owner | \n"; } else { - print "" . $cgi->a({-class => "header", -href => "$my_uri?" . esc_param("o=owner")}, "Owner") . " | \n"; + print "" . + $cgi->a({-href => "$my_uri?" . esc_param("o=owner"), + -class => "header"}, "Owner") . + " | \n"; } - if (defined($order) && ($order eq "age")) { + if ($order eq "age") { @projects = sort {$a->{'commit'}{'age'} <=> $b->{'commit'}{'age'}} @projects; print "Last Change | \n"; } else { - print "" . $cgi->a({-class => "header", -href => "$my_uri?" . esc_param("o=age")}, "Last Change") . " | \n"; + print "" . + $cgi->a({-href => "$my_uri?" . esc_param("o=age"), + -class => "header"}, "Last Change") . + " | \n"; } print "\n" . " |
---|---|---|---|---|---|---|---|---|---|---|---|---|
" . $cgi->a({-href => "$my_uri?" . esc_param("p=$pr->{'path'};a=summary"), -class => "list"}, esc_html($pr->{'path'})) . " | \n" . + print "" . $cgi->a({-href => "$my_uri?" . esc_param("p=$pr->{'path'};a=summary"), + -class => "list"}, esc_html($pr->{'path'})) . " | \n" . "" . esc_html($pr->{'descr'}) . " | \n" . "" . chop_str($pr->{'owner'}, 15) . " | \n"; - print "{'commit'}{'age'}) . "\">" . $pr->{'commit'}{'age_string'} . " | \n" . + print "{'commit'}{'age'}) . "\">" . + $pr->{'commit'}{'age_string'} . " | \n" . "" . - $cgi->a({-href => "$my_uri?" . esc_param("p=$pr->{'path'};a=summary")}, "summary") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$pr->{'path'};a=shortlog")}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$pr->{'path'};a=log")}, "log") . + $cgi->a({-href => "$my_uri?" . esc_param("p=$pr->{'path'};a=summary")}, "summary") . " | " . + $cgi->a({-href => "$my_uri?" . esc_param("p=$pr->{'path'};a=shortlog")}, "shortlog") . " | " . + $cgi->a({-href => "$my_uri?" . esc_param("p=$pr->{'path'};a=log")}, "log") . " | \n" . "