get_user_by_uid($router->vars['username']);
} catch(UserNotFoundException $e) {
require('views/error404.php');
die;
}
$pubkeys = $user->list_public_keys();
if(isset($router->vars['format']) && $router->vars['format'] == 'txt') {
$page = new PageSection('entity_pubkeys_txt');
$page->set('pubkeys', $pubkeys);
header('Content-type: text/plain; charset=utf-8');
echo $page->generate();
} elseif(isset($router->vars['format']) && $router->vars['format'] == 'json') {
$page = new PageSection('entity_pubkeys_json');
$page->set('pubkeys', $pubkeys);
header('Content-type: application/json; charset=utf-8');
echo $page->generate();
} else {
$content = new PageSection('user_pubkeys');
$content->set('user', $user);
$content->set('pubkeys', $pubkeys);
$content->set('admin', $active_user->admin);
$head = ''."\n";
$head .= ''."\n";
$page = new PageSection('base');
$page->set('title', 'Public keys for '.$user->name);
$page->set('head', $head);
$page->set('content', $content);
$page->set('alerts', $active_user->pop_alerts());
echo $page->generate();
}