"; return; } # bad statusvis? unless ($remote->{statusvis} eq 'V') { $body = ""; return; } # get info about the community my $cuserid = $FORM{'cuserid'}+0; my $cu = $FORM{comm} ? LJ::load_user($FORM{comm}) : # they gave us the comm name LJ::load_userid($cuserid); # they gave us the comm id # NOTE: we wrapped this in an eval due to code going live; the library isn't going to go # live at the same time as the BML file, and we don't want weird things happening, so we # verify that this is all good and return an error if it's not okay. my $ci; eval { $ci = LJ::get_community_row($cu); }; if ($@) { $body = ""; return; } $cuserid = $ci->{'userid'}; LJ::text_out(\$ci->{'name'}); my $ecname = LJ::ehtml($ci->{'name'}); # does this community even exit? unless ($cu) { $body .= ""; return; } # make sure a community doesn't join a community (that's confusing # or something) unless ($remote->{'journaltype'} eq "P") { $body .= ""; return; } # ensure this user isn't banned if (LJ::is_banned($remote, $cuserid)) { $body .= ""; return; } # and make sure they're not already a member if (LJ::is_friend($cuserid, $remote->{userid})) { $body .= ""; return; } # get the list of maintainers and their usernames my $dbr = LJ::get_db_reader(); my $admins = $dbr->selectcol_arrayref("SELECT u.user FROM useridmap u, reluser r ". "WHERE r.userid=$cuserid AND r.targetid=u.userid AND r.type='A'") || []; my $list = ""; # can't join closed communities if ($ci->{membership} eq 'closed') { $body .= " $list }) . " p?>"; return; } # now do the join if ($POST{confirm}) { # can members join this community openly? if ($ci->{membership} ne 'open') { # hit up the maintainers to let them know a join was requested LJ::comm_join_request($cu, $remote); $body .= ""; return; } # make remote user a friend of the community LJ::join_community($remote, $cu, $FORM{addfriend}); # success message $body .= " $ci->{user}, commname => $ecname}) . " p?>"; # if community permits it, tell the user they have access if ($ci->{postlevel} eq "members") { $body .= ""; } else { $body .= " $list }) . " p?>"; } } else { if ($ci->{membership} ne 'open') { $body .= " LJ::ljuser($cu) }) . "
p?>"; $body .= "
"; $body .= ""; $body .= ""; $body .= "
"; return; } $body .= " $ecname }); $body .= "
"; $body .= ""; $body .= "
"; $body .= ""; $body .= BML::ml('.label.addtofriends', { maintainer => $ecname }); $body .= "
p?>"; } return; _code?> body=> page?> link: htdocs/login.bml, htdocs/userinfo.bml post: htdocs/community/join.bml _c?>