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