starting on pinging the basic elements of federation and communication
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
functino vcard_from_xchan($xchan) {
|
||||
function vcard_from_xchan($xchan) {
|
||||
return replace_macros(get_markup_template('xchan_vcard.tpl'),array(
|
||||
$name => $abook['xchan_name'],
|
||||
$photo => $abook['xchan_photo_l']
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
function follow_widget() {
|
||||
|
||||
return replace_macros(get_markup_template('follow.tpl'),array(
|
||||
'$connect' => t('Add New Contact'),
|
||||
'$desc' => t('Enter address or web location'),
|
||||
'$connect' => t('Add New Channel'),
|
||||
'$desc' => t('Enter webbie (channel location)'),
|
||||
'$hint' => t('Example: [email protected], http://example.com/barbara'),
|
||||
'$follow' => t('Connect')
|
||||
));
|
||||
|
||||
+7
-10
@@ -2,13 +2,11 @@
|
||||
|
||||
|
||||
//
|
||||
// Takes a $uid and a url/handle and adds a new contact
|
||||
// Currently if the contact is DFRN, interactive needs to be true, to redirect to the
|
||||
// dfrn_request page.
|
||||
// Takes a $uid and a url/handle and adds a new channel
|
||||
|
||||
// Otherwise this can be used to bulk add statusnet contacts, twitter contacts, etc.
|
||||
// Returns an array
|
||||
// $return['success'] boolean true if successful
|
||||
// $return['abook_id'] Address book ID if successful
|
||||
// $return['message'] error text if success is false.
|
||||
|
||||
|
||||
@@ -19,10 +17,6 @@ function new_contact($uid,$url,$interactive = false) {
|
||||
|
||||
$a = get_app();
|
||||
|
||||
// remove ajax junk, e.g. Twitter
|
||||
|
||||
$url = str_replace('/#!/','/',$url);
|
||||
|
||||
if(! allowed_url($url)) {
|
||||
$result['message'] = t('Disallowed profile URL.');
|
||||
return $result;
|
||||
@@ -33,14 +27,17 @@ function new_contact($uid,$url,$interactive = false) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$arr = array('url' => $url, 'contact' => array());
|
||||
$arr = array('url' => $url, 'channel' => array());
|
||||
|
||||
call_hooks('follow', $arr);
|
||||
|
||||
if(x($arr['contact'],'name'))
|
||||
$ret = $arr['contact'];
|
||||
else
|
||||
$ret = probe_url($url);
|
||||
$ret = zot_probe_url($url);
|
||||
|
||||
|
||||
|
||||
|
||||
if($ret['network'] === NETWORK_DFRN) {
|
||||
if($interactive) {
|
||||
|
||||
+12
-3
@@ -89,18 +89,27 @@ function create_identity($arr) {
|
||||
|
||||
set_default_login_identity($arr['account_id'],$ret['channel']['channel_id'],false);
|
||||
|
||||
// Ensure that there is a host keypair.
|
||||
|
||||
if((! get_config('system','pubkey')) && (! get_config('system','prvkey'))) {
|
||||
$hostkey = new_keypair(4096);
|
||||
set_config('system','pubkey',$hostkey['pubkey']);
|
||||
set_config('system','prvkey',$hostkey['prvkey']);
|
||||
}
|
||||
|
||||
|
||||
// Create a verified hub location pointing to this site.
|
||||
|
||||
$r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_flags,
|
||||
hubloc_url, hubloc_url_sig, hubloc_callback, hubloc_sitekey )
|
||||
values ( '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
|
||||
hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey )
|
||||
values ( '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s' )",
|
||||
dbesc($guid),
|
||||
dbesc($sig),
|
||||
dbesc($hash),
|
||||
intval(($primary) ? HUBLOC_FLAGS_PRIMARY : 0),
|
||||
dbesc(z_root()),
|
||||
dbesc(base64url_encode(rsa_sign(z_root(),$ret['channel']['channel_prvkey']))),
|
||||
dbesc(get_app()->get_hostname()),
|
||||
dbesc(z_root() . '/post'),
|
||||
dbesc(get_config('system','pubkey'))
|
||||
);
|
||||
@@ -118,7 +127,7 @@ function create_identity($arr) {
|
||||
dbesc($a->get_baseurl() . "/photo/profile/l/{$newuid}"),
|
||||
dbesc($a->get_baseurl() . "/photo/profile/m/{$newuid}"),
|
||||
dbesc($a->get_baseurl() . "/photo/profile/s/{$newuid}"),
|
||||
dbesc($ret['channel']['channel_address'] . '@' . $a->get_hostname()),
|
||||
dbesc($ret['channel']['channel_address'] . '@' . get_app()->get_hostname()),
|
||||
dbesc(z_root() . '/channel/' . $ret['channel']['channel_address']),
|
||||
dbesc($ret['channel']['channel_name']),
|
||||
dbesc('zot'),
|
||||
|
||||
Reference in New Issue
Block a user