|
Lines 110-127
InstallAuth - Authenticates Koha users for Install process
Link Here
|
| 110 |
sub get_template_and_user { |
110 |
sub get_template_and_user { |
| 111 |
my $in = shift; |
111 |
my $in = shift; |
| 112 |
my $query = $in->{'query'}; |
112 |
my $query = $in->{'query'}; |
| 113 |
my $language = $query->cookie('KohaOpacLanguage'); |
113 |
my $language =_get_template_language($query->cookie('KohaOpacLanguage')); |
| 114 |
my $path = |
114 |
my $path = C4::Context->config('intrahtdocs'). "/prog/". $language; |
| 115 |
C4::Context->config('intrahtdocs') . "/prog/" |
115 |
|
| 116 |
. ( $language ? $language : "en" ); |
|
|
| 117 |
|
| 118 |
my $tmplbase = $in->{template_name}; |
116 |
my $tmplbase = $in->{template_name}; |
| 119 |
$tmplbase=~ s/\.tmpl$/.tt/; |
117 |
$tmplbase=~ s/\.tmpl$/.tt/; |
| 120 |
my $filename = "$path/modules/" . $tmplbase; |
118 |
my $filename = "$path/modules/" . $tmplbase; |
| 121 |
my $interface = 'intranet'; |
119 |
my $interface = 'intranet'; |
| 122 |
my $template = C4::Templates->new( $interface, $filename, $tmplbase); |
120 |
my $template = C4::Templates->new( $interface, $filename, $tmplbase); |
| 123 |
|
121 |
|
| 124 |
|
|
|
| 125 |
my ( $user, $cookie, $sessionID, $flags ) = checkauth( |
122 |
my ( $user, $cookie, $sessionID, $flags ) = checkauth( |
| 126 |
$in->{'query'}, |
123 |
$in->{'query'}, |
| 127 |
$in->{'authnotrequired'}, |
124 |
$in->{'authnotrequired'}, |
|
Lines 160-165
sub get_template_and_user {
Link Here
|
| 160 |
return ( $template, $borrowernumber, $cookie ); |
157 |
return ( $template, $borrowernumber, $cookie ); |
| 161 |
} |
158 |
} |
| 162 |
|
159 |
|
|
|
160 |
sub _get_template_language { |
| 161 |
#verify if opac language exists in staff (bug 5660) |
| 162 |
#conditions are 1) dir exists and 2) enabled in prefs |
| 163 |
my ($opaclang)= @_; |
| 164 |
return 'en' unless $opaclang; |
| 165 |
my $path= C4::Context->config('intrahtdocs')."/prog/$opaclang"; |
| 166 |
my $pref= ','.C4::Context->preference('language').','; |
| 167 |
if(-d $path) { |
| 168 |
if($pref =~ /,$opaclang,/ ) { |
| 169 |
return $opaclang; |
| 170 |
} |
| 171 |
} |
| 172 |
return 'en'; |
| 173 |
} |
| 174 |
|
| 163 |
=item checkauth |
175 |
=item checkauth |
| 164 |
|
176 |
|
| 165 |
($userid, $cookie, $sessionID) = &checkauth($query, $noauth, $flagsrequired, $type); |
177 |
($userid, $cookie, $sessionID) = &checkauth($query, $noauth, $flagsrequired, $type); |
| 166 |
- |
|
|