("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 .= "
"; $body .= LJ::form_auth(); $body .= ""; $body .= "
"; if (%$trusted) { foreach my $endid (sort { $trusted->{$a} cmp $trusted->{$b} } keys %$trusted) { my $url = $trusted->{$endid}->{url}; my $dis_site = LJ::ehtml($url); $dis_site =~ s!\*\.!<anything>.!; $body .= LJ::html_submit("delete:$endid", "Delete") . " -- $dis_site
"; } } else { $body .= "(None)"; } $body .= "
"; $body .= ""; $body .= "<link rel=\"openid.server\" href=\"$LJ::OPENID_SERVER?ljuser=$u->{user}\" />"; $body .= "
"; if (@external) { foreach my $url (@external) { $body .= LJ::html_submit("extdelete:$url", "Delete") . " -- " . LJ::ehtml($url) . "
"; } } else { $body .= "(None)"; } $body .= "
"; $body .= "Add: " . LJ::html_text({ name => 'ext_url', size => 60 }) . " "; $body .= "
"; return; } _code?> body=> page?>