("OpenID server support is disabled") unless LJ::OpenID::server_enabled(); my $u = LJ::get_remote() or return $err->("You need to be logged in to manage your OpenID options."); my $dbh = LJ::get_db_writer(); my $trusted = {}; my @external; my $load_trusted = sub { $trusted = $dbh->selectall_hashref("SELECT ye.endpoint_id as 'endid', ye.url FROM openid_endpoint ye, openid_trust yt WHERE yt.endpoint_id=ye.endpoint_id AND yt.userid=$u->{userid}", 'endid'); }; my $load_external = sub { @external = @{ $dbh->selectcol_arrayref("SELECT url FROM openid_external WHERE userid=?", undef, $u->{userid}) }; }; if (LJ::did_post()) { return $err->("Possible form tampering detected.") unless LJ::check_form_auth(); my $dur; $body = ""; $load_trusted->(); foreach my $endid (sort { $trusted->{$a} cmp $trusted->{$b} } keys %$trusted) { next unless $POST{"delete:$endid"}; $dbh->do("DELETE FROM openid_trust WHERE userid=? AND endpoint_id=?", undef, $u->{userid}, $endid); } $load_external->(); foreach my $url (@external) { next unless $POST{"extdelete:$url"}; $dbh->do("DELETE FROM openid_external WHERE userid=? AND url=?", undef, $u->{userid}, $url); } if ($POST{'ext_url'} =~ m!^http://!) { $dbh->do("REPLACE INTO openid_external (userid, url) VALUES (?,?)", undef, $u->{userid}, $POST{'ext_url'}); } } $load_trusted->(); $load_external->(); $title = "OpenID Options"; $body = ""; $body .= "
"; return; } _code?> body=> page?>