body<= {'user'}; my $u = LJ::get_authas_user($authas); return LJ::bad_input($ML{'error.invalidauth'}) unless $u; # visibility status name mappings my %statusvis = ( "V" => "$ML{'.journalstatus.select.activated'}", "D" => "$ML{'.journalstatus.select.deleted'}" ); if ($u->{'statusvis'} eq "S") { %statusvis = ("S" => "$ML{'.journalstatus.select.suspended'}"); } # process form submission if (LJ::did_post() && LJ::check_referer('/accountstatus.bml')) { my $ok = sub { return "\n"; }; my $dberr = sub { return "\n"; }; # are they suspended? return LJ::bad_input($ML{'.error.nochange.suspend'}) if $u->{'statusvis'} eq 'S'; # are they expunged? return LJ::bad_input($ML{'.error.nochange.expunged'}) if $u->{'statusvis'} eq 'X'; # invalid statusvis return LJ::bad_input($ML{'.error.invalid'}) unless $POST{'statusvis'} eq 'D' || $POST{'statusvis'} eq 'V'; # no need to change? return $ok->(BML::ml('.message.nochange', {'statusvis' => $statusvis{$POST{'statusvis'}} })) if $u->{'statusvis'} eq $POST{'statusvis'}; # do update my $res = LJ::update_user($u, { 'statusvis' => $POST{'statusvis'}, 'raw' => 'statusvisdate=NOW()' }); # error updating? return $dberr->($ML{'.error.db'}) unless $res; # success return $ok->(BML::ml('.message.success', {'statusvis' => $statusvis{$POST{'statusvis'}} })); } # update form my $ret; # authas switcher form $ret .= "
\n"; $ret .= LJ::make_authas_select($remote, { 'authas' => $GET{'authas'} }) . "\n"; $ret .= "
\n\n"; my $getextra = "?authas=$authas" unless $authas eq $remote->{'user'}; $ret .= "
\n"; $ret .= "\n"; $ret .= "
$ML{'.journalstatus.select.head'}\n"; $ret .= LJ::html_select({ 'name' => 'statusvis', 'selected' => $u->{'statusvis'} }, map { $_, $statusvis{$_} } reverse sort keys %statusvis) . "\n"; $ret .= LJ::html_submit(undef, $ML{'.btn.status'}, { 'disabled' => $u->{'statusvis'} eq 'S' }) . "\n"; $ret .= "
\n
\n"; return $ret; } _code?> <=body page?>