diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/contacts.php | 4 | ||||
-rw-r--r-- | mod/dfrn_confirm.php | 15 | ||||
-rw-r--r-- | mod/dfrn_request.php | 30 | ||||
-rw-r--r-- | mod/follow.php | 5 | ||||
-rw-r--r-- | mod/receive.php | 2 |
5 files changed, 33 insertions, 23 deletions
diff --git a/mod/contacts.php b/mod/contacts.php index f130b74c0..efb0dc75b 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -141,7 +141,7 @@ function contacts_content(&$a) { $cmd = $a->argv[2]; - $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", + $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 LIMIT 1", intval($contact_id), intval(local_user()) ); @@ -222,7 +222,7 @@ function contacts_content(&$a) { } - contact_remove($contact_id); + contact_remove($orig_record[0]['id']); info( t('Contact has been removed.') . EOL ); goaway($a->get_baseurl() . '/contacts'); return; // NOTREACHED diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 4088178c0..4dacb5d81 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -360,8 +360,14 @@ function dfrn_confirm_post(&$a,$handsfree = null) { } $new_relation = $contact['rel']; - if($network === NETWORK_DIASPORA && $duplex) - $new_relation = CONTACT_IS_FRIEND; + $writable = $contact['writable']; + + if($network === NETWORK_DIASPORA) { + if($duplex) + $new_relation = CONTACT_IS_FRIEND; + if($new_relation != CONTACT_IS_FOLLOWER) + $writable = 1; + } $r = q("DELETE FROM `intro` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($intro_id), @@ -380,6 +386,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) { `blocked` = 0, `pending` = 0, `network` = '%s', + `writable` = %d, `rel` = %d WHERE `id` = %d LIMIT 1 ", @@ -392,6 +399,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) { dbesc($notify), dbesc($poll), dbesc($network), + intval($writable), intval($new_relation), intval($contact_id) ); @@ -640,7 +648,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) { `blocked` = 0, `pending` = 0, `duplex` = %d, - `network` = 'dfrn' WHERE `id` = %d LIMIT 1 + `network` = '%s' WHERE `id` = %d LIMIT 1 ", dbesc($photos[0]), dbesc($photos[1]), @@ -650,6 +658,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) { dbesc(datetime_convert()), dbesc(datetime_convert()), intval($duplex), + dbesc(NETWORK_DFRN), intval($dfrn_record) ); if($r === false) { // indicates schema is messed up or total db failure diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 79070604b..98901e9f5 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -12,10 +12,6 @@ if(! function_exists('dfrn_request_init')) { function dfrn_request_init(&$a) { - if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { - return; - } - if($a->argc > 1) $which = $a->argv[1]; @@ -147,8 +143,8 @@ function dfrn_request_post(&$a) { */ $r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `name`, `nick`, `photo`, `site-pubkey`, - `request`, `confirm`, `notify`, `poll`, `aes_allow`) - VALUES ( %d, '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)", + `request`, `confirm`, `notify`, `poll`, `network`, `aes_allow`) + VALUES ( %d, '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)", intval(local_user()), datetime_convert(), dbesc($dfrn_url), @@ -160,6 +156,7 @@ function dfrn_request_post(&$a) { $parms['dfrn-confirm'], $parms['dfrn-notify'], $parms['dfrn-poll'], + dbesc(NETWORK_DFRN), intval($aes_allow) ); } @@ -298,7 +295,7 @@ function dfrn_request_post(&$a) { } - if($network === 'dfrn') { + if($network === NETWORK_DFRN) { $ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1", intval($uid), dbesc($url) @@ -373,8 +370,8 @@ function dfrn_request_post(&$a) { dbesc_array($parms); $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `name`, `nick`, `issued-id`, `photo`, `site-pubkey`, - `request`, `confirm`, `notify`, `poll` ) - VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )", + `request`, `confirm`, `notify`, `poll`, `network` ) + VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )", intval($uid), datetime_convert(), $parms['url'], @@ -386,7 +383,8 @@ function dfrn_request_post(&$a) { $parms['dfrn-request'], $parms['dfrn-confirm'], $parms['dfrn-notify'], - $parms['dfrn-poll'] + $parms['dfrn-poll'], + dbesc(NETWORK_DFRN) ); // find the contact record we just created @@ -437,15 +435,16 @@ function dfrn_request_post(&$a) { . (($aes_allow) ? "&aes_allow=1" : "") ); // NOTREACHED - // END $network === 'dfrn' + // END $network === NETWORK_DFRN } - elseif($network === 'stat') { + elseif($network === NETWORK_OSTATUS) { /** * * OStatus network * Check contact existence - * Try and scrape together enough information to create a contact record, with us as CONTACT_IS_FOLLOWER + * Try and scrape together enough information to create a contact record, + * with us as CONTACT_IS_FOLLOWER * Substitute our user's feed URL into $url template * Send the subscriber home to subscribe * @@ -454,7 +453,7 @@ function dfrn_request_post(&$a) { $url = str_replace('{uri}', $a->get_baseurl() . '/dfrn_poll/' . $nickname, $url); goaway($url); // NOTREACHED - // END $network === 'stat' + // END $network === NETWORK_OSTATUS } } return; @@ -466,8 +465,6 @@ function dfrn_request_post(&$a) { if(! function_exists('dfrn_request_content')) { function dfrn_request_content(&$a) { - - if(($a->argc != 2) || (! count($a->profile))) return ""; @@ -578,6 +575,7 @@ function dfrn_request_content(&$a) { ); } } + killme(); return; // NOTREACHED } diff --git a/mod/follow.php b/mod/follow.php index 14b2ea46c..009fe4e9a 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -190,11 +190,12 @@ function follow_post(&$a) { } if($contact['network'] == NETWORK_DIASPORA) { require_once('include/diaspora.php'); - $ret = diaspora_share($a->user,$r[0]); + $ret = diaspora_share($a->user,$contact); logger('mod_follow: diaspora_share returns: ' . $ret); } } - goaway($_SESSION['return_url']); + goaway($a->get_baseurl() . '/contacts/' . $contact_id); +// goaway($_SESSION['return_url']); // NOTREACHED } diff --git a/mod/receive.php b/mod/receive.php index 19c163967..c3738c143 100644 --- a/mod/receive.php +++ b/mod/receive.php @@ -15,6 +15,8 @@ function receive_post(&$a) { if($a->argc != 3 || $a->argv[1] !== 'users') http_status_exit(500); + logger('receive: raw input: ' . file_get_contents('php://input'), LOGGER_DATA); + $guid = $a->argv[2]; $r = q("SELECT * FROM `user` WHERE `guid` = '%s' LIMIT 1", |