View | Details | Raw Unified | Return to bug 27337
Collapse All | Expand All

(-)a/admin/import_export_framework.pl (-15 / +6 lines)
Lines 20-46 Link Here
20
20
21
use Modern::Perl;
21
use Modern::Perl;
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
use CGI::Cookie;
24
use C4::Context;
23
use C4::Context;
25
use C4::Auth qw/check_cookie_auth/;
24
use C4::Auth qw/check_cookie_auth/;
26
use C4::ImportExportFramework;
25
use C4::ImportExportFramework;
27
26
28
my %cookies = CGI::Cookie->fetch();
29
my $authenticated = 0;
30
my ($auth_status, $sessionID);
31
if (exists $cookies{'CGISESSID'}) {
32
    ($auth_status, $sessionID) = check_cookie_auth(
33
        $cookies{'CGISESSID'}->value,
34
        { parameters => 'manage_marc_frameworks' },
35
    );
36
}
37
if ($auth_status eq 'ok') {
38
    $authenticated = 1;
39
}
40
41
my $input = CGI->new;
27
my $input = CGI->new;
42
28
43
unless ($authenticated) {
29
30
my ( $auth_status, $sessionID ) =
31
  check_cookie_auth( $input->cookie('CGISESSID'),
32
        { parameters => 'manage_marc_frameworks' } );
33
34
unless ($auth_status eq 'ok') {
44
    print $input->header(-type => 'text/plain', -status => '403 Forbidden');
35
    print $input->header(-type => 'text/plain', -status => '403 Forbidden');
45
    exit 0;
36
    exit 0;
46
}
37
}
(-)a/authorities/merge_ajax.pl (-7 / +9 lines)
Lines 3-24 Link Here
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use CGI qw ( -utf8 );
5
use CGI qw ( -utf8 );
6
use CGI::Cookie; # need to check cookies before CGI parses the POST request
7
use JSON;
6
use JSON;
8
7
9
use C4::Context;
8
use C4::Context;
10
use C4::Auth qw/check_cookie_auth/;
9
use C4::Auth qw/check_cookie_auth/;
11
use C4::AuthoritiesMarc;
10
use C4::AuthoritiesMarc;
12
11
13
my %cookies = CGI::Cookie->fetch;
12
my $input = CGI->new;
14
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { editcatalogue => 'edit_catalogue' });
13
15
my $reply = CGI->new;
14
my ( $auth_status, $sessionID ) =
15
  check_cookie_auth( $input->cookie('CGISESSID'),
16
    { editcatalogue => 'edit_catalogue' } );
17
16
if ($auth_status ne "ok") {
18
if ($auth_status ne "ok") {
17
    print $reply->header(-type => 'text/html');
19
    print $input->header(-type => 'text/html');
18
    exit 0;
20
    exit 0;
19
}
21
}
20
22
21
my $framework = $reply->param('frameworkcode');
23
my $framework = $input->param('frameworkcode');
22
my $tagslib = GetTagsLabels(1, $framework);
24
my $tagslib = GetTagsLabels(1, $framework);
23
print $reply->header(-type => 'text/html');
25
print $input->header(-type => 'text/html');
24
print encode_json $tagslib;
26
print encode_json $tagslib;
(-)a/cataloguing/merge_ajax.pl (-8 / +8 lines)
Lines 10-26 use C4::Context; Link Here
10
use C4::Biblio;
10
use C4::Biblio;
11
use C4::Auth qw/check_cookie_auth/;
11
use C4::Auth qw/check_cookie_auth/;
12
12
13
my %cookies = CGI::Cookie->fetch;
13
my $input = CGI->new;
14
my ( $auth_status, $sessionID ) = check_cookie_auth(
14
my ( $auth_status, $sessionID ) =
15
    $cookies{'CGISESSID'}->value, { editcatalogue => 'edit_catalogue' },
15
  check_cookie_auth( $input->cookie('CGISESSID'),
16
);
16
    { editcatalogue => 'edit_catalogue' } );
17
my $reply = CGI->new;
17
18
if ($auth_status ne "ok") {
18
if ($auth_status ne "ok") {
19
    print $reply->header(-type => 'text/html');
19
    print $input->header(-type => 'text/html');
20
    exit 0;
20
    exit 0;
21
} 
21
} 
22
22
23
my $framework = $reply->param('frameworkcode');
23
my $framework = $input->param('frameworkcode');
24
my $tagslib = GetMarcStructure(1, $framework);
24
my $tagslib = GetMarcStructure(1, $framework);
25
print $reply->header(-type => 'text/html');
25
print $input->header(-type => 'text/html');
26
print encode_json $tagslib;
26
print encode_json $tagslib;
(-)a/offline_circ/enqueue_koc.pl (-2 lines)
Lines 54-61 my ($template, $loggedinuser, $cookie) = get_template_and_user({ Link Here
54
54
55
55
56
my $fileID=$query->param('uploadedfileid');
56
my $fileID=$query->param('uploadedfileid');
57
my %cookies = parse CGI::Cookie($cookie);
58
my $sessionID = $cookies{'CGISESSID'}->value;
59
## 'Local' globals.
57
## 'Local' globals.
60
our $dbh = C4::Context->dbh();
58
our $dbh = C4::Context->dbh();
61
59
(-)a/offline_circ/process_koc.pl (-2 / +1 lines)
Lines 59-66 my ($template, $loggedinuser, $cookie) = get_template_and_user({ Link Here
59
my $fileID=$query->param('uploadedfileid');
59
my $fileID=$query->param('uploadedfileid');
60
my $runinbackground = $query->param('runinbackground');
60
my $runinbackground = $query->param('runinbackground');
61
my $completedJobID = $query->param('completedJobID');
61
my $completedJobID = $query->param('completedJobID');
62
my %cookies = parse CGI::Cookie($cookie);
62
my $sessionID = $query->cookie('CGISESSID');
63
my $sessionID = $cookies{'CGISESSID'}->value;
64
## 'Local' globals.
63
## 'Local' globals.
65
our $dbh = C4::Context->dbh();
64
our $dbh = C4::Context->dbh();
66
our @output = (); ## For storing messages to be displayed to the user
65
our @output = (); ## For storing messages to be displayed to the user
(-)a/opac/opac-patron-image.pl (-4 / +1 lines)
Lines 21-27 Link Here
21
use Modern::Perl;
21
use Modern::Perl;
22
use C4::Members;
22
use C4::Members;
23
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
24
use CGI::Cookie;  # need to check cookies before having CGI parse the POST request
25
use C4::Auth qw(:DEFAULT check_cookie_auth);
24
use C4::Auth qw(:DEFAULT check_cookie_auth);
26
use Koha::Patron::Images;
25
use Koha::Patron::Images;
27
26
Lines 33-41 unless (C4::Context->preference('OPACpatronimages')) { Link Here
33
}
32
}
34
33
35
my $needed_flags;
34
my $needed_flags;
36
my %cookies = CGI::Cookie->fetch;
35
my ($auth_status, $auth_sessid) = check_cookie_auth($query->cookie('CGISESSID'), $needed_flags);
37
my $sessid = $cookies{'CGISESSID'}->value;
38
my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
39
my $borrowernumber = C4::Context->userenv->{'number'};
36
my $borrowernumber = C4::Context->userenv->{'number'};
40
37
41
my $patron_image = Koha::Patron::Images->find($borrowernumber);
38
my $patron_image = Koha::Patron::Images->find($borrowernumber);
(-)a/opac/opac-ratings-ajax.pl (-3 / +1 lines)
Lines 26-32 A script that takes an ajax json query, and then inserts or modifies a star-rati Link Here
26
use Modern::Perl;
26
use Modern::Perl;
27
27
28
use CGI qw ( -utf8 );
28
use CGI qw ( -utf8 );
29
use CGI::Cookie;  # need to check cookies before having CGI parse the POST request
30
29
31
use C4::Auth qw(:DEFAULT check_cookie_auth);
30
use C4::Auth qw(:DEFAULT check_cookie_auth);
32
use C4::Context;
31
use C4::Context;
Lines 109-117 exit; Link Here
109
# a ratings specific ajax return sub, returns CGI object, and an 'auth_success' value
108
# a ratings specific ajax return sub, returns CGI object, and an 'auth_success' value
110
sub ajax_auth_cgi {
109
sub ajax_auth_cgi {
111
    my $needed_flags = shift;
110
    my $needed_flags = shift;
112
    my %cookies      = CGI::Cookie->fetch;
113
    my $input        = CGI->new;
111
    my $input        = CGI->new;
114
    my $sessid = $cookies{'CGISESSID'}->value || $input->param('CGISESSID');
112
    my $sessid = $input->cookie('CGISESSID') || $input->param('CGISESSID');
115
    my ( $auth_status, $auth_sessid ) =
113
    my ( $auth_status, $auth_sessid ) =
116
      check_cookie_auth( $sessid, $needed_flags );
114
      check_cookie_auth( $sessid, $needed_flags );
117
    return $input, $auth_status;
115
    return $input, $auth_status;
(-)a/opac/opac-tags.pl (-3 / +1 lines)
Lines 33-39 C4::Scrubber is used to remove all markup content from the sumitted text. Link Here
33
use Modern::Perl;
33
use Modern::Perl;
34
34
35
use CGI qw ( -utf8 );
35
use CGI qw ( -utf8 );
36
use CGI::Cookie; # need to check cookies before having CGI parse the POST request
37
36
38
use C4::Auth qw(:DEFAULT check_cookie_auth);
37
use C4::Auth qw(:DEFAULT check_cookie_auth);
39
use C4::Context;
38
use C4::Context;
Lines 61-69 my @globalErrorIndexes = (); Link Here
61
60
62
sub ajax_auth_cgi {     # returns CGI object
61
sub ajax_auth_cgi {     # returns CGI object
63
	my $needed_flags = shift;
62
	my $needed_flags = shift;
64
    my %cookies = CGI::Cookie->fetch;
65
	my $input = CGI->new;
63
	my $input = CGI->new;
66
    my $sessid = $cookies{'CGISESSID'}->value;
64
    my $sessid = $input->cookie('CGISESSID');
67
	my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
65
	my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
68
	$debug and
66
	$debug and
69
	print STDERR "($auth_status, $auth_sessid) = check_cookie_auth($sessid," . Dumper($needed_flags) . ")\n";
67
	print STDERR "($auth_status, $auth_sessid) = check_cookie_auth($sessid," . Dumper($needed_flags) . ")\n";
(-)a/tags/review.pl (-3 / +1 lines)
Lines 23-29 use Modern::Perl; Link Here
23
use Data::Dumper;
23
use Data::Dumper;
24
use POSIX;
24
use POSIX;
25
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
26
use CGI::Cookie;     # need to check cookies before having CGI parse the POST request
27
use URI::Escape;
26
use URI::Escape;
28
use C4::Auth qw(:DEFAULT check_cookie_auth);
27
use C4::Auth qw(:DEFAULT check_cookie_auth);
29
use C4::Context;
28
use C4::Context;
Lines 38-46 my $needed_flags = { tools => 'moderate_tags' }; # FIXME: replace when more s Link Here
38
37
39
sub ajax_auth_cgi { # returns CGI object
38
sub ajax_auth_cgi { # returns CGI object
40
    my $needed_flags = shift;
39
    my $needed_flags = shift;
41
    my %cookies = CGI::Cookie->fetch;
42
    my $input = CGI->new;
40
    my $input = CGI->new;
43
    my $sessid = $cookies{'CGISESSID'}->value;
41
    my $sessid = $input->cookie('CGISESSID');
44
    my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
42
    my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
45
    $debug and
43
    $debug and
46
    print STDERR "($auth_status, $auth_sessid) = check_cookie_auth($sessid," . Dumper($needed_flags) . ")\n";
44
    print STDERR "($auth_status, $auth_sessid) = check_cookie_auth($sessid," . Dumper($needed_flags) . ")\n";
(-)a/tools/background-job-progress.pl (-5 / +1 lines)
Lines 22-37 use Modern::Perl; Link Here
22
# standard or CPAN modules used
22
# standard or CPAN modules used
23
use IO::File;
23
use IO::File;
24
use CGI qw ( -utf8 );
24
use CGI qw ( -utf8 );
25
use CGI::Session;
26
use C4::Context;
25
use C4::Context;
27
use C4::Auth qw/check_cookie_auth/;
26
use C4::Auth qw/check_cookie_auth/;
28
use C4::BackgroundJob;
27
use C4::BackgroundJob;
29
use CGI::Cookie; # need to check cookies before
30
                 # having CGI parse the POST request
31
28
32
my $input = CGI->new;
29
my $input = CGI->new;
33
my %cookies = CGI::Cookie->fetch;
30
my ($auth_status, $sessionID) = check_cookie_auth($input->cookie('CGISESSID'), { tools => '*' });
34
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { tools => '*' });
35
if ($auth_status ne "ok") {
31
if ($auth_status ne "ok") {
36
    my $reply = CGI->new("");
32
    my $reply = CGI->new("");
37
    print $reply->header(-type => 'text/html');
33
    print $reply->header(-type => 'text/html');
(-)a/tools/batchMod.pl (-2 / +1 lines)
Lines 100-107 my @not_deleted; # List of the itemnumbers that could not be deleted Link Here
100
my $modified_items = 0;    # Numbers of modified items
100
my $modified_items = 0;    # Numbers of modified items
101
my $modified_fields = 0;   # Numbers of modified fields
101
my $modified_fields = 0;   # Numbers of modified fields
102
102
103
my %cookies = parse CGI::Cookie($cookie);
103
my $sessionID = $input->cookie('CGISESSID');
104
my $sessionID = $cookies{'CGISESSID'}->value;
105
104
106
105
107
#--- ----------------------------------------------------------------------------
106
#--- ----------------------------------------------------------------------------
(-)a/tools/manage-marc-import.pl (-3 / +1 lines)
Lines 21-27 use Modern::Perl; Link Here
21
21
22
# standard or CPAN modules used
22
# standard or CPAN modules used
23
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
24
use CGI::Cookie;
25
use MARC::File::USMARC;
24
use MARC::File::USMARC;
26
25
27
# Koha modules used
26
# Koha modules used
Lines 57-64 my ($template, $loggedinuser, $cookie) Link Here
57
                 debug => 1,
56
                 debug => 1,
58
                 });
57
                 });
59
58
60
my %cookies = parse CGI::Cookie($cookie);
59
our $sessionID = $input->cookie('CGISESSID');
61
our $sessionID = $cookies{'CGISESSID'}->value;
62
our $dbh = C4::Context->dbh;
60
our $dbh = C4::Context->dbh;
63
61
64
my $frameworks = Koha::BiblioFrameworks->search({ tagfield => { 'not' => undef } }, { join => 'marc_tag_structure', distinct => 'frameworkcode', order_by => ['frameworktext'] });
62
my $frameworks = Koha::BiblioFrameworks->search({ tagfield => { 'not' => undef } }, { join => 'marc_tag_structure', distinct => 'frameworkcode', order_by => ['frameworktext'] });
(-)a/tools/modborrowers.pl (-2 lines)
Lines 51-58 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
51
51
52
my $logged_in_user = Koha::Patrons->find( $loggedinuser );
52
my $logged_in_user = Koha::Patrons->find( $loggedinuser );
53
53
54
my %cookies   = parse CGI::Cookie($cookie);
55
my $sessionID = $cookies{'CGISESSID'}->value;
56
my $dbh       = C4::Context->dbh;
54
my $dbh       = C4::Context->dbh;
57
55
58
# Show borrower informations
56
# Show borrower informations
(-)a/tools/stage-marc-import.pl (-3 / +1 lines)
Lines 28-34 use Modern::Perl; Link Here
28
28
29
# standard or CPAN modules used
29
# standard or CPAN modules used
30
use CGI qw ( -utf8 );
30
use CGI qw ( -utf8 );
31
use CGI::Cookie;
32
use MARC::File::USMARC;
31
use MARC::File::USMARC;
33
32
34
# Koha modules used
33
# Koha modules used
Lines 81-88 $template->param( Link Here
81
    booksellerid => $booksellerid,
80
    booksellerid => $booksellerid,
82
);
81
);
83
82
84
my %cookies = parse CGI::Cookie($cookie);
83
my $sessionID = $input->cookie('CGISESSID');
85
my $sessionID = $cookies{'CGISESSID'}->value;
86
if ($completedJobID) {
84
if ($completedJobID) {
87
    my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID);
85
    my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID);
88
    my $results = $job->results();
86
    my $results = $job->results();
(-)a/tools/upload-cover-image.pl (-3 lines)
Lines 73-80 my $itemnumber = $input->param('itemnumber'); Link Here
73
my $replace        = !C4::Context->preference("AllowMultipleCovers")
73
my $replace        = !C4::Context->preference("AllowMultipleCovers")
74
  || $input->param('replace');
74
  || $input->param('replace');
75
my $op        = $input->param('op');
75
my $op        = $input->param('op');
76
my %cookies   = parse CGI::Cookie($cookie);
77
my $sessionID = $cookies{'CGISESSID'}->value;
78
76
79
my $error;
77
my $error;
80
78
81
- 

Return to bug 27337