Bug 30077: (follow-up) retain branch selection
[koha-ffzg.git] / C4 / Output.pm
index d57a80d..42c4011 100644 (file)
@@ -27,33 +27,27 @@ package C4::Output;
 
 use Modern::Perl;
 
-use URI::Escape;
+use HTML::Entities;
 use Scalar::Util qw( looks_like_number );
+use URI::Escape;
 
-use C4::Auth qw(get_template_and_user);
+use C4::Auth qw( get_template_and_user );
 use C4::Context;
 use C4::Templates;
 
-use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+our (@ISA, @EXPORT_OK);
 
 BEGIN {
     require Exporter;
 
- @ISA    = qw(Exporter);
-    @EXPORT_OK = qw(&is_ajax ajax_fail); # More stuff should go here instead
-    %EXPORT_TAGS = ( all =>[qw(setlanguagecookie pagination_bar parametrized_url
-                                &output_with_http_headers &output_ajax_with_http_headers &output_html_with_http_headers)],
-                    ajax =>[qw(&output_with_http_headers &output_ajax_with_http_headers is_ajax)],
-                    html =>[qw(&output_with_http_headers &output_html_with_http_headers)]
-                );
-    push @EXPORT, qw(
+    @ISA    = qw(Exporter);
+    @EXPORT_OK = qw(
+        is_ajax
+        ajax_fail
         setlanguagecookie getlanguagecookie pagination_bar parametrized_url
+        output_html_with_http_headers output_ajax_with_http_headers output_with_http_headers
+        output_and_exit_if_error output_and_exit output_error
     );
-    push @EXPORT, qw(
-        &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers
-        &output_and_exit_if_error &output_and_exit &output_error
-    );
-
 }
 
 =head1 NAME
@@ -90,6 +84,8 @@ sub pagination_bar {
     my $startfrom_name = (@_) ? shift : 'page';
     my $additional_parameters = shift || {};
 
+    $base_url = HTML::Entities::encode($base_url);
+
     $current_page = looks_like_number($current_page) ? $current_page : undef;
     $nb_pages     = looks_like_number($nb_pages)     ? $nb_pages     : undef;
 
@@ -106,7 +102,7 @@ sub pagination_bar {
        $base_url =~ s/$delim$//;               # remove trailing delim
 
     my $url = $base_url . (($base_url =~ m/$delim/ or $base_url =~ m/\?/) ? '&' : '?' ) . $startfrom_name . '=';
-    my $url_suffix;
+    my $url_suffix = '';
     while ( my ( $k, $v ) = each %$additional_parameters ) {
         $url_suffix .= '&' . URI::Escape::uri_escape_utf8($k) . '=' . URI::Escape::uri_escape_utf8($v);
     }