]> git.mxchange.org Git - friendica.git/blobdiff - mod/unfollow.php
Ops, one more left ...
[friendica.git] / mod / unfollow.php
index e92653360963cb101a95d83b7062cd36bfd861e8..5c00726e272bfb7224d577ce740eea9ae576217a 100644 (file)
@@ -5,6 +5,7 @@
 
 use Friendica\App;
 use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Model\Contact;
@@ -27,14 +28,14 @@ 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];
+                       $uid, Contact::FRIEND, normalise_link($url),
+                       normalise_link($url), $url, Protocol::STATUSNET];
        $contact = DBA::selectFirst('contact', [], $condition);
 
        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, NETWORK_DFRN])) {
+               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)
@@ -43,7 +44,7 @@ function unfollow_post(App $a)
                                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']);
@@ -66,8 +67,9 @@ 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];
+                       local_user(), Contact::FRIEND, normalise_link($url),
+                       normalise_link($url), $url, Protocol::STATUSNET];
+
        $contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
 
        if (!DBA::isResult($contact)) {
@@ -76,7 +78,7 @@ function unfollow_content(App $a)
                // NOTREACHED
        }
 
-       if (!in_array($contact['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_DFRN])) {
+       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