adding authentification with Auth.pm
authortipaul <tipaul>
Tue, 10 Dec 2002 17:35:27 +0000 (17:35 +0000)
committertipaul <tipaul>
Tue, 10 Dec 2002 17:35:27 +0000 (17:35 +0000)
(note : i want to stay the 1st commiter in december as in november :-) )

13 files changed:
admin-home.pl
admin/aqbookfund.pl
admin/aqbudget.pl
admin/authorised_values.pl
admin/branches.pl
admin/koha2marclinks.pl
admin/marc_subfields_structure.pl
admin/marctagstructure.pl
admin/systempreferences.pl
admin/thesaurus.pl
catalogue-home.pl
mainpage.pl
userpage.pl

index 54dfeb1..daa8781 100755 (executable)
@@ -8,9 +8,14 @@ use C4::Database;
 use HTML::Template;
 
 my $query = new CGI;
-my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
-
-my $template = gettemplate("parameters/admin-home.tmpl");
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "parameters/admin-home.tmpl",
+                            query => $query,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
 $template->param(loggeninuser => $loggedinuser);
 
 print $query->header(-cookie => $cookie),$template->output;
index 217c2f8..882e1ca 100755 (executable)
@@ -39,6 +39,7 @@
 
 use strict;
 use CGI;
+use C4::Auth;
 use C4::Context;
 use C4::Output;
 use C4::Search;
@@ -73,7 +74,15 @@ my $pagesize=20;
 my $op = $input->param('op');
 $searchfield=~ s/\,//g;
 
-my $template = gettemplate("parameters/aqbookfund.tmpl",0);
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "parameters/aqbookfund.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
+
 if ($op) {
 $template->param(script_name => $script_name,
                                                $op              => 1); # we show only the TMPL_VAR names $op
@@ -196,6 +205,4 @@ if ($op eq 'add_form') {
        $template->param(bookfund => \@loop_data);
 } #---- END $OP eq DEFAULT
 
-
-
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie), $template->output;
index 0947a76..5759516 100755 (executable)
@@ -39,6 +39,7 @@
 
 use strict;
 use CGI;
+use C4::Auth;
 use C4::Context;
 use C4::Output;
 use C4::Search;
@@ -75,7 +76,15 @@ my $pagesize=20;
 my $op = $input->param('op');
 $searchfield=~ s/\,//g;
 
-my $template = gettemplate("parameters/aqbudget.tmpl",0);
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "parameters/aqbudget.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
+
 if ($op) {
 $template->param(script_name => $script_name,
                                                $op              => 1); # we show only the TMPL_VAR names $op
@@ -217,4 +226,5 @@ if ($op eq 'add_form') {
        $template->param(budget => \@loop_data);
 } #---- END $OP eq DEFAULT
 
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie), $template->output;
+
index baaa41a..2a20ea3 100755 (executable)
@@ -19,6 +19,7 @@
 
 use strict;
 use CGI;
+use C4::Auth;
 use C4::Context;
 use C4::Output;
 use C4::Search;
@@ -55,7 +56,14 @@ my $offset=$input->param('offset');
 my $script_name="/cgi-bin/koha/admin/authorised_values.pl";
 my $dbh = C4::Context->dbh;
 
-my $template = gettemplate("parameters/authorised_values.tmpl",0);
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "parameters/authorised_values.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
 my $pagesize=20;
 my $op = $input->param('op');
 
@@ -180,4 +188,4 @@ if ($op eq 'add_form') {
        }
 } #---- END $OP eq DEFAULT
 
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie), $template->output;
index e5e9311..0e7c14d 100755 (executable)
@@ -23,6 +23,7 @@
 
 use strict;
 use CGI;
+use C4::Auth;
 use C4::Context;
 use C4::Output;
 use HTML::Template;
@@ -42,7 +43,14 @@ my $input = new CGI;
 my $branchcode=$input->param('branchcode');
 my $op = $input->param('op');
 
-my $template = gettemplate("parameters/branches.tmpl",0);
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "parameters/branches.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
 if ($op) {
 $template->param(script_name => $script_name,
                                                $op              => 1); # we show only the TMPL_VAR names $op
@@ -53,7 +61,7 @@ $template->param(script_name => $script_name,
 $template->param(action => $script_name);
 
 if ($op eq 'add') {
-# If the user has pressed the "add new branch" button. 
+# If the user has pressed the "add new branch" button.
     heading("Branches: Add Branch");
     editbranchform();
 
@@ -368,4 +376,4 @@ sub checkdatabasefor {
     return $message;
 }
 
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie), $template->output;
index 102cd0e..ed254ae 100755 (executable)
@@ -20,6 +20,7 @@
 
 use strict;
 use C4::Output;
+use C4::Auth;
 use CGI;
 use C4::Search;
 use C4::Context;
@@ -33,7 +34,14 @@ my $kohafield = $input->param('kohafield');
 my $op=$input->param('op');
 my $script_name = 'koha2marclinks.pl';
 
-my $template = gettemplate("parameters/koha2marclinks.tmpl",0);
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "parameters/koha2marclinks.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
 
 if ($op) {
 $template->param(script_name => $script_name,
@@ -127,4 +135,4 @@ if ($op eq 'add_form') {
                                                        );
 } #---- END $OP eq DEFAULT
 
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie), $template->output;
index 39c4129..eb9a561 100755 (executable)
@@ -20,6 +20,7 @@
 
 use strict;
 use C4::Output;
+use C4::Auth;
 use CGI;
 use C4::Search;
 use C4::Context;
@@ -55,7 +56,14 @@ my $reqdel="delete from marc_subfield_structure where tagfield='$tagfield' and t
 my $offset=$input->param('offset');
 my $script_name="/cgi-bin/koha/admin/marc_subfields_structure.pl";
 
-my $template = gettemplate("parameters/marc_subfields_structure.tmpl",0);
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "parameters/marc_subfields_structure.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
 my $pagesize=30;
 my $op = $input->param('op');
 $tagfield=~ s/\,//g;
@@ -339,4 +347,4 @@ if ($op eq 'add_form') {
        }
 } #---- END $OP eq DEFAULT
 
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie), $template->output;
index 34c17e0..c7d2ef3 100755 (executable)
@@ -20,6 +20,7 @@
 
 use strict;
 use CGI;
+use C4::Auth;
 use C4::Context;
 use C4::Output;
 use C4::Search;
@@ -55,7 +56,14 @@ my $script_name="/cgi-bin/koha/admin/marctagstructure.pl";
 
 my $dbh = C4::Context->dbh;
 
-my $template = gettemplate("parameters/marctagstructure.tmpl",0);
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "parameters/marctagstructure.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
 my $pagesize=20;
 my $op = $input->param('op');
 $searchfield=~ s/\,//g;
@@ -186,4 +194,5 @@ if ($op eq 'add_form') {
        }
 } #---- END $OP eq DEFAULT
 
-print "Content-Type: text/html\n\n", $template->output;
+$template->param(loggeninuser => $loggedinuser);
+print $input->header(-cookie => $cookie), $template->output;
index e6eea65..fe4210e 100755 (executable)
@@ -39,6 +39,7 @@
 
 use strict;
 use CGI;
+use C4::Auth;
 use C4::Context;
 use C4::Output;
 use C4::Search;
@@ -73,7 +74,14 @@ my $reqdel="delete from systempreferences where $pkfield='$searchfield'";
 my $offset=$input->param('offset');
 my $script_name="/cgi-bin/koha/admin/systempreferences.pl";
 
-my $template = gettemplate("parameters/systempreferences.tmpl",0);
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "parameters/systempreferences.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
 my $pagesize=20;
 my $op = $input->param('op');
 $searchfield=~ s/\,//g;
@@ -176,4 +184,4 @@ if ($op eq 'add_form') {
        }
 } #---- END $OP eq DEFAULT
 
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie), $template->output;
index c16ad14..61bf992 100755 (executable)
@@ -19,6 +19,7 @@
 
 use strict;
 use CGI;
+use C4::Auth;
 use C4::Context;
 use C4::Output;
 use C4::Search;
@@ -43,7 +44,15 @@ my $script_name="/cgi-bin/koha/admin/thesaurus.pl";
 my $dbh = C4::Context->dbh;
 my $authoritysep = C4::Context->preference("authoritysep");
 
-my $template = gettemplate("parameters/thesaurus.tmpl",0);
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "parameters/thesaurus.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
+
 my $pagesize=20;
 
 my $prevpage = $offset-$pagesize;
@@ -247,4 +256,4 @@ if ($op eq 'add_form') {
        }
 } #---- END $OP eq DEFAULT
 
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie), $template->output;
index 0365d19..df94438 100755 (executable)
@@ -8,8 +8,14 @@ use C4::Database;
 use HTML::Template;
 
 my $query = new CGI;
-my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
-my $template = gettemplate("catalogue/catalogue-home.tmpl");
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "catalogue/catalogue-home.tmpl",
+                            query => $query,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
 
 my $classlist='';
 #open C, "$intranetdir/htdocs/includes/cat-class-list.inc";
@@ -18,6 +24,6 @@ my $classlist='';
 #}
 $template->param(loggedinuser => $loggedinuser,
                                                classlist => $classlist,
-                                               opac => 0);
+                                               type => 'intranet',);
 
 print $query->header(-cookie => $cookie), $template->output;
index 18772f3..5a7f605 100755 (executable)
@@ -8,8 +8,13 @@ use CGI;
 use C4::Auth;
 
 my $query = new CGI;
-my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
-
-my $template = gettemplate("intranet-main.tmpl");
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "intranet-main.tmpl",
+                            query => $query,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
 
 print  $query->header(-cookie => $cookie), $template->output;
index 79b08eb..044d0f2 100755 (executable)
@@ -26,11 +26,16 @@ use CGI;
 use C4::Search;
 use C4::Auth;
 
-my $query=new CGI;
-my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0);
+my $query = new CGI;
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "user/userpage.tmpl",
+                            query => $query,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
 
-my $template = gettemplate("user/userpage.tmpl",0);
-
-$template->param(loggedinuser => $loggedinuser);
+warn "userloggedin : $loggedinuser (".$query->param('userid')." et ".$query->param('password');
 
 print $query->header(-cookie => $cookie), $template->output;