Beta Test Page body<= {'userid'}, "P"); if (LJ::did_post()) { my $u; if ($POST{fb_on} || $POST{pb_off}) { return "Not allowed." unless $is_admin; $u = LJ::load_user($POST{fbbeta}); $betatext = "
No such user $POST{fbbeta}.
" unless $u; $capname = '_fbbeta'; if ($u && $POST{fb_on}) { $set = 1; $betatext = "" . LJ::ljuser($u) . " is now in the beta."; } elsif ($u && $POST{fb_off}) { $set = 0; $betatext = "
" . LJ::ljuser($u) . " is no longer in the beta.";
}
} else {
$capname = '_betatest';
if ($POST{'no'}) {
BML::set_cookie("betatest", "", undef, $LJ::COOKIE_PATH, $LJ::COOKIE_DOMAIN);
$set = 0;
}
if ($POST{'yes'}) {
BML::set_cookie("betatest", "1", time()+60*60*24, $LJ::COOKIE_PATH, $LJ::COOKIE_DOMAIN);
$set = 1;
}
$u = $remote;
}
# now set any sort of cap needed
if (defined $set) {
return "No such user to set cap for." unless $u;
my @cap = grep { $LJ::CAP{$_}->{'_name'} eq $capname } keys %LJ::CAP;
if ($u && scalar @cap == 1) {
my $capnum = $cap[0]+0;
if ($set) {
LJ::update_user($u, { raw => "caps=caps|(1<<$capnum)" });
return "Beta-test mode is now ON.";
} else {
LJ::update_user($u, { raw => "caps=caps&~(1<<$capnum)" });
return "Beta-test mode is now off.";
}
}
}
}
my $ret = < ";
return $ret;
}
_code?>
<=body
page?>
EOF
if ($is_admin) {
$ret .= <