- $cgi_debug = $ENV{KOHA_CGI_DEBUG} || $query->param('debug') || 0;
- unless (0 <= $debug and $debug <= 9) {
+
+ # CGI->new conflicts w/ some upload functionality,
+ # since we would get the "first" CGI object here.
+ # Instead we have to parse for ourselves if we want QUERY_STRING triggers.
+ # my $query = CGI->new(); # conflicts!
+ # $cgi_debug = $ENV{KOHA_CGI_DEBUG} || $query->param('debug') || 0;
+
+ $cgi_debug = $ENV{KOHA_CGI_DEBUG} || 0;
+ unless ($cgi_debug or not $ENV{QUERY_STRING}) {
+ foreach (split /\&/, $ENV{QUERY_STRING}) {
+ /^debug\=(.+)$/ or next;
+ $cgi_debug = $1;
+ last;
+ }
+ }
+ unless ($debug =~ /^\d$/) {