From 78f64c90a353606b0a46185d07e65359eebe99ad Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 31 Oct 2012 20:53:02 -0700 Subject: get permission discovery working - guid sigs were getting truncated in db --- mod/zfinger.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'mod') diff --git a/mod/zfinger.php b/mod/zfinger.php index 4e935b723..4c0e3b5fc 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -7,11 +7,12 @@ function zfinger_init(&$a) { $ret = array('success' => false); - $zguid = ((x($_REQUEST,'guid')) ? $_REQUEST['guid'] : ''); - $zaddr = ((x($_REQUEST,'address')) ? $_REQUEST['address'] : ''); - $ztarget = ((x($_REQUEST,'target')) ? $_REQUEST['target'] : ''); - $zsig = ((x($_REQUEST,'target_sig')) ? $_REQUEST['target_sig'] : ''); - + $zguid = ((x($_REQUEST,'guid')) ? $_REQUEST['guid'] : ''); + $zaddr = ((x($_REQUEST,'address')) ? $_REQUEST['address'] : ''); + $ztarget = ((x($_REQUEST,'target')) ? trim($_REQUEST['target']) : ''); + $zsig = ((x($_REQUEST,'target_sig')) ? trim($_REQUEST['target_sig']) : ''); + + $r = null; if(strlen($zguid)) { @@ -63,23 +64,28 @@ function zfinger_init(&$a) { $ret['photo_updated'] = $e['xchan_photo_date']; $ret['target'] = $ztarget; $ret['target_sig'] = $zsig; - $ret['permissions'] = map_perms($r[0],$ztarget,$zsig); + + $ret['permissions'] = get_all_perms($e['channel_id'],(($ztarget && $zsig) + ? base64url_encode(hash('whirlpool',$ztarget . $zsig,true)) + : '' ),false); + + // $ret['profile'] = $profile; // array of (verified) hubs this channel uses - $ret['hubs'] = array(); + $ret['locations'] = array(); $x = zot_get_hubloc(array($e['channel_hash'])); if($x && count($x)) { foreach($x as $hub) { if(! ($hub['hubloc_flags'] & HUBLOC_FLAGS_UNVERIFIED)) { - $ret['hubs'][] = array( + $ret['locations'][] = array( + 'host' => $hub['hubloc_host'], + 'address' => $hub['hubloc_addr'], 'primary' => (($hub['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) ? true : false), 'url' => $hub['hubloc_url'], 'url_sig' => $hub['hubloc_url_sig'], - 'host' => $hub['hubloc_host'], - 'address' => $hub['hubloc_addr'], 'callback' => $hub['hubloc_callback'], 'sitekey' => $hub['hubloc_sitekey'] ); -- cgit v1.2.3