Last active
December 14, 2015 13:08
-
-
Save duritong/5091038 to your computer and use it in GitHub Desktop.
fetch pgp keys from horde_prefs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function pgp_key($address, $keyid) | |
{ | |
$db = $GLOBALS['injector']->getInstance('Horde_Db_Adapter'); | |
$query = "SELECT pref_value FROM horde_prefs WHERE pref_name = 'pgp_public_key' AND pref_value <> '' AND pref_uid = ?"; | |
try { | |
$result = $db->selectOne($query,array($address)); | |
$columns = $db->columns('horde_prefs'); | |
if (!empty($result)) { | |
$key = $columns['pref_value']->binaryToString($result['pref_value']); | |
return $key; | |
} else { | |
return; | |
} | |
} catch (Imp_Exception $e) { | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment