X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fdfrn_confirm.php;h=18d9f25bf598c2a40b2fc938e46de4b4434808d0;hb=de4a2e6fd03cd0aab94a256eba92ed593931534b;hp=9c64c8c8838b3c7674f28389e130ecec81cbcd52;hpb=94f6f12ba3a5c1d506255803e709cb640147ebf4;p=friendica.git diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 9c64c8c883..18d9f25bf5 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -19,8 +19,14 @@ */ use Friendica\App; +use Friendica\Core\Config; +use Friendica\Core\PConfig; use Friendica\Core\System; +use Friendica\Core\Worker; +use Friendica\Database\DBM; use Friendica\Network\Probe; +use Friendica\Object\Contact; +use Friendica\Protocol\Diaspora; require_once 'include/enotify.php'; require_once 'include/group.php'; @@ -124,7 +130,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { intval($uid) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { logger('Contact not found in DB.'); notice( t('Contact not found.') . EOL ); notice( t('This may occasionally happen if contact was requested by both persons and it has already been approved.') . EOL ); @@ -248,7 +254,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { return; } - if(strlen($leading_junk) && get_config('system','debugging')) { + if(strlen($leading_junk) && Config::get('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. @@ -320,9 +326,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { * */ - require_once 'include/Photo.php'; - - update_contact_avatar($contact['photo'],$uid,$contact_id); + Contact::updateAvatar($contact['photo'], $uid, $contact_id); logger('dfrn_confirm: confirm - imported photos'); @@ -352,8 +356,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { dbesc(NETWORK_DFRN), intval($contact_id) ); - } - else { + } else { // $network !== NETWORK_DFRN @@ -361,18 +364,16 @@ function dfrn_confirm_post(App $a, $handsfree = null) { $notify = (($contact['notify']) ? $contact['notify'] : ''); $poll = (($contact['poll']) ? $contact['poll'] : ''); - if((! $contact['notify']) || (! $contact['poll'])) { - $arr = Probe::lrdd($contact['url']); - if(count($arr)) { - foreach($arr as $link) { - if($link['@attributes']['rel'] === 'salmon') - $notify = $link['@attributes']['href']; - if($link['@attributes']['rel'] === NAMESPACE_FEED) - $poll = $link['@attributes']['href']; - } - } + $arr = Probe::uri($contact['url']); + if (empty($contact['notify'])) { + $notify = $arr['notify']; + } + if (empty($contact['poll'])) { + $poll = $arr['poll']; } + $addr = $arr['addr']; + $new_relation = $contact['rel']; $writable = $contact['writable']; @@ -394,6 +395,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { $r = q("UPDATE `contact` SET `name-date` = '%s', `uri-date` = '%s', + `addr` = '%s', `notify` = '%s', `poll` = '%s', `blocked` = 0, @@ -406,6 +408,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { ", dbesc(datetime_convert()), dbesc(datetime_convert()), + dbesc($addr), dbesc($notify), dbesc($poll), dbesc($network), @@ -416,7 +419,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { ); } - /// @TODO is dbm::is_result() working here? + /// @TODO is DBM::is_result() working here? if ($r === false) { notice( t('Unable to set contact photo.') . EOL); } @@ -426,7 +429,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", intval($contact_id) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $contact = $r[0]; } else { $contact = null; @@ -436,8 +439,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { if ((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) { if (($contact) && ($contact['network'] === NETWORK_DIASPORA)) { - require_once 'include/diaspora.php'; - $ret = Diaspora::send_share($user[0],$r[0]); + $ret = Diaspora::sendShare($user[0],$r[0]); logger('share returns: ' . $ret); } @@ -447,7 +449,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { 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'; @@ -495,7 +497,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { $i = item_store($arr); if($i) - proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i); + Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i); } } } @@ -558,7 +560,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1", dbesc($node)); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { $message = sprintf(t('No user record found for \'%s\' '), $node); xml_status(3,$message); // failure // NOTREACHED @@ -589,7 +591,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { dbesc($decrypted_source_url), intval($local_uid) ); - if (!dbm::is_result($ret)) { + if (!DBM::is_result($ret)) { if (strstr($decrypted_source_url,'http:')) { $newurl = str_replace('http:','https:',$decrypted_source_url); } else { @@ -600,7 +602,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { dbesc($newurl), intval($local_uid) ); - if (!dbm::is_result($ret)) { + if (!DBM::is_result($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); @@ -635,7 +637,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { $r = q("SELECT * FROM `contact` WHERE `dfrn-id` = '%s' LIMIT 1", dbesc($decrypted_dfrn_id) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $message = t('The ID provided by your system is a duplicate on our system. It should work if you try again.'); xml_status(1,$message); // Birthday paradox - duplicate dfrn-id // NOTREACHED @@ -646,7 +648,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { dbesc($dfrn_pubkey), intval($dfrn_record) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { $message = t('Unable to set your contact credentials on our system.'); xml_status(3,$message); } @@ -667,15 +669,13 @@ function dfrn_confirm_post(App $a, $handsfree = null) { $r = q("SELECT `photo` FROM `contact` WHERE `id` = %d LIMIT 1", intval($dfrn_record)); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $photo = $r[0]['photo']; } else { $photo = System::baseUrl() . '/images/person-175.jpg'; } - require_once 'include/Photo.php'; - - update_contact_avatar($photo,$local_uid,$dfrn_record); + Contact::updateAvatar($photo,$local_uid,$dfrn_record); logger('dfrn_confirm: request - photos imported'); @@ -723,10 +723,10 @@ function dfrn_confirm_post(App $a, $handsfree = null) { intval($dfrn_record) ); - if (dbm::is_result($r)) + 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, @@ -746,12 +746,12 @@ function dfrn_confirm_post(App $a, $handsfree = null) { // Send a new friend post if we are allowed to... - if($page && intval(get_pconfig($local_uid,'system','post_joingroup'))) { + if($page && intval(PConfig::get($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'; @@ -797,7 +797,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { $i = item_store($arr); if($i) - proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i); + Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i); } }