From 8a63dd55a0eb2a91d256509a382862e997645e4b Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Thu, 7 Jan 2010 09:41:12 -0500 Subject: [PATCH] Correcting array element reference syntax which caused unnecessary warns Also adding conditional to check ENV VAR definition to avoid unnecssary warns. --- opac/opac-main.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/opac/opac-main.pl b/opac/opac-main.pl index f218a006e2..e0a65a9ae8 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -67,14 +67,16 @@ my $news_lang; if($input->cookie('KohaOpacLanguage')){ $news_lang = $input->cookie('KohaOpacLanguage'); }else{ - while( !$news_lang && ( $ENV{HTTP_ACCEPT_LANGUAGE} =~ m/([a-zA-Z]{2,}-?[a-zA-Z]*)(;|,)?/g ) ){ - if( my @lang = grep { /^$1$/i } @languages ) { - $news_lang = $lang[0]; + if ($ENV{HTTP_ACCEPT_LANGUAGE}) { + while( !$news_lang && ( $ENV{HTTP_ACCEPT_LANGUAGE} =~ m/([a-zA-Z]{2,}-?[a-zA-Z]*)(;|,)?/g ) ){ + if( my @lang = grep { /^$1$/i } @languages ) { + $news_lang = $lang[0]; + } } } if (not $news_lang) { 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 ); -# 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')) { $template->param('GoogleIndicTransliteration' => 1); } -- 2.39.5