{'title'}; my $head = \$_[1]->{'head'}; my $body = \$_[1]->{'body'}; my $bodyopts = \$_[1]->{'bodyopts'}; # set page title $$title = $ML{'.title'}; # server down? if ($LJ::SERVER_DOWN) { $$body = LJ::server_down_html(); return; } # invalid text input? unless (LJ::text_in(\%POST)) { $$body = ""; return; } # get remote and see if they can post right now my $remote = LJ::get_remote(); if ($remote) { if (LJ::get_cap($remote, "readonly") || ! LJ::get_cluster_master($remote)) { $$title = $ML{'.title.readonly'}; $$body = $LJ::MSG_READONLY_USER; return; } if (! LJ::get_cap($remote, "can_post")) { $$title = "Can't Post"; $$body = $LJ::MSG_NO_POST || "Sorry, you cannot post at this time."; return; } } # are we spellchecking before we post? my $spellcheck_html; my $did_spellcheck; if ($LJ::SPELLER && $POST{'do_spellcheck'}) { my $s = new LJ::SpellCheck { 'spellcommand' => $LJ::SPELLER, 'color' => '', }; my $event = LJ::ehtml($POST{'event'}); $spellcheck_html = $s->check_html(\$event); $did_spellcheck++; } ### define some bools with common logic ### my $did_post = LJ::did_post(); my $user_is_remote = $remote && $remote->{'user'} eq $POST{'user'}; # user is remote my $auth_as_remote = $remote && (! $GET{'altlogin'} || $user_is_remote); # auth as remote my $auth_missing = $POST{'user'} && ! $POST{'password'} && ! $user_is_remote; # user w/o password my $showform = $POST{'showform'} || $auth_missing; # show entry form if ($did_post && ! $spellcheck_html && ! $showform) { # what's our authentication scheme for subsequent protocol actions? my $flags = {}; my $user; if ($POST{'user'} && # user argument given ! $user_is_remote) { # user != remote $user = $POST{'user'}; } elsif ($remote) { # assume remote if we have it $flags = { 'noauth' => 1, 'u' => $remote }; $user = $remote->{'user'}; } # do a login action my $login_message; { # build a clientversion string my $clientversion = $POST{'webversion'} eq 'full' ? "Web/1.1" : "Web/1.0"; $clientversion .= 's' if $did_spellcheck; # build a request object my %req = ( 'mode' => 'login', 'ver' => $LJ::PROTOCOL_VER, 'clientversion' => $clientversion, 'user' => $user, 'password' => $POST{'password'}, 'hpassword' => $POST{'hpassword'}, ); my %res; LJ::do_request(\%req, \%res, $flags); # error logging in ? unless ($res{'success'} eq 'OK') { $$body .= "\n"; $$body .= "