]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/CGI.pm
serve_cache is not exported by Debbugs::Libravatar
[debbugs.git] / Debbugs / CGI.pm
index e2780036b5262d44fdb56dbf716bcdac45b35b2d..d51b9be0a469c5503f4e3648964c36bb2bb31e27 100644 (file)
@@ -196,7 +196,7 @@ width and height are passed.
 
 sub version_url{
      my %params = validate_with(params => \@_,
-                               spec   => {package => {type => SCALAR,
+                               spec   => {package => {type => SCALAR|ARRAYREF,
                                                      },
                                           found   => {type => ARRAYREF,
                                                       default => [],
@@ -297,7 +297,7 @@ sub quitcgi {
 }
 
 
-=head HTML
+=head1 HTML
 
 =head2 htmlize_packagelinks
 
@@ -400,11 +400,15 @@ sub package_links {
      }
      my @links = ();
      for my $type (qw(src package)) {
-         push @links, map {(munge_url('pkgreport.cgi?',
+         push @links, map {my $t_type = $type;
+                           if ($_ =~ s/^src://) {
+                               $t_type = 'src';
+                           }
+                           (munge_url('pkgreport.cgi?',
                                       %options,
-                                      $type => $_,
+                                      $t_type => $_,
                                      ),
-                            $_);
+                            ($t_type eq 'src'?'src:':'').$_);
                       } make_list($param{$type}) if exists $param{$type};
      }
      for my $type (qw(maint owner submitter correspondent)) {
@@ -536,8 +540,8 @@ the split links with commas and spaces.
 sub maybelink {
     my ($links,$regex,$join) = @_;
     if (not defined $regex and not defined $join) {
-        $links =~ s{((?:ftp|http|https)://[\S~-]+?/?)([\)\'\:\.\,]?(?:\s|\.<|$))}
-                   {q(<a href=\").html_escape($1).q(\">).html_escape($1).q(</a>).$2}geimo;
+        $links =~ s{(.*?)((?:(?:ftp|http|https)://[\S~-]+?/?)?)([\)\'\:\.\,]?(?:\s|\.<|$))}
+                   {html_escape($1).(length $2?q(<a href=").html_escape($2).q(">).html_escape($2).q(</a>):'').html_escape($3)}geimo;
         return $links;
     }
     $join = ' ' if not defined $join;
@@ -867,7 +871,8 @@ sub option_form{
               if (defined $value and $o_value eq $value) {
                    $selected = ' selected';
               }
-              $output .= qq(<option value="$o_value"$selected>$name</option>\n);
+              $output .= q(<option value=").html_escape($o_value).qq("$selected>).
+                  html_escape($name).qq(</option>\n);
          }
          return $output;
      };
@@ -877,6 +882,8 @@ sub option_form{
      return Debbugs::Text::fill_in_template(template=>$param{template},
                                            (exists $param{language}?(language=>$param{language}):()),
                                            variables => $variables,
+                                           hole_var  => {'&html_escape' => \&html_escape,
+                                                        },
                                           );
 }