use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
+use Friendica\Model\Group;
/**
* @brief Calculate the hash that is needed for the "Friendica" cookie
);
if (DBM::is_result($r)) {
$remote_verified = true;
- $groups = init_groups_visitor($remote_user);
+ $groups = Group::getIdsByContactId($remote_user);
}
}
);
if (DBM::is_result($r)) {
$remote_verified = true;
- $groups = init_groups_visitor($remote_user);
+ $groups = Group::getIdsByContactId($remote_user);
}
}
if ($remote_verified) {
killme();
}
}
-
-// Returns an array of group id's this contact is a member of.
-// This array will only contain group id's related to the uid of this
-// DFRN contact. They are *not* neccessarily unique across the entire site.
-
-
-if (! function_exists('init_groups_visitor')) {
-function init_groups_visitor($contact_id) {
- $groups = array();
- $r = q("SELECT `gid` FROM `group_member`
- WHERE `contact-id` = %d ",
- intval($contact_id)
- );
- if (DBM::is_result($r)) {
- foreach ($r as $rr)
- $groups[] = $rr['gid'];
- }
- return $groups;
-}}
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
require_once 'include/event.php';
require_once 'include/redir.php';
}
}
if($contact_id) {
- $groups = init_groups_visitor($contact_id);
+ $groups = Group::getIdsByContactId($contact_id);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
intval($a->profile['profile_uid'])
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
use Friendica\Protocol\DFRN;
function display_init(App $a) {
}
if ($contact_id) {
- $groups = init_groups_visitor($contact_id);
+ $groups = Group::getIdsByContactId($contact_id);
$r = dba::fetch_first("SELECT * FROM `contact` WHERE `id` = ? AND `uid` = ? LIMIT 1",
$contact_id,
$a->profile['uid']
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
use Friendica\Model\Photo;
use Friendica\Network\Probe;
use Friendica\Object\Image;
}
}
if ($contact_id) {
- $groups = init_groups_visitor($contact_id);
+ $groups = Group::getIdsByContactId($contact_id);
$r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
intval($owner_uid)
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
+use Friendica\Model\Group;
require_once('include/contact_widgets.php');
require_once('include/redir.php');
}
if ($contact_id) {
- $groups = init_groups_visitor($contact_id);
+ $groups = Group::getIdsByContactId($contact_id);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
intval($a->profile['profile_uid'])
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
require_once('include/items.php');
require_once('include/acl_selectors.php');
}
}
if($contact_id) {
- $groups = init_groups_visitor($contact_id);
+ $groups = Group::getIdsByContactId($contact_id);
$r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
intval($owner_uid)
* @param int $cid
* @return array
*/
- private static function getIdsByContactId($cid)
+ public static function getIdsByContactId($cid)
{
$condition = ['contact-id' => $cid];
$stmt = dba::select('group_member', ['gid'], $condition);
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
+use Friendica\Model\Group;
use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Object\Image;
$contact = $r[0];
include_once 'include/security.php';
- $groups = init_groups_visitor($contact['id']);
+ $groups = Group::getIdsByContactId($contact['id']);
if (count($groups)) {
for ($x = 0; $x < count($groups); $x ++)