{'thumb'} eq 'ARRAY') { push @thumb_schemes, $_; } else { push @text_schemes, $_; } } # saving changes if (LJ::did_post()) { my $remote = LJ::get_remote(); # was a scheme change posted? my $scheme; if (exists $POST{'action:setscheme'}) { foreach (@text_schemes) { $scheme = $_->{'scheme'} if $POST{'scheme'} eq $_->{'scheme'}; } } else { foreach (@thumb_schemes) { $scheme = $_->{'scheme'} if exists $POST{"action:setscheme:$_->{'scheme'}.x"}; } } # set scheme if ($scheme) { my $cval = $scheme; # don't set cookie for default scheme if ($scheme eq $LJ::SCHEMES[0]->{'scheme'}) { $cval = ''; delete $COOKIE{'BMLschemepref'}; } # logged in? if ($remote) { # set a userprop to remember their schemepref LJ::set_userprop($remote, 'schemepref', $cval); # cookie expires when session expires if ($remote->{'_session'}->{'exptype'} eq 'long') { $cval = [ $scheme, $remote->{'_session'}->{'timeexpire'} ]; } } # set cookie $COOKIE{'BMLschemepref'} = $cval if $cval; # redirect to refresh cookie settings return $redir->(); } # set language if (exists $POST{'action:setlang'} && $POST{'lang'}) { my $l = LJ::Lang::get_lang($POST{'lang'}); return $redir->() unless $l; # default cookie value to set my $cval = $l->{'lncode'} . "/" . time(); # if logged in, change userprop and make cookie expiration # the same as their login expiration my $remote = LJ::get_remote(); if ($remote) { LJ::set_userprop($remote, "browselang", $l->{'lncode'}); if ($remote->{'_session'}->{'exptype'} eq 'long') { $cval = [ $cval, $remote->{'_session'}->{'timeexpire'} ]; } } # set cookie $COOKIE{'langpref'} = $cval; # set language through BML so it will apply immediately BML::set_language($l->{'lncode'}); } } # set title now that we have the correct language $title = $ML{'.title'}; # preferences page output # wrapper box to to keep tables from scrolling horizontally $body .= "
"; # scheme selector if (@LJ::SCHEMES) { $body .= ""; $body .= ""; } # language selector $body .= ""; $body .= ""; $body .= " |