diff --git a/C4/Letters.pm b/C4/Letters.pm index ab16f729c5..25300bd5ec 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -602,6 +602,28 @@ sub GetPreparedLetter { return; my $want_librarian = $params{want_librarian}; + $letter->{content} = _process_tt( + { + content => $letter->{content}, + lang => $lang, + loops => $loops, + objects => $objects, + substitute => $substitute, + tables => $tables, + } + ); + + $letter->{title} = _process_tt( + { + content => $letter->{title}, + lang => $lang, + loops => $loops, + objects => $objects, + substitute => $substitute, + tables => $tables, + } + ); + if (%$substitute) { while ( my ($token, $val) = each %$substitute ) { $val //= q{}; @@ -672,28 +694,6 @@ sub GetPreparedLetter { } } - $letter->{content} = _process_tt( - { - content => $letter->{content}, - lang => $lang, - loops => $loops, - objects => $objects, - substitute => $substitute, - tables => $tables, - } - ); - - $letter->{title} = _process_tt( - { - content => $letter->{title}, - lang => $lang, - loops => $loops, - objects => $objects, - substitute => $substitute, - tables => $tables, - } - ); - $letter->{content} =~ s/<<\S*>>//go; #remove any stragglers return $letter; diff --git a/Koha.pm b/Koha.pm index 9fccf7c268..38e852024c 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "22.11.15.000"; +$VERSION = "22.11.16.000"; sub version { return $VERSION; diff --git a/acqui/check_uniqueness.pl b/acqui/check_uniqueness.pl index b665b34c3a..791814095f 100755 --- a/acqui/check_uniqueness.pl +++ b/acqui/check_uniqueness.pl @@ -37,6 +37,13 @@ use C4::Output qw( output_with_http_headers ); use C4::Items qw( SearchItems ); my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} + my @field = $input->multi_param('field[]'); my @value = $input->multi_param('value[]'); diff --git a/catalogue/image.pl b/catalogue/image.pl index 41eebc019c..efdcae4937 100755 --- a/catalogue/image.pl +++ b/catalogue/image.pl @@ -33,6 +33,13 @@ use Koha::CoverImages; $| = 1; my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} + my $imagenumber; =head1 NAME diff --git a/cataloguing/plugin_launcher.pl b/cataloguing/plugin_launcher.pl index 90105f326c..b31ca52c89 100755 --- a/cataloguing/plugin_launcher.pl +++ b/cataloguing/plugin_launcher.pl @@ -19,10 +19,18 @@ use Modern::Perl; use CGI qw ( -utf8 ); +use C4::Auth qw( check_cookie_auth ); use Koha::FrameworkPlugin; my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} + my $plugin= Koha::FrameworkPlugin->new( { name => scalar $input->param("plugin_name"), }); diff --git a/cataloguing/value_builder/barcode.pl b/cataloguing/value_builder/barcode.pl index b166b46c4d..5ec7dbece4 100755 --- a/cataloguing/value_builder/barcode.pl +++ b/cataloguing/value_builder/barcode.pl @@ -29,6 +29,16 @@ use Koha::DateUtils qw( dt_from_string ); use Algorithm::CheckDigits qw( CheckDigits ); +use CGI qw ( -utf8 ); +use C4::Auth qw( check_cookie_auth ); +my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} + my $builder = sub { my ( $params ) = @_; my $function_name = $params->{id}; diff --git a/cataloguing/value_builder/barcode_manual.pl b/cataloguing/value_builder/barcode_manual.pl index a7d015ba7a..67891789e3 100755 --- a/cataloguing/value_builder/barcode_manual.pl +++ b/cataloguing/value_builder/barcode_manual.pl @@ -27,6 +27,16 @@ use C4::Barcodes::ValueBuilder; use C4::Biblio qw( GetMarcFromKohaField ); use Koha::DateUtils qw( dt_from_string ); +use CGI qw ( -utf8 ); +use C4::Auth qw( check_cookie_auth ); +my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} + my $builder = sub { my ( $params ) = @_; my $function_name = $params->{id}; diff --git a/cataloguing/value_builder/dateaccessioned.pl b/cataloguing/value_builder/dateaccessioned.pl index 808fc80116..c4f7746b7f 100755 --- a/cataloguing/value_builder/dateaccessioned.pl +++ b/cataloguing/value_builder/dateaccessioned.pl @@ -21,6 +21,16 @@ # along with Koha; if not, see . use Modern::Perl; +use CGI qw ( -utf8 ); +use C4::Auth qw( check_cookie_auth ); +my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} + my $builder = sub { my ( $params ) = @_; my $function_name = $params->{id}; diff --git a/cataloguing/value_builder/marc21_field_005.pl b/cataloguing/value_builder/marc21_field_005.pl index 545a1a4f91..6428bd61a9 100755 --- a/cataloguing/value_builder/marc21_field_005.pl +++ b/cataloguing/value_builder/marc21_field_005.pl @@ -21,6 +21,16 @@ use Modern::Perl; +use CGI qw ( -utf8 ); +use C4::Auth qw( check_cookie_auth ); +my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} + my $builder = sub { my ( $params ) = @_; my $function_name = $params->{id}; diff --git a/cataloguing/value_builder/marc21_field_245h.pl b/cataloguing/value_builder/marc21_field_245h.pl index 667ae2249a..4fe4a2f1e7 100755 --- a/cataloguing/value_builder/marc21_field_245h.pl +++ b/cataloguing/value_builder/marc21_field_245h.pl @@ -20,7 +20,17 @@ # along with Koha; if not, see . use Modern::Perl; -use C4::Context; + +use CGI qw ( -utf8 ); +use C4::Auth qw( check_cookie_auth ); +my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} + my $builder = sub { my ( $params ) = @_; diff --git a/cataloguing/value_builder/marc21_field_260b.pl b/cataloguing/value_builder/marc21_field_260b.pl index 406feb4122..e9a74a07ba 100755 --- a/cataloguing/value_builder/marc21_field_260b.pl +++ b/cataloguing/value_builder/marc21_field_260b.pl @@ -27,6 +27,16 @@ biblioitems.publishercode use Modern::Perl; use C4::Context; +use CGI qw ( -utf8 ); +use C4::Auth qw( check_cookie_auth ); +my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} + my $builder = sub { my ( $params ) = @_; my $function_name = $params->{id}; diff --git a/cataloguing/value_builder/marc21_orgcode.pl b/cataloguing/value_builder/marc21_orgcode.pl index aa9142cfc7..0dd985803c 100755 --- a/cataloguing/value_builder/marc21_orgcode.pl +++ b/cataloguing/value_builder/marc21_orgcode.pl @@ -24,6 +24,15 @@ use Modern::Perl; use C4::Context; use Koha::Libraries; +use CGI qw ( -utf8 ); +use C4::Auth qw( check_cookie_auth ); +my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} my $builder = sub { my ( $params ) = @_; diff --git a/cataloguing/value_builder/stocknumber.pl b/cataloguing/value_builder/stocknumber.pl index 51d7a1986c..61885d12b0 100755 --- a/cataloguing/value_builder/stocknumber.pl +++ b/cataloguing/value_builder/stocknumber.pl @@ -21,6 +21,15 @@ use Modern::Perl; use C4::Context; +use CGI qw ( -utf8 ); +use C4::Auth qw( check_cookie_auth ); +my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} my $builder = sub { my ( $params ) = @_; diff --git a/cataloguing/value_builder/upload.pl b/cataloguing/value_builder/upload.pl index 82b9816f62..eeb422d525 100755 --- a/cataloguing/value_builder/upload.pl +++ b/cataloguing/value_builder/upload.pl @@ -30,6 +30,16 @@ use Modern::Perl; # the possibility to delete the uploaded file. If the field is empty, you # can upload a new file. +use CGI qw ( -utf8 ); +use C4::Auth qw( check_cookie_auth ); +my $input = CGI->new; +my ($auth_status) = + check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } ); +if ( $auth_status ne "ok" ) { + print $input->header( -type => 'text/plain', -status => '403 Forbidden' ); + exit 0; +} + my $builder = sub { my ( $params ) = @_; return <<"SCRIPT"; diff --git a/debian/templates/apache-shared-intranet.conf b/debian/templates/apache-shared-intranet.conf index dbeaf0dca5..bc78833b08 100644 --- a/debian/templates/apache-shared-intranet.conf +++ b/debian/templates/apache-shared-intranet.conf @@ -13,7 +13,7 @@ ScriptAlias /search "/usr/share/koha/intranet/cgi-bin/catalogue/search.pl" # Protect dev package install RewriteEngine on -RewriteRule ^/cgi-bin/koha/(C4|debian|etc|installer/data|install_misc|Koha|misc|selenium|t|test|tmp|xt)/|\.PL$ /notfound [PT] +RewriteRule ^/cgi-bin/koha/(C4|debian|docs|etc|installer/data|install_misc|Koha|misc|selenium|t|test|tmp|xt)/|\.PL$ /notfound [PT] RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/catalogue/detail.pl?biblionumber=$1 [PT] RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT] diff --git a/installer/data/mysql/db_revs/221115001.pl b/installer/data/mysql/db_revs/221115001.pl new file mode 100755 index 0000000000..5fd40ecb2d --- /dev/null +++ b/installer/data/mysql/db_revs/221115001.pl @@ -0,0 +1,27 @@ +use Modern::Perl; + +return { + bug_number => "36244", + description => "Template Toolkit syntax not escaped in letter templates", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + my $query = q{SELECT * FROM letter WHERE content LIKE "[|%%SET%<<%|%]" ESCAPE '|'}; + my $sth = $dbh->prepare($query); + $sth->execute(); + if ( $sth->rows ) { + say $out "You have one or more templates that have been affected by bug 36244."; + say $out "These templates assign template toolkit variables values"; + say $out "using the double arrows syntax. E.g. [% SET name = '<>' %]"; + say $out + "This will no longer function correctly as Template Toolkit is now rendered before the double arrow syntax."; + say $out "The following notices will need to be updated:"; + + while ( my $row = $sth->fetchrow_hashref() ) { + say $out + "ID: $row->{id} / MODULE: $row->{module} / CODE: $row->{code} / BRANCHCODE: $row->{branchcode} / NAME: $row->{name}"; + } + } + }, +}; diff --git a/installer/data/mysql/db_revs/221116000.pl b/installer/data/mysql/db_revs/221116000.pl new file mode 100755 index 0000000000..6896a11353 --- /dev/null +++ b/installer/data/mysql/db_revs/221116000.pl @@ -0,0 +1,7 @@ +use Modern::Perl; + +return { + bug_number => undef, + description => 'Koha 22.11.16 release', + up => sub { }, +} diff --git a/installer/externalmodules.pl b/installer/externalmodules.pl deleted file mode 100755 index f836ccf023..0000000000 --- a/installer/externalmodules.pl +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/perl - -# This Script can be used to provide a list of ALL external modules ***used*** (uncommented) in Koha. -# It provides you not only the list of modules BUT ALSO the files that uses those modules. -# utf8 or warnings or other lib use are not taken into account at the moment. - -use Modern::Perl; -use C4::Context; - -my $dir=C4::Context->config('intranetdir'); -qx(grep -r "^ *use" $dir | grep -v "C4\|strict\|vars" >/tmp/modulesKoha.log); -$dir=C4::Context->config('opacdir'); -qx(grep -r "^ *use" $dir | grep -v "C4\|strict\|vars" >>/tmp/modulesKoha.log); - -open my $fh, '<', '/tmp/modulesKoha.log' ||die "unable to open file /tmp/modulesKoha.log"; -my %modulehash; -while (my $line=<$fh>){ - if ( $line=~m#(.*)\:\s*use\s+([A-Z][^\s;]+)# ){ - my ($file,$module)=($1,$2); - my @filename = split /\//, $file; - push @{$modulehash{$module}},$filename[scalar(@filename) - 1]; - } -} -print "external modules used in Koha ARE :\n"; -map {print "* $_ \t in files ",join (",",@{$modulehash{$_}}),"\n" } sort keys %modulehash; -close $fh; -unlink "/tmp/modulesKoha.log"; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc index 3727737311..212313086a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc @@ -52,7 +52,7 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt index e87cb438c4..9ef3ebe7e0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt @@ -219,7 +219,9 @@