aboutsummaryrefslogtreecommitdiffstats
path: root/include/follow.php
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2015-10-26 21:55:47 +0100
committermrjive <mrjive@mrjive.it>2015-10-26 21:55:47 +0100
commita4c3058f845a1c38d06b2201a10700c5f878366d (patch)
treebab86468397e523457ba25199cb9a67265980e00 /include/follow.php
parent32522b61f235266384c81c0669fceaf58afeb4fe (diff)
parent6cb7afcbc0447b60de0128f9a912e10ae125ba45 (diff)
downloadvolse-hubzilla-a4c3058f845a1c38d06b2201a10700c5f878366d.tar.gz
volse-hubzilla-a4c3058f845a1c38d06b2201a10700c5f878366d.tar.bz2
volse-hubzilla-a4c3058f845a1c38d06b2201a10700c5f878366d.zip
Merge pull request #7 from redmatrix/master
updating from original codebase
Diffstat (limited to 'include/follow.php')
-rw-r--r--include/follow.php28
1 files changed, 19 insertions, 9 deletions
diff --git a/include/follow.php b/include/follow.php
index 960138743..40ad2c299 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -133,27 +133,27 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
$their_perms = 0;
$xchan_hash = '';
+
$r = q("select * from xchan where xchan_hash = '%s' or xchan_url = '%s' limit 1",
dbesc($url),
dbesc($url)
);
+
if(! $r) {
// attempt network auto-discovery
if(strpos($url,'@') && (! $is_http)) {
- $r = discover_by_webbie($url);
+ $d = discover_by_webbie($url);
}
elseif($is_http) {
- $r = discover_by_url($url);
- $r['allowed'] = intval(get_config('system','feed_contacts'));
- }
- if($r) {
- $r['channel_id'] = $uid;
- call_hooks('follow_allow',$r);
- if(! $r['allowed']) {
+ if(get_config('system','feed_contacts'))
+ $d = discover_by_url($url);
+ else {
$result['message'] = t('Protocol disabled.');
return $result;
}
+ }
+ if($d) {
$r = q("select * from xchan where xchan_hash = '%s' or xchan_url = '%s' limit 1",
dbesc($url),
dbesc($url)
@@ -172,6 +172,16 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
return $result;
}
+ $x = array('channel_id' => $uid, 'follow_address' => $url, 'xchan' => $r[0], 'allowed' => 1);
+
+ call_hooks('follow_allow',$x);
+
+ if(! $x['allowed']) {
+ $result['message'] = t('Protocol disabled.');
+ return $result;
+ }
+
+
if((local_channel()) && $uid == local_channel()) {
$aid = get_account_id();
$hash = get_observer_hash();
@@ -251,7 +261,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
);
if($r) {
$result['abook'] = $r[0];
- proc_run('php', 'include/notifier.php', 'permission_update', $result['abook']['abook_id']);
+ proc_run('php', 'include/notifier.php', 'permission_create', $result['abook']['abook_id']);
}
$arr = array('channel_id' => $uid, 'abook' => $result['abook']);