use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
use Friendica\Model\Photo;
use Friendica\Model\User;
use Friendica\Network\FKOAuth1;
// loop through all groups and retrieve all members for adding data in the user array
foreach ($r as $rr) {
- $members = group_get_members($rr['id']);
+ $members = Contact::getByGroupId($rr['id']);
$users = array();
if ($type == "xml") {
}
// delete group
- $ret = group_rmv($uid, $name);
+ $ret = Group::removeByName($uid, $name);
if ($ret) {
// return success
$success = array('success' => $ret, 'gid' => $gid, 'name' => $name, 'status' => 'deleted', 'wrong users' => array());
$reactivate_group = true;
// create group
- $ret = group_add($uid, $name);
+ $ret = Group::create($uid, $name);
if ($ret) {
- $gid = group_byname($uid, $name);
+ $gid = Group::getIdByName($uid, $name);
} else {
throw new BadRequestException('other API error');
}
intval($uid)
);
if (count($contact))
- $result = group_add_member($uid, $name, $cid, $gid);
+ $result = Group::create_member($uid, $name, $cid, $gid);
else {
$erroraddinguser = true;
$errorusers[] = $cid;
throw new BadRequestException('gid not specified');
// remove members
- $members = group_get_members($gid);
+ $members = Contact::getByGroupId($gid);
foreach ($members as $member) {
$cid = $member['id'];
foreach ($users as $user) {
$found = ($user['cid'] == $cid ? true : false);
}
if (!$found) {
- $ret = group_rmv_member($uid, $name, $cid);
+ $ret = Group::removeMemberByName($uid, $name, $cid);
}
}
);
if (count($contact)) {
- $result = group_add_member($uid, $name, $cid, $gid);
+ $result = Group::create_member($uid, $name, $cid, $gid);
} else {
$erroraddinguser = true;
$errorusers[] = $cid;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
+use Friendica\Model\User;
use Friendica\Network\Probe;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\OStatus;
$contact_id = $r[0]['id'];
$result['cid'] = $contact_id;
- $def_gid = get_default_group($uid, $contact["network"]);
- if (intval($def_gid)) {
- group_add_member($uid, '', $contact_id, $def_gid);
- }
+ Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact_id);
// Update the avatar
Contact::updateAvatar($ret['photo'], $uid, $contact_id);
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
+use Friendica\Model\Group;
+use Friendica\Model\User;
use Friendica\Object\Image;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
'hash' => $hash, 'datetime' => datetime_convert()));
}
- $def_gid = get_default_group($importer['uid'], $contact_record["network"]);
-
- if (intval($def_gid)) {
- group_add_member($importer['uid'], '', $contact_record['id'], $def_gid);
- }
+ Group::addMember(User::getDefaultGroup($importer['uid'], $contact_record["network"]), $contact_record['id']);
if (($r[0]['notify-flags'] & NOTIFY_INTRO) &&
in_array($r[0]['page-flags'], array(PAGE_NORMAL))) {
/// @TODO type-hint is array
function enumerate_permissions($obj) {
$allow_people = expand_acl($obj['allow_cid']);
- $allow_groups = expand_groups(expand_acl($obj['allow_gid']));
+ $allow_groups = Group::expand(expand_acl($obj['allow_gid']));
$deny_people = expand_acl($obj['deny_cid']);
- $deny_groups = expand_groups(expand_acl($obj['deny_gid']));
+ $deny_groups = Group::expand(expand_acl($obj['deny_gid']));
$recipients = array_unique(array_merge($allow_people, $allow_groups));
$deny = array_unique(array_merge($deny_people, $deny_groups));
$recipients = array_diff($recipients, $deny);
use Friendica\Database\DBM;
require_once('include/group.php');
+use Friendica\Model\Contact;
+use Friendica\Model\Group;
function contactgroup_content(App $a)
{
}
$group = $r[0];
- $members = group_get_members($group['id']);
+ $members = Contact::getByGroupId($group['id']);
$preselected = array();
if (count($members)) {
foreach ($members as $member) {
}
}
- if($change) {
- if(in_array($change,$preselected)) {
- group_rmv_member(local_user(),$group['name'],$change);
- }
- else {
- group_add_member(local_user(),$group['name'],$change);
+ if ($change) {
+ if (in_array($change, $preselected)) {
+ Group::removeMember($group['id'], $change);
+ } else {
+ Group::addMember($group['id'], $change);
}
}
}
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
+use Friendica\Model\Group;
use Friendica\Network\Probe;
require_once 'include/contact_selectors.php';
$findpeople_widget .= findpeople_widget();
}
- $groups_widget .= group_side('contacts','group','full',0,$contact_id);
+ $groups_widget .= Group::sidebarWidget('contacts','group','full',0,$contact_id);
$a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"),array(
'$vcard_widget' => $vcard_widget,
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
+use Friendica\Model\User;
use Friendica\Network\Probe;
use Friendica\Protocol\Diaspora;
}
}
- $def_gid = get_default_group($uid, $contact["network"]);
- if($contact && intval($def_gid))
- group_add_member($uid, '', $contact['id'], $def_gid);
+ Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact['id']);
// Let's send our user to the contact editor in case they want to
// do anything special with this new friend.
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
+use Friendica\Model\User;
use Friendica\Network\Probe;
require_once 'include/enotify.php';
$parms['key'] // this was already escaped
);
if (DBM::is_result($r)) {
- $def_gid = get_default_group(local_user(), $r[0]["network"]);
- if(intval($def_gid))
- group_add_member(local_user(), '', $r[0]['id'], $def_gid);
+ Group::addMember(User::getDefaultGroup($uid, $r[0]["network"]), $r[0]['id']);
if (isset($photo)) {
Contact::updateAvatar($photo, local_user(), $r[0]["id"], true);
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
+use Friendica\Model\Contact;
+use Friendica\Model\Group;
function group_init(App $a) {
if (local_user()) {
require_once 'include/group.php';
- $a->page['aside'] = group_side('contacts', 'group', 'extended', (($a->argc > 1) ? intval($a->argv[1]) : 0));
+ $a->page['aside'] = Group::sidebarWidget('contacts', 'group', 'extended', (($a->argc > 1) ? intval($a->argv[1]) : 0));
}
}
check_form_security_token_redirectOnErr('/group/new', 'group_edit');
$name = notags(trim($_POST['groupname']));
- $r = group_add(local_user(), $name);
+ $r = Group::create(local_user(), $name);
if ($r) {
info(t('Group created.') . EOL);
- $r = group_byname(local_user(), $name);
+ $r = Group::getIdByName(local_user(), $name);
if ($r) {
goaway(System::baseUrl() . '/group/' . $r);
}
}
}
- $a->page['aside'] = group_side();
+ $a->page['aside'] = Group::sidebarWidget();
}
return;
}
$result = null;
if (DBM::is_result($r)) {
- $result = group_rmv(local_user(), $r[0]['name']);
+ $result = Group::removeByName(local_user(), $r[0]['name']);
}
if ($result) {
}
$group = $r[0];
- $members = group_get_members($group['id']);
+ $members = Contact::getByGroupId($group['id']);
$preselected = array();
$entry = array();
$id = 0;
if ($change) {
if (in_array($change, $preselected)) {
- group_rmv_member(local_user(), $group['name'], $change);
+ Group::removeMember($group['id'], $change);
} else {
- group_add_member(local_user(), $group['name'], $change);
+ Group::create_member(local_user(), $group['name'], $change);
}
- $members = group_get_members($group['id']);
+ $members = Contact::getByGroupId($group['id']);
$preselected = array();
if (count($members)) {
foreach ($members as $member) {
$groupeditor['members'][] = $entry;
} else {
- group_rmv_member(local_user(), $group['name'], $member['id']);
+ Group::removeMember($group['id'], $member['id']);
}
}
use Friendica\Core\PConfig;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
require_once 'include/conversation.php';
require_once 'include/group.php';
$a->page['aside'] = '';
}
- $a->page['aside'] .= (Feature::isEnabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : '');
+ $a->page['aside'] .= (Feature::isEnabled(local_user(),'groups') ? Group::sidebarWidget('network/0','network','standard',$group_id) : '');
$a->page['aside'] .= (Feature::isEnabled(local_user(), 'forumlist_widget') ? ForumManager::widget(local_user(), $cid) : '');
$a->page['aside'] .= posted_date_widget('network',local_user(),false);
$a->page['aside'] .= networks_widget('network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
$o .= $tabs;
if ($group) {
- if (($t = group_public_members($group)) && !PConfig::get(local_user(),'system','nowarn_insecure')) {
+ if (($t = Contact::getOStatusCountByGroupId($group)) && !PConfig::get(local_user(), 'system', 'nowarn_insecure')) {
notice(sprintf(tt("Warning: This group contains %s member from a network that doesn't allow non public messages.",
"Warning: This group contains %s members from a network that doesn't allow non public messages.",
$t), $t).EOL);
// NOTREACHED
}
- $contacts = expand_groups(array($group));
+ $contacts = Group::expand(array($group));
if ((is_array($contacts)) && count($contacts)) {
$contact_str_self = "";
use Friendica\App;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
require_once 'include/contact_selectors.php';
$a->page['aside'] = '';
}
- $a->page['aside'] .= group_side('contacts', 'group', 'extended', 0, $contact_id);
+ $a->page['aside'] .= Group::sidebarWidget('contacts', 'group', 'extended');
}
function nogroup_content(App $a)
use Friendica\Core\PConfig;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
use Friendica\Util\XML;
require_once 'include/datetime.php';
if ($network_count) {
if (intval(Feature::isEnabled(local_user(), 'groups'))) {
// Find out how unseen network posts are spread across groups
- $group_counts = groups_count_unseen();
+ $group_counts = Group::countUnseen();
if (DBM::is_result($group_counts)) {
foreach ($group_counts as $group_count) {
if ($group_count['count'] > 0) {
use Friendica\Core\PConfig;
use Friendica\Database\DBM;
use Friendica\Model\GContact;
+use Friendica\Model\Group;
use Friendica\Model\User;
use Friendica\Protocol\Email;
$default_group = PConfig::get(local_user(), 'ostatus', 'default_group');
$legacy_contact = PConfig::get(local_user(), 'ostatus', 'legacy_contact');
- $settings_connectors .= mini_group_select(local_user(), $default_group, t("Default group for OStatus contacts"));
+ $settings_connectors .= Group::displayGroupSelection(local_user(), $default_group, t("Default group for OStatus contacts"));
/// @TODO Found to much different usage to test empty/non-empty strings (e.g. empty(), trim() == '') which is wanted?
if ($legacy_contact != "") {
'network_only' => array('expire_network_only', t("Only expire posts by others:"), $expire_network_only, '', array(t('No'), t('Yes'))),
);
- require_once('include/group.php');
- $group_select = mini_group_select(local_user(), $a->user['def_gid']);
+ $group_select = Group::displayGroupSelection(local_user(), $a->user['def_gid']);
// Private/public post links for the non-JS ACL form
$private_post = 1;
$text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) {
- $replace = "<br />".t("[Embedded content - reload page to view]")."<br />";
+ $replace = "<br />" . t("[Embedded content - reload page to view]") . "<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
$text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) {
- $replace = "<br />".t("[Embedded content - reload page to view]")."<br />";
+ $replace = "<br />" . t("[Embedded content - reload page to view]") . "<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
// Create a group with no members. This allows somebody to use it
// right away as a default group for new contacts.
-
- group_add($newuid, t('Friends'));
+ Group::create($newuid, t('Friends'));
$r = q("SELECT `id` FROM `group` WHERE `uid` = %d AND `name` = '%s'",
intval($newuid),
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\Network\Probe;
use Friendica\Util\XML;
*/
class Diaspora
{
-
/**
* @brief Return a list of relay servers
*
logger("Author ".$author." was added as contact number ".$contact_record["id"].".", LOGGER_DEBUG);
- $def_gid = get_default_group($importer['uid'], $ret["network"]);
-
- if (intval($def_gid)) {
- group_add_member($importer["uid"], "", $contact_record["id"], $def_gid);
- }
+ Group::addMember(User::getDefaultGroup($importer['uid'], $ret["network"]), $contact_record['id']);
Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true);
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
+use Friendica\Model\Group;
use Friendica\Network\Probe;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\OStatus;
}
$allow_people = expand_acl($parent['allow_cid']);
- $allow_groups = expand_groups(expand_acl($parent['allow_gid']),true);
+ $allow_groups = Group::expand(expand_acl($parent['allow_gid']),true);
$deny_people = expand_acl($parent['deny_cid']);
- $deny_groups = expand_groups(expand_acl($parent['deny_gid']));
+ $deny_groups = Group::expand(expand_acl($parent['deny_gid']));
// if our parent is a public forum (forum_mode == 1), uplink to the origional author causing
// a delivery fork. private groups (forum_mode == 2) do not uplink