Correcting array element reference syntax which caused unnecessary warns

Also adding conditional to check ENV VAR definition to avoid unnecssary warns.
This commit is contained in:
Chris Nighswonger 2010-01-07 09:41:12 -05:00 committed by Henri-Damien LAURENT
parent 2f274f01a1
commit 8a63dd55a0

View file

@ -67,14 +67,16 @@ my $news_lang;
if($input->cookie('KohaOpacLanguage')){ if($input->cookie('KohaOpacLanguage')){
$news_lang = $input->cookie('KohaOpacLanguage'); $news_lang = $input->cookie('KohaOpacLanguage');
}else{ }else{
while( !$news_lang && ( $ENV{HTTP_ACCEPT_LANGUAGE} =~ m/([a-zA-Z]{2,}-?[a-zA-Z]*)(;|,)?/g ) ){ if ($ENV{HTTP_ACCEPT_LANGUAGE}) {
if( my @lang = grep { /^$1$/i } @languages ) { while( !$news_lang && ( $ENV{HTTP_ACCEPT_LANGUAGE} =~ m/([a-zA-Z]{2,}-?[a-zA-Z]*)(;|,)?/g ) ){
$news_lang = $lang[0]; if( my @lang = grep { /^$1$/i } @languages ) {
$news_lang = $lang[0];
}
} }
} }
if (not $news_lang) { if (not $news_lang) {
my @languages = split ",", C4::Context->preference("opaclanguages"); my @languages = split ",", C4::Context->preference("opaclanguages");
$news_lang = @languages[0]; $news_lang = $languages[0];
} }
} }
@ -88,7 +90,7 @@ $template->param(
koha_news_count => $koha_news_count koha_news_count => $koha_news_count
); );
# If GoogleIndicTransliteration system preference is On Set paramter to load Google's javascript in OPAC search screens # If GoogleIndicTransliteration system preference is On Set paramter to load Google's javascript in OPAC search screens
if (C4::Context->preference('GoogleIndicTransliteration')) { if (C4::Context->preference('GoogleIndicTransliteration')) {
$template->param('GoogleIndicTransliteration' => 1); $template->param('GoogleIndicTransliteration' => 1);
} }