$v) { if($k !== 'author_signature' && $k !== 'parent_author_signature') $n[$k] = $v; } $s = implode($n,';'); logger('signing_string: ' . $s); return base64_encode(rsa_sign($s,$prvkey)); } function diaspora_verify_fields($fields,$sig,$pubkey) { if(! $fields) return false; $n = array(); foreach($fields as $k => $v) { if($k !== 'author_signature' && $k !== 'parent_author_signature') $n[$k] = $v; } $s = implode($n,';'); logger('signing_string: ' . $s); return rsa_verify($s,base64_decode($sig),$pubkey); } function diaspora_fields_to_xml($fields) { if(! $fields) return ''; $s = ''; foreach($fields as $k => $v) { $s .= '<' . $k . '>' . xmlify($v) . '' . "\n"; } return rtrim($s); } function diaspora_build_relay_tags() { $alltags = array(); $r = q("select * from pconfig where cat = 'diaspora' and k = 'followed_tags'"); if($r) { foreach($r as $rr) { if(preg_match('|^a:[0-9]+:{.*}$|s',$rr['v'])) { $x = unserialize($rr['v']); if($x && is_array($x)) $alltags = array_unique(array_merge($alltags,$x)); } } } set_config('diaspora','relay_tags',$alltags); // Now register to pick up any changes $url = "http://the-federation.info/register/" . App::get_hostname(); $ret = z_fetch_url($url); }