<?page
title=><?_ml .title _ml?>
head<=

<style type="text/css">

    .key
    {
        background-color:#efefef;
        border:3px solid #dedede;
        padding:10px;
    }

</style>

<=head
body<=
<?_code
{
    use strict;
    use vars qw(%GET $user $u $ret);

    return $ML{'.error.notconfigured'} unless $LJ::USE_PGP;
    return LJ::server_down_html() if $LJ::SERVER_DOWN;

    $user = LJ::canonical_username($GET{user});
    $u = $user ? LJ::load_user($user) : LJ::get_remote();
    return $ML{'.error.nousername'} unless $user || $u;

    LJ::load_user_props($u, 'public_key');
   
    if ($u->{public_key}) {
        $ret .= '<?p ' . BML::ml('.label', { user => LJ::ljuser($u->{user})}) . ' p?>';
        $ret .= "<table border=0><tr><td class=key><pre>\n";
        $ret .= LJ::ehtml($u->{public_key});
        $ret .= "\n</pre></td></tr></table>";
    } else {
        $ret .= '<?p ' . BML::ml('.nokey', { user => LJ::ljuser($u->{user})}) . ' p?>';
    }
    $ret .= "<br /><?h1 $ML{'.info.head'} h1?>";
    $ret .= "<?p ";
    $ret .= BML::ml('.info.desc', {
        aoptspgp => 'href="http://www.pgp.com/"',
        aoptsgpg => 'href="http://www.gnupg.org/"',
    });
    $ret .= " p?> <?p ";
    $ret .= BML::ml('.info.upload', {
        aopts => 'href="/manage/pubkey.bml"',
    });
    $ret .= " p?>";
    return $ret;

} _code?>
<=body
page?>
