aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php2
-rw-r--r--include/contact_widgets.php4
-rw-r--r--include/follow.php17
-rw-r--r--include/identity.php15
4 files changed, 22 insertions, 16 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 485afa3ba..a7da29b35 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -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']
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index ebefa1c23..9054fc3f4 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -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: bob@example.com, http://example.com/barbara'),
'$follow' => t('Connect')
));
diff --git a/include/follow.php b/include/follow.php
index 55b83820c..4c835c8a7 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -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) {
diff --git a/include/identity.php b/include/identity.php
index 7b0b86ee4..e05aaba30 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -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'),