]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
Check null for acl-fields
[friendica.git] / src / Model / Item.php
index 6a37a1cf86d53656023c8adc9bea1cb49cd2903e..e298cc1605288a57df3cf1794ce699167f0a9fda 100644 (file)
@@ -214,7 +214,7 @@ class Item extends BaseObject
                                $row['object'] = '';
                        }
                        if (array_key_exists('object-type', $row)) {
-                               $row['object-type'] = Activity::OBJ_NOTE;
+                               $row['object-type'] = Activity\ObjectType::NOTE;
                        }
                } elseif (array_key_exists('verb', $row) && in_array($row['verb'], ['', Activity::POST, Activity::SHARE])) {
                        // Posts don't have an object or target - but having tags or files.
@@ -1157,14 +1157,14 @@ class Item extends BaseObject
 
        private static function deleteTagsFromItem($item)
        {
-               if (($item["verb"] != Activity::TAG) || ($item["object-type"] != Activity::OBJ_TAGTERM)) {
+               if (($item["verb"] != Activity::TAG) || ($item["object-type"] != Activity\ObjectType::TAGTERM)) {
                        return;
                }
 
                $xo = XML::parseString($item["object"], false);
                $xt = XML::parseString($item["target"], false);
 
-               if ($xt->type != Activity::OBJ_NOTE) {
+               if ($xt->type != Activity\ObjectType::NOTE) {
                        return;
                }
 
@@ -2904,10 +2904,10 @@ class Item extends BaseObject
                /** @var ACLFormatter $aclFormater */
                $aclFormater = self::getClass(ACLFormatter::class);
 
-               $allow_people = $aclFormater->expand($obj['allow_cid']);
-               $allow_groups = Group::expand($obj['uid'], $aclFormater->expand($obj['allow_gid']), $check_dead);
-               $deny_people  = $aclFormater->expand($obj['deny_cid']);
-               $deny_groups  = Group::expand($obj['uid'], $aclFormater->expand($obj['deny_gid']), $check_dead);
+               $allow_people = $aclFormater->expand($obj['allow_cid'] ?? '');
+               $allow_groups = Group::expand($obj['uid'], $aclFormater->expand($obj['allow_gid'] ?? ''), $check_dead);
+               $deny_people  = $aclFormater->expand($obj['deny_cid'] ?? '');
+               $deny_groups  = Group::expand($obj['uid'], $aclFormater->expand($obj['deny_gid'] ?? ''), $check_dead);
                $recipients   = array_unique(array_merge($allow_people, $allow_groups));
                $deny         = array_unique(array_merge($deny_people, $deny_groups));
                $recipients   = array_diff($recipients, $deny);
@@ -3156,7 +3156,7 @@ class Item extends BaseObject
                        return true;
                }
 
-               $objtype = $item['resource-id'] ? Activity::OBJ_IMAGE : Activity::OBJ_NOTE;
+               $objtype = $item['resource-id'] ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE;
 
                $new_item = [
                        'guid'          => System::createUUID(),
@@ -3436,7 +3436,7 @@ class Item extends BaseObject
 
                // In order to provide theme developers more possibilities, event items
                // are treated differently.
-               if ($item['object-type'] === Activity::OBJ_EVENT && isset($item['event-id'])) {
+               if ($item['object-type'] === Activity\ObjectType::EVENT && isset($item['event-id'])) {
                        $ev = Event::getItemHTML($item);
                        return $ev;
                }