X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Funfollow.php;h=5c00726e272bfb7224d577ce740eea9ae576217a;hb=070e1e73d60295e616314c952199fd4b0b209f2d;hp=8caf94245f33776f58710e46a221e7e970c0a0fc;hpb=407b2397cbb25a1de9252f16279dfdd786ffade1;p=friendica.git diff --git a/mod/unfollow.php b/mod/unfollow.php index 8caf94245f..5c00726e27 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -2,10 +2,12 @@ /** * @file mod/unfollow.php */ + use Friendica\App; use Friendica\Core\L10n; +use Friendica\Core\Protocol; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Profile; @@ -26,23 +28,23 @@ function unfollow_post(App $a) $return_url = $_SESSION['return_url']; $condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?", - $uid, CONTACT_IS_FRIEND, normalise_link($url), - normalise_link($url), $url, NETWORK_STATUSNET]; - $contact = dba::selectFirst('contact', [], $condition); + $uid, Contact::FRIEND, normalise_link($url), + normalise_link($url), $url, Protocol::STATUSNET]; + $contact = DBA::selectFirst('contact', [], $condition); - if (!DBM::is_result($contact)) { + if (!DBA::isResult($contact)) { notice(L10n::t("Contact wasn't found or can't be unfollowed.")); } else { - if (in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA])) { + if (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN])) { $r = q("SELECT `contact`.*, `user`.* FROM `contact` INNER JOIN `user` ON `contact`.`uid` = `user`.`uid` WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1", intval($uid) ); - if (DBM::is_result($r)) { + if (DBA::isResult($r)) { Contact::terminateFriendship($r[0], $contact); } } - dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]); + DBA::update('contact', ['rel' => Contact::FOLLOWER], ['id' => $contact['id']]); info(L10n::t('Contact unfollowed').EOL); goaway(System::baseUrl().'/contacts/'.$contact['id']); @@ -65,17 +67,18 @@ function unfollow_content(App $a) $submit = L10n::t('Submit Request'); $condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?", - local_user(), CONTACT_IS_FRIEND, normalise_link($url), - normalise_link($url), $url, NETWORK_STATUSNET]; - $contact = dba::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition); + local_user(), Contact::FRIEND, normalise_link($url), + normalise_link($url), $url, Protocol::STATUSNET]; + + $contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition); - if (!DBM::is_result($contact)) { + if (!DBA::isResult($contact)) { notice(L10n::t("You aren't a friend of this contact.").EOL); $submit = ""; // NOTREACHED } - if (!in_array($contact['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS])) { + if (!in_array($contact['network'], [Protocol::DIASPORA, Protocol::OSTATUS, Protocol::DFRN])) { notice(L10n::t("Unfollowing is currently not supported by your network.").EOL); $submit = ""; // NOTREACHED @@ -118,7 +121,7 @@ function unfollow_content(App $a) '$nickname' => "", '$name' => $contact["name"], '$url' => $contact["url"], - '$zrl' => Profile::zrl($contact["url"]), + '$zrl' => Contact::magicLink($contact["url"]), '$url_label' => L10n::t("Profile URL"), '$myaddr' => $myaddr, '$request' => $request,