Lines 38-44
use CGI::Cookie; # need to check cookies before having CGI parse the POST reques
Link Here
|
38 |
use C4::Auth qw(:DEFAULT check_cookie_auth); |
38 |
use C4::Auth qw(:DEFAULT check_cookie_auth); |
39 |
use C4::Context; |
39 |
use C4::Context; |
40 |
use C4::Debug; |
40 |
use C4::Debug; |
41 |
use C4::Output qw(:html :ajax pagination_bar); |
41 |
use C4::Output qw(:html :ajax ); |
42 |
use C4::Scrubber; |
42 |
use C4::Scrubber; |
43 |
use C4::Biblio; |
43 |
use C4::Biblio; |
44 |
use C4::Items qw(GetItemsInfo GetHiddenItemnumbers); |
44 |
use C4::Items qw(GetItemsInfo GetHiddenItemnumbers); |
Lines 87-110
sub ajax_auth_cgi { # returns CGI object
Link Here
|
87 |
my $is_ajax = is_ajax(); |
87 |
my $is_ajax = is_ajax(); |
88 |
my $openadds = C4::Context->preference('TagsModeration') ? 0 : 1; |
88 |
my $openadds = C4::Context->preference('TagsModeration') ? 0 : 1; |
89 |
my $query = ($is_ajax) ? &ajax_auth_cgi({}) : CGI->new(); |
89 |
my $query = ($is_ajax) ? &ajax_auth_cgi({}) : CGI->new(); |
90 |
unless (C4::Context->preference('TagsEnabled')) { |
90 |
foreach ($query->param) { |
91 |
push @errors, {+ tagsdisabled=>1 }; |
91 |
if (/^newtag(.*)/) { |
92 |
push @globalErrorIndexes, $#errors; |
92 |
my $biblionumber = $1; |
93 |
} else { |
93 |
unless ($biblionumber =~ /^\d+$/) { |
94 |
foreach ($query->param) { |
94 |
$debug and warn "$_ references non numerical biblionumber '$biblionumber'"; |
95 |
if (/^newtag(.*)/) { |
95 |
push @errors, {+'badparam' => $_ }; |
96 |
my $biblionumber = $1; |
96 |
push @globalErrorIndexes, $#errors; |
97 |
unless ($biblionumber =~ /^\d+$/) { |
97 |
next; |
98 |
$debug and warn "$_ references non numerical biblionumber '$biblionumber'"; |
98 |
} |
99 |
push @errors, {+'badparam' => $_ }; |
99 |
$newtags{$biblionumber} = $query->param($_); |
100 |
push @globalErrorIndexes, $#errors; |
100 |
} elsif (/^del(\d+)$/) { |
101 |
next; |
101 |
push @deltags, $1; |
102 |
} |
102 |
} |
103 |
$newtags{$biblionumber} = $query->param($_); |
|
|
104 |
} elsif (/^del(\d+)$/) { |
105 |
push @deltags, $1; |
106 |
} |
107 |
} |
108 |
} |
103 |
} |
109 |
|
104 |
|
110 |
my $add_op = (scalar(keys %newtags) + scalar(@deltags)) ? 1 : 0; |
105 |
my $add_op = (scalar(keys %newtags) + scalar(@deltags)) ? 1 : 0; |
Lines 122-127
if ($is_ajax) {
Link Here
|
122 |
}); |
117 |
}); |
123 |
} |
118 |
} |
124 |
|
119 |
|
|
|
120 |
unless ( C4::Context->preference('TagsEnabled') ) { |
121 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); |
122 |
exit; |
123 |
} |
124 |
|
125 |
if ($add_op) { |
125 |
if ($add_op) { |
126 |
unless ($loggedinuser) { |
126 |
unless ($loggedinuser) { |
127 |
push @errors, {+'login' => 1 }; |
127 |
push @errors, {+'login' => 1 }; |
128 |
- |
|
|