From 4dfb556ecc621b1983d7ad4154db202ec7530e44 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Tue, 26 Jan 2010 19:30:00 +0100 Subject: Removed the ?l10n= parameter Setting the l10n cookie is now done from a separate url: /setlang This makes the language determination code less complex, and makes sure nobody links to pages that change the UI language without intending to. (I've seen some links floating around with the l10n parameter included, which is... bad) --- util/vndb.pl | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'util') diff --git a/util/vndb.pl b/util/vndb.pl index ee617caa..29c2648c 100755 --- a/util/vndb.pl +++ b/util/vndb.pl @@ -54,18 +54,14 @@ sub reqinit { my $self = shift; # Determine language - # if the cookie or parameter "l10n" is set, use that. - # otherwise, interpret the Accept-Language header or fall back to English + # if the cookie is set, use that. Otherwise, interpret the Accept-Language header or fall back to English. # if the cookie is set and is the same as either the Accept-Language header or the fallback, remove it - my $conf = $self->reqParam('l10n') || $self->reqCookie('l10n'); + my $conf = $self->reqCookie('l10n'); $conf = '' if !$conf || !grep $_ eq $conf, VNDB::L10N::languages; $self->{l10n} = VNDB::L10N->get_handle(); # this uses I18N::LangTags::Detect - if($self->{l10n}->language_tag() eq $conf && $self->reqCookie('l10n')) { - $self->resHeader('Set-Cookie', "l10n= ; expires=Sat, 01-Jan-2000 00:00:00 GMT; path=/; domain=$self->{cookie_domain}"); - } elsif($self->reqParam('l10n') && $conf && $conf ne ($self->reqCookie('l10n')||'') && $self->{l10n}->language_tag() ne $conf) { - $self->resHeader('Set-Cookie', "l10n=$conf; expires=Sat, 01-Jan-2030 00:00:00 GMT; path=/; domain=$self->{cookie_domain}"); - } + $self->resHeader('Set-Cookie', "l10n= ; expires=Sat, 01-Jan-2000 00:00:00 GMT; path=/; domain=$self->{cookie_domain}") + if $conf && $self->{l10n}->language_tag() eq $conf; $self->{l10n} = VNDB::L10N->get_handle($conf) if $conf && $self->{l10n}->language_tag() ne $conf; -- cgit v1.2.3