From 0ebbdaaed5efab6befed0bd51f742600792db54c Mon Sep 17 00:00:00 2001 From: finlayt Date: Wed, 11 Sep 2002 22:11:17 +0000 Subject: [PATCH] A little more refactoring.... --- tmpl/opacmain.pl | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/tmpl/opacmain.pl b/tmpl/opacmain.pl index a36f523143..16264773b7 100755 --- a/tmpl/opacmain.pl +++ b/tmpl/opacmain.pl @@ -1,35 +1,22 @@ #!/usr/bin/perl -use HTML::Template; +use HTML::Template; # new Template use strict; require Exporter; -use C4::Database; -use C4::Output; # contains picktemplate -use CGI; -use C4::Auth; +use C4::Database; # configfile +use C4::Output; # themelanguage +use CGI; # new CGI +use C4::Auth; # checkauth my $query = new CGI; #my ($loggedinuser, $cookie, $sessionID) = checkauth($query); -my %configfile; -open (KC, "/etc/koha.conf"); -while () { - chomp; - (next) if (/^\s*#/); - if (/(.*)\s*=\s*(.*)/) { - my $variable=$1; - my $value=$2; - # Clean up white space at beginning and end - $variable=~s/^\s*//g; - $variable=~s/\s*$//g; - $value=~s/^\s*//g; - $value=~s/\s*$//g; - $configfile{$variable}=$value; - } -} +my $configfile = configfile(); -my $htdocs=$configfile{'opachtdocs'}; -my $templatebase="opac-main.tmpl"; -my ($theme, $lang)=themelanguage($htdocs, $templatebase); +my $htdocs = $configfile->{'opachtdocs'}; + +my $templatebase = "opac-main.tmpl"; + +my ($theme, $lang) = themelanguage($htdocs, $templatebase); my $template = HTML::Template->new(filename => "$htdocs/$theme/$lang/$templatebase", die_on_bad_params => 0, path => ["$htdocs/includes"]); -- 2.39.5