Exemple #1
0
function elggpg_delete_key($user)
{
    if (!$user->openpgp_publickey) {
        return false;
    }
    $count = elgg_get_entities_from_metadata(array('type' => 'user', 'metadata_name' => 'openpgp_publickey', 'metadata_value' => $user->openpgp_publickey, 'count' => true));
    if ($count > 1) {
        $user->openpgp_publickey = NULL;
        return true;
    }
    $gpg = new gnupg();
    $info = $gpg->deletekey($user->openpgp_publickey);
    $user->openpgp_publickey = NULL;
    return $info;
}