summaryrefslogtreecommitdiff
path: root/util/vndb.pl
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-01-26 19:30:00 +0100
committerYorhel <git@yorhel.nl>2010-01-26 19:30:00 +0100
commit4dfb556ecc621b1983d7ad4154db202ec7530e44 (patch)
tree5de32cd553eeca355ad071b0be226f9cc0ca2727 /util/vndb.pl
parent5f5306216268e2bc97f7dccee24a9a8152553890 (diff)
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)
Diffstat (limited to 'util/vndb.pl')
-rwxr-xr-xutil/vndb.pl12
1 files changed, 4 insertions, 8 deletions
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;