function dfrn_confirm_post(App $a, $handsfree = null) {
- if (is_array($handsfree)) {
+ if(is_array($handsfree)) {
/*
* We were called directly from dfrn_request due to automatic friend acceptance.
}
else {
- if ($a->argc > 1)
+ if($a->argc > 1)
$node = $a->argv[1];
}
*
*/
- if (! x($_POST,'source_url')) {
+ if(! x($_POST,'source_url')) {
$uid = ((is_array($handsfree)) ? $handsfree['uid'] : local_user());
- if (! $uid) {
+ if(! $uid) {
notice( t('Permission denied.') . EOL );
return;
}
intval($uid)
);
- if (! $user) {
+ if(! $user) {
notice( t('Profile not found.') . EOL );
return;
}
// These data elements may come from either the friend request notification form or $handsfree array.
- if (is_array($handsfree)) {
+ if(is_array($handsfree)) {
logger('Confirm in handsfree mode');
$dfrn_id = $handsfree['dfrn_id'];
$intro_id = $handsfree['intro_id'];
*
*/
- if (strlen($dfrn_id))
+ if(strlen($dfrn_id))
$cid = 0;
logger('Confirming request for dfrn_id (issued) ' . $dfrn_id);
- if ($cid)
+ if($cid)
logger('Confirming follower with contact_id: ' . $cid);
$network = ((strlen($contact['issued-id'])) ? NETWORK_DFRN : NETWORK_OSTATUS);
- if ($contact['network'])
+ if($contact['network'])
$network = $contact['network'];
- if ($network === NETWORK_DFRN) {
+ if($network === NETWORK_DFRN) {
/*
*
openssl_public_encrypt($my_url, $params['source_url'], $site_pubkey);
$params['source_url'] = bin2hex($params['source_url']);
- if ($aes_allow && function_exists('openssl_encrypt')) {
+ if($aes_allow && function_exists('openssl_encrypt')) {
openssl_public_encrypt($src_aes_key, $params['aes_key'], $site_pubkey);
$params['aes_key'] = bin2hex($params['aes_key']);
$params['public_key'] = bin2hex(openssl_encrypt($public_key,'AES-256-CBC',$src_aes_key));
}
$params['dfrn_version'] = DFRN_PROTOCOL_VERSION ;
- if ($duplex == 1)
+ if($duplex == 1)
$params['duplex'] = 1;
- if ($user[0]['page-flags'] == PAGE_COMMUNITY)
+ if($user[0]['page-flags'] == PAGE_COMMUNITY)
$params['page'] = 1;
- if ($user[0]['page-flags'] == PAGE_PRVGROUP)
+ if($user[0]['page-flags'] == PAGE_PRVGROUP)
$params['page'] = 2;
logger('Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params,true), LOGGER_DATA);
$leading_junk = substr($res,0,strpos($res,'<?xml'));
$res = substr($res,strpos($res,'<?xml'));
- if (! strlen($res)) {
+ if(! strlen($res)) {
// No XML at all, this exchange is messed up really bad.
// We shouldn't proceed, because the xml parser might choke,
return;
}
- if (strlen($leading_junk) && get_config('system','debugging')) {
+ if(strlen($leading_junk) && get_config('system','debugging')) {
// This might be more common. Mixed error text and some XML.
// If we're configured for debugging, show the text. Proceed in either case.
notice( t('Unexpected response from remote site: ') . EOL . $leading_junk . EOL );
}
- if (stristr($res, "<status")===false) {
+ if(stristr($res, "<status")===false) {
// wrong xml! stop here!
notice( t('Unexpected response from remote site: ') . EOL . htmlspecialchars($res) . EOL );
return;
switch($status) {
case 0:
info( t("Confirmation completed successfully.") . EOL);
- if (strlen($message))
+ if(strlen($message))
notice( t('Remote site reported: ') . $message . EOL);
break;
case 1:
case 2:
notice( t("Temporary failure. Please wait and try again.") . EOL);
- if (strlen($message))
+ if(strlen($message))
notice( t('Remote site reported: ') . $message . EOL);
break;
case 3:
notice( t("Introduction failed or was revoked.") . EOL);
- if (strlen($message))
+ if(strlen($message))
notice( t('Remote site reported: ') . $message . EOL);
break;
}
- if (($status == 0) && ($intro_id)) {
+ if(($status == 0) && ($intro_id)) {
// Success. Delete the notification.
}
- if ($status != 0)
+ if($status != 0)
return;
}
logger('dfrn_confirm: confirm - imported photos');
- if ($network === NETWORK_DFRN) {
+ if($network === NETWORK_DFRN) {
$new_relation = CONTACT_IS_FOLLOWER;
- if (($relation == CONTACT_IS_SHARING) || ($duplex))
+ if(($relation == CONTACT_IS_SHARING) || ($duplex))
$new_relation = CONTACT_IS_FRIEND;
- if (($relation == CONTACT_IS_SHARING) && ($duplex))
+ if(($relation == CONTACT_IS_SHARING) && ($duplex))
$duplex = 0;
$r = q("UPDATE `contact` SET `rel` = %d,
dbesc(NETWORK_DFRN),
intval($contact_id)
);
- } else {
+ }
+ else {
// $network !== NETWORK_DFRN
$notify = (($contact['notify']) ? $contact['notify'] : '');
$poll = (($contact['poll']) ? $contact['poll'] : '');
- if ((! $contact['notify']) || (! $contact['poll'])) {
+ if((! $contact['notify']) || (! $contact['poll'])) {
$arr = Probe::lrdd($contact['url']);
- if (count($arr)) {
- foreach ($arr as $link) {
- if ($link['@attributes']['rel'] === 'salmon')
+ if(count($arr)) {
+ foreach($arr as $link) {
+ if($link['@attributes']['rel'] === 'salmon')
$notify = $link['@attributes']['href'];
- if ($link['@attributes']['rel'] === NAMESPACE_FEED)
+ if($link['@attributes']['rel'] === NAMESPACE_FEED)
$poll = $link['@attributes']['href'];
}
}
$new_relation = $contact['rel'];
$writable = $contact['writable'];
- if ($network === NETWORK_DIASPORA) {
- if ($duplex)
+ if($network === NETWORK_DIASPORA) {
+ if($duplex)
$new_relation = CONTACT_IS_FRIEND;
else
$new_relation = CONTACT_IS_FOLLOWER;
- if ($new_relation != CONTACT_IS_FOLLOWER)
+ if($new_relation != CONTACT_IS_FOLLOWER)
$writable = 1;
}
intval($uid)
);
- if ((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) {
+ if((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) {
require_once('include/items.php');
intval($uid)
);
- if (count($self)) {
+ if(count($self)) {
$arr = array();
$arr['guid'] = get_guid(32);
$arr['deny_gid'] = $user[0]['deny_gid'];
$i = item_store($arr);
- if ($i)
+ if($i)
proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
}
}
}
$def_gid = get_default_group($uid, $contact["network"]);
- if ($contact && intval($def_gid))
+ if($contact && intval($def_gid))
group_add_member($uid, '', $contact['id'], $def_gid);
// Let's send our user to the contact editor in case they want to
$local_uid = $r[0]['uid'];
- if (! strstr($my_prvkey,'PRIVATE KEY')) {
+ if(! strstr($my_prvkey,'PRIVATE KEY')) {
$message = t('Our site encryption key is apparently messed up.');
xml_status(3,$message);
}
openssl_private_decrypt($source_url,$decrypted_source_url,$my_prvkey);
- if (! strlen($decrypted_source_url)) {
+ if(! strlen($decrypted_source_url)) {
$message = t('Empty site URL was provided or URL could not be decrypted by us.');
xml_status(3,$message);
// NOTREACHED
dbesc($decrypted_source_url),
intval($local_uid)
);
- if (!dbm::is_result($ret)) {
- if (strstr($decrypted_source_url,'http:')) {
+ if(! count($ret)) {
+ if(strstr($decrypted_source_url,'http:'))
$newurl = str_replace('http:','https:',$decrypted_source_url);
- } else {
+ else
$newurl = str_replace('https:','http:',$decrypted_source_url);
- }
$ret = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newurl),
intval($local_uid)
);
- if (!dbm::is_result($ret)) {
+ if(! count($ret)) {
// this is either a bogus confirmation (?) or we deleted the original introduction.
$message = t('Contact record was not found for you on our site.');
xml_status(3,$message);
$foreign_pubkey = $ret[0]['site-pubkey'];
$dfrn_record = $ret[0]['id'];
- if (! $foreign_pubkey) {
+ if(! $foreign_pubkey) {
$message = sprintf( t('Site public key not available in contact record for URL %s.'), $newurl);
xml_status(3,$message);
}
$decrypted_dfrn_id = "";
openssl_public_decrypt($dfrn_id,$decrypted_dfrn_id,$foreign_pubkey);
- if (strlen($aes_key)) {
+ if(strlen($aes_key)) {
$decrypted_aes_key = "";
openssl_private_decrypt($aes_key,$decrypted_aes_key,$my_prvkey);
$dfrn_pubkey = openssl_decrypt($public_key,'AES-256-CBC',$decrypted_aes_key);
// It's possible that the other person also requested friendship.
// If it is a duplex relationship, ditch the issued-id if one exists.
- if ($duplex) {
+ if($duplex) {
$r = q("UPDATE `contact` SET `issued-id` = '' WHERE `id` = %d",
intval($dfrn_record)
);
if (dbm::is_result($r))
$combined = $r[0];
- if ((dbm::is_result($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
+ if((dbm::is_result($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
$mutual = ($new_relation == CONTACT_IS_FRIEND);
notification(array(
'type' => NOTIFY_CONFIRM,
// Send a new friend post if we are allowed to...
- if ($page && intval(get_pconfig($local_uid,'system','post_joingroup'))) {
+ if($page && intval(get_pconfig($local_uid,'system','post_joingroup'))) {
$r = q("SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
intval($local_uid)
);
- if ((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0)) {
+ if((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0)) {
require_once('include/items.php');
intval($local_uid)
);
- if (dbm::is_result($self)) {
+ if(count($self)) {
$arr = array();
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $local_uid);
$arr['deny_gid'] = $user[0]['deny_gid'];
$i = item_store($arr);
- if ($i) {
+ if($i)
proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
- }
}
}