package wloh_common;
sub get_max_season {
- my $dbh = shift;
- my $ref = $dbh->selectrow_hashref('SELECT MAX(sesong) AS max_sesong FROM fotballserier');
+ my ($dbh, $locale) = @_;
+ my $ref = $dbh->selectrow_hashref('SELECT MAX(sesong) AS max_sesong FROM fotballserier se JOIN fotballspraak sp ON se.spraak=sp.id WHERE kultur=?',
+ undef, $locale);
return $ref->{'max_sesong'};
}
}
}
+sub get_locale {
+ my $cgi = shift;
+ my $url = $cgi->url(-absolute => 1);
+ $url =~ m#^/([a-z][a-z]-[A-Z][A-Z])/# or die "Invalid locale!";
+ return $1;
+}
+
1;