]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/APContact.php
Code standards
[friendica.git] / src / Model / APContact.php
index 5f47313dc8d86f382c26ee633ec1f253b766f76e..71f3cfae47bac438192582cc77ef8605d84c35b7 100644 (file)
@@ -137,7 +137,7 @@ class APContact extends BaseObject
                $apcontact['about'] = HTML::toBBCode(JsonLD::fetchElement($compacted, 'as:summary'));
 
                $apcontact['photo'] = JsonLD::fetchElement($compacted, 'as:icon', '@id');
-               if (is_array($apcontact['photo'])) {
+               if (is_array($apcontact['photo']) || !empty($compacted['as:icon']['as:url']['@id'])) {
                        $apcontact['photo'] = JsonLD::fetchElement($compacted['as:icon'], 'as:url', '@id');
                }
 
@@ -157,8 +157,9 @@ class APContact extends BaseObject
 
                $apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted, 'w3id:publicKey', 'w3id:publicKeyPem'));
 
+               $apcontact['manually-approve'] = (int)JsonLD::fetchElement($compacted, 'as:manuallyApprovesFollowers');
+
                // To-Do
-               // manuallyApprovesFollowers
 
                // Unhandled
                // @context, tag, attachment, image, nomadicLocations, signature, following, followers, featured, movedTo, liked
@@ -197,10 +198,14 @@ class APContact extends BaseObject
                        if (is_int($contact_type)) {
                                $contact_fields['contact-type'] = $contact_type;
 
-                               // Resetting the 'forum' and 'prv' field when it isn't a forum
                                if ($contact_fields['contact-type'] != Contact::ACCOUNT_TYPE_COMMUNITY) {
+                                       // Resetting the 'forum' and 'prv' field when it isn't a forum
                                        $contact_fields['forum'] = false;
                                        $contact_fields['prv'] = false;
+                               } else {
+                                       // Otherwise set the corresponding forum type
+                                       $contact_fields['forum'] = !$apcontact['manually-approve'];
+                                       $contact_fields['prv'] = $apcontact['manually-approve'];
                                }
                        }
                }