X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FGroup.php;h=eb4008184f943d1242ba30663352e1896f75acf3;hb=459f28776d015f44e9a449363b190f8a0dada5d5;hp=268680a165b79cd7e90e5ae96c190764c7a9af11;hpb=8db0e090d7afc3fbfeaf7a587140c80c98233484;p=friendica.git diff --git a/src/Model/Group.php b/src/Model/Group.php index 268680a165..eb4008184f 100644 --- a/src/Model/Group.php +++ b/src/Model/Group.php @@ -1,6 +1,6 @@ $gid]); if (DBA::isResult($group) && $group['deleted']) { DBA::update('group', ['deleted' => 0], ['id' => $gid]); - notice(DI::l10n()->t('A deleted group with this name was revived. Existing item permissions may apply to this group and any future members. If this is not what you intended, please create another group with a different name.')); + DI::sysmsg()->addNotice(DI::l10n()->t('A deleted group with this name was revived. Existing item permissions may apply to this group and any future members. If this is not what you intended, please create another group with a different name.')); } return true; } @@ -138,25 +138,29 @@ class Group */ public static function getIdsByContactId(int $cid): array { - $return = []; + $contact = Contact::getById($cid, ['rel']); + if (!$contact) { + return []; + } + + $groupIds = []; $stmt = DBA::select('group_member', ['gid'], ['contact-id' => $cid]); while ($group = DBA::fetch($stmt)) { - $return[] = $group['gid']; + $groupIds[] = $group['gid']; } DBA::close($stmt); // Meta-groups - $contact = Contact::getById($cid, ['rel']); if ($contact['rel'] == Contact::FOLLOWER || $contact['rel'] == Contact::FRIEND) { - $return[] = self::FOLLOWERS; + $groupIds[] = self::FOLLOWERS; } if ($contact['rel'] == Contact::FRIEND) { - $return[] = self::MUTUALS; + $groupIds[] = self::MUTUALS; } - return $return; + return $groupIds; } /** @@ -183,8 +187,8 @@ class Group ) AS `count` FROM `group` WHERE `group`.`uid` = ?;", - local_user(), - local_user() + DI::userSession()->getLocalUserId(), + DI::userSession()->getLocalUserId() ); return DBA::toArray($stmt); @@ -522,7 +526,7 @@ class Group */ public static function sidebarWidget(string $every = 'contact', string $each = 'group', string $editmode = 'standard', $group_id = '', int $cid = 0) { - if (!local_user()) { + if (!DI::userSession()->getLocalUserId()) { return ''; } @@ -540,7 +544,7 @@ class Group $member_of = self::getIdsByContactId($cid); } - $stmt = DBA::select('group', [], ['deleted' => false, 'uid' => local_user(), 'cid' => null], ['order' => ['name']]); + $stmt = DBA::select('group', [], ['deleted' => false, 'uid' => DI::userSession()->getLocalUserId(), 'cid' => null], ['order' => ['name']]); while ($group = DBA::fetch($stmt)) { $selected = (($group_id == $group['id']) ? ' group-selected' : '');