Bugzilla – Attachment 6489 Details for
Bug 7282
invalid language selection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch, fixing comment 8
0001-Bug-7282-Invalid-language-selection.patch (text/plain), 3.36 KB, created by
Frédéric Demians
on 2011-12-01 18:08:28 UTC
(
hide
)
Description:
Proposed patch, fixing comment 8
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2011-12-01 18:08:28 UTC
Size:
3.36 KB
patch
obsolete
>From 8fe3b809f2e7b84e7c6e6168717eb90bbe489745 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= <f.demians@tamil.fr> >Date: Thu, 1 Dec 2011 17:52:22 +0100 >Subject: [PATCH] Bug 7282 Invalid language selection >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Frère Sébastien Marie refactored patch to ensure that without cookie, language >selection is based on browser preferences. > >To reproduce the bug: > >- Activate en and fr-FR for OPAC >- Clear your browser cookies >- Select your language preference in your browser: fr, fr-fr, en >- Load OPAC main page >- OPAC is displayed in English, rather than French as asked by browser > preferences > >Apply the patch and test: > >- Clear your browser cookies >- Load OPAC main page >- Pages are displayed in French >--- > C4/Templates.pm | 20 +++++--------------- > catalogue/search.pl | 3 ++- > opac/opac-search.pl | 3 ++- > 3 files changed, 9 insertions(+), 17 deletions(-) > >diff --git a/C4/Templates.pm b/C4/Templates.pm >index 73d94c2..8b90c20 100644 >--- a/C4/Templates.pm >+++ b/C4/Templates.pm >@@ -277,8 +277,11 @@ sub themelanguage { > my @languages = split(",", C4::Context->preference( > $is_intranet ? 'language' : 'opaclanguages')); > my $lang; >- $lang = getlanguagecookie($query); >- unless ($lang) { >+ if ( $query->cookie('KohaOpacLanguage') ) { >+ $lang = $query->cookie('KohaOpacLanguage') ; >+ $lang =~ s/[^a-zA-Z_-]*//; #sanitzie >+ } >+ else { > my $http_accept_language = $ENV{ HTTP_ACCEPT_LANGUAGE }; > $lang = accept_language( $http_accept_language, > getTranslatedLanguages($interface,'prog') ); >@@ -317,18 +320,5 @@ sub setlanguagecookie { > ); > } > >-sub getlanguagecookie { >- my ($query) = @_; >- my $lang; >- if ($query->cookie('KohaOpacLanguage')){ >- $lang = $query->cookie('KohaOpacLanguage') ; >- }else{ >- $lang = $ENV{HTTP_ACCEPT_LANGUAGE}; >- >- } >- $lang =~ s/[^a-zA-Z_-]*//; #sanitzie >- return $lang; >-} >- > 1; > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 907efdb..56223cf 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -471,7 +471,8 @@ my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit > my @results; > > ## I. BUILD THE QUERY >-my $lang = C4::Templates::getlanguagecookie($cgi); >+# Language cookie should have been set by previous page >+my $lang = $cgi->cookie('KohaOpacLanguage') || 'en'; > ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by,$scan,$lang); > > ## parse the query_cgi string and put it into a form suitable for <input>s >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 42eb0ec..3581d7b 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -388,7 +388,8 @@ my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_ > my @results; > > ## I. BUILD THE QUERY >-my $lang = C4::Templates::getlanguagecookie($cgi); >+# Language cookie should have been set by previous page >+my $lang = $cgi->cookie('KohaOpacLanguage') || 'en'; > ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by, 0, $lang); > > sub _input_cgi_parse ($) { >-- >1.7.6.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7282
:
6486
|
6487
|
6488
|
6489
|
6490
|
6491
|
6495