Use new Model methods for groups
This commit is contained in:
parent
fe89e7760e
commit
abdecd2b2f
17 changed files with 65 additions and 63 deletions
|
@ -13,6 +13,7 @@ use Friendica\Core\NotificationsManager;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\FKOAuth1;
|
use Friendica\Network\FKOAuth1;
|
||||||
|
@ -4645,7 +4646,7 @@ function api_friendica_group_show($type)
|
||||||
|
|
||||||
// loop through all groups and retrieve all members for adding data in the user array
|
// loop through all groups and retrieve all members for adding data in the user array
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
$members = group_get_members($rr['id']);
|
$members = Contact::getByGroupId($rr['id']);
|
||||||
$users = array();
|
$users = array();
|
||||||
|
|
||||||
if ($type == "xml") {
|
if ($type == "xml") {
|
||||||
|
@ -4713,7 +4714,7 @@ function api_friendica_group_delete($type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete group
|
// delete group
|
||||||
$ret = group_rmv($uid, $name);
|
$ret = Group::removeByName($uid, $name);
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
// return success
|
// return success
|
||||||
$success = array('success' => $ret, 'gid' => $gid, 'name' => $name, 'status' => 'deleted', 'wrong users' => array());
|
$success = array('success' => $ret, 'gid' => $gid, 'name' => $name, 'status' => 'deleted', 'wrong users' => array());
|
||||||
|
@ -4764,9 +4765,9 @@ function api_friendica_group_create($type)
|
||||||
$reactivate_group = true;
|
$reactivate_group = true;
|
||||||
|
|
||||||
// create group
|
// create group
|
||||||
$ret = group_add($uid, $name);
|
$ret = Group::create($uid, $name);
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
$gid = group_byname($uid, $name);
|
$gid = Group::getIdByName($uid, $name);
|
||||||
} else {
|
} else {
|
||||||
throw new BadRequestException('other API error');
|
throw new BadRequestException('other API error');
|
||||||
}
|
}
|
||||||
|
@ -4783,7 +4784,7 @@ function api_friendica_group_create($type)
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
if (count($contact))
|
if (count($contact))
|
||||||
$result = group_add_member($uid, $name, $cid, $gid);
|
$result = Group::create_member($uid, $name, $cid, $gid);
|
||||||
else {
|
else {
|
||||||
$erroraddinguser = true;
|
$erroraddinguser = true;
|
||||||
$errorusers[] = $cid;
|
$errorusers[] = $cid;
|
||||||
|
@ -4822,14 +4823,14 @@ function api_friendica_group_update($type)
|
||||||
throw new BadRequestException('gid not specified');
|
throw new BadRequestException('gid not specified');
|
||||||
|
|
||||||
// remove members
|
// remove members
|
||||||
$members = group_get_members($gid);
|
$members = Contact::getByGroupId($gid);
|
||||||
foreach ($members as $member) {
|
foreach ($members as $member) {
|
||||||
$cid = $member['id'];
|
$cid = $member['id'];
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
$found = ($user['cid'] == $cid ? true : false);
|
$found = ($user['cid'] == $cid ? true : false);
|
||||||
}
|
}
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
$ret = group_rmv_member($uid, $name, $cid);
|
$ret = Group::removeMemberByName($uid, $name, $cid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4846,7 +4847,7 @@ function api_friendica_group_update($type)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (count($contact)) {
|
if (count($contact)) {
|
||||||
$result = group_add_member($uid, $name, $cid, $gid);
|
$result = Group::create_member($uid, $name, $cid, $gid);
|
||||||
} else {
|
} else {
|
||||||
$erroraddinguser = true;
|
$erroraddinguser = true;
|
||||||
$errorusers[] = $cid;
|
$errorusers[] = $cid;
|
||||||
|
|
|
@ -8,6 +8,8 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
|
@ -244,10 +246,7 @@ function new_contact($uid, $url, $interactive = false, $network = '') {
|
||||||
$contact_id = $r[0]['id'];
|
$contact_id = $r[0]['id'];
|
||||||
$result['cid'] = $contact_id;
|
$result['cid'] = $contact_id;
|
||||||
|
|
||||||
$def_gid = get_default_group($uid, $contact["network"]);
|
Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact_id);
|
||||||
if (intval($def_gid)) {
|
|
||||||
group_add_member($uid, '', $contact_id, $def_gid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the avatar
|
// Update the avatar
|
||||||
Contact::updateAvatar($ret['photo'], $uid, $contact_id);
|
Contact::updateAvatar($ret['photo'], $uid, $contact_id);
|
||||||
|
|
|
@ -12,6 +12,8 @@ use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Model\GContact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
|
use Friendica\Model\User;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Protocol\DFRN;
|
use Friendica\Protocol\DFRN;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
|
@ -1720,11 +1722,7 @@ function new_follower($importer, $contact, $datarray, $item, $sharing = false) {
|
||||||
'hash' => $hash, 'datetime' => datetime_convert()));
|
'hash' => $hash, 'datetime' => datetime_convert()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$def_gid = get_default_group($importer['uid'], $contact_record["network"]);
|
Group::addMember(User::getDefaultGroup($importer['uid'], $contact_record["network"]), $contact_record['id']);
|
||||||
|
|
||||||
if (intval($def_gid)) {
|
|
||||||
group_add_member($importer['uid'], '', $contact_record['id'], $def_gid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($r[0]['notify-flags'] & NOTIFY_INTRO) &&
|
if (($r[0]['notify-flags'] & NOTIFY_INTRO) &&
|
||||||
in_array($r[0]['page-flags'], array(PAGE_NORMAL))) {
|
in_array($r[0]['page-flags'], array(PAGE_NORMAL))) {
|
||||||
|
@ -1958,9 +1956,9 @@ function compare_permissions($obj1, $obj2) {
|
||||||
/// @TODO type-hint is array
|
/// @TODO type-hint is array
|
||||||
function enumerate_permissions($obj) {
|
function enumerate_permissions($obj) {
|
||||||
$allow_people = expand_acl($obj['allow_cid']);
|
$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_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));
|
$recipients = array_unique(array_merge($allow_people, $allow_groups));
|
||||||
$deny = array_unique(array_merge($deny_people, $deny_groups));
|
$deny = array_unique(array_merge($deny_people, $deny_groups));
|
||||||
$recipients = array_diff($recipients, $deny);
|
$recipients = array_diff($recipients, $deny);
|
||||||
|
|
|
@ -4,6 +4,8 @@ use Friendica\App;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
|
||||||
require_once('include/group.php');
|
require_once('include/group.php');
|
||||||
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
|
|
||||||
function contactgroup_content(App $a)
|
function contactgroup_content(App $a)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +33,7 @@ function contactgroup_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = $r[0];
|
$group = $r[0];
|
||||||
$members = group_get_members($group['id']);
|
$members = Contact::getByGroupId($group['id']);
|
||||||
$preselected = array();
|
$preselected = array();
|
||||||
if (count($members)) {
|
if (count($members)) {
|
||||||
foreach ($members as $member) {
|
foreach ($members as $member) {
|
||||||
|
@ -39,12 +41,11 @@ function contactgroup_content(App $a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($change) {
|
if ($change) {
|
||||||
if(in_array($change,$preselected)) {
|
if (in_array($change, $preselected)) {
|
||||||
group_rmv_member(local_user(),$group['name'],$change);
|
Group::removeMember($group['id'], $change);
|
||||||
}
|
} else {
|
||||||
else {
|
Group::addMember($group['id'], $change);
|
||||||
group_add_member(local_user(),$group['name'],$change);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Model\GContact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
|
|
||||||
require_once 'include/contact_selectors.php';
|
require_once 'include/contact_selectors.php';
|
||||||
|
@ -77,7 +78,7 @@ function contacts_init(App $a) {
|
||||||
$findpeople_widget .= findpeople_widget();
|
$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(
|
$a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"),array(
|
||||||
'$vcard_widget' => $vcard_widget,
|
'$vcard_widget' => $vcard_widget,
|
||||||
|
|
|
@ -25,6 +25,8 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
|
|
||||||
|
@ -502,9 +504,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$def_gid = get_default_group($uid, $contact["network"]);
|
Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact['id']);
|
||||||
if($contact && intval($def_gid))
|
|
||||||
group_add_member($uid, '', $contact['id'], $def_gid);
|
|
||||||
|
|
||||||
// Let's send our user to the contact editor in case they want to
|
// Let's send our user to the contact editor in case they want to
|
||||||
// do anything special with this new friend.
|
// do anything special with this new friend.
|
||||||
|
|
|
@ -16,6 +16,8 @@ use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
|
|
||||||
require_once 'include/enotify.php';
|
require_once 'include/enotify.php';
|
||||||
|
@ -190,9 +192,7 @@ function dfrn_request_post(App $a) {
|
||||||
$parms['key'] // this was already escaped
|
$parms['key'] // this was already escaped
|
||||||
);
|
);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$def_gid = get_default_group(local_user(), $r[0]["network"]);
|
Group::addMember(User::getDefaultGroup($uid, $r[0]["network"]), $r[0]['id']);
|
||||||
if(intval($def_gid))
|
|
||||||
group_add_member(local_user(), '', $r[0]['id'], $def_gid);
|
|
||||||
|
|
||||||
if (isset($photo)) {
|
if (isset($photo)) {
|
||||||
Contact::updateAvatar($photo, local_user(), $r[0]["id"], true);
|
Contact::updateAvatar($photo, local_user(), $r[0]["id"], true);
|
||||||
|
|
|
@ -10,11 +10,13 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
|
|
||||||
function group_init(App $a) {
|
function group_init(App $a) {
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
require_once 'include/group.php';
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,10 +31,10 @@ function group_post(App $a) {
|
||||||
check_form_security_token_redirectOnErr('/group/new', 'group_edit');
|
check_form_security_token_redirectOnErr('/group/new', 'group_edit');
|
||||||
|
|
||||||
$name = notags(trim($_POST['groupname']));
|
$name = notags(trim($_POST['groupname']));
|
||||||
$r = group_add(local_user(), $name);
|
$r = Group::create(local_user(), $name);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
info(t('Group created.') . EOL);
|
info(t('Group created.') . EOL);
|
||||||
$r = group_byname(local_user(), $name);
|
$r = Group::getIdByName(local_user(), $name);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
goaway(System::baseUrl() . '/group/' . $r);
|
goaway(System::baseUrl() . '/group/' . $r);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +71,7 @@ function group_post(App $a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->page['aside'] = group_side();
|
$a->page['aside'] = Group::sidebarWidget();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +120,7 @@ function group_content(App $a) {
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$result = group_rmv(local_user(), $r[0]['name']);
|
$result = Group::removeByName(local_user(), $r[0]['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
@ -158,7 +160,7 @@ function group_content(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = $r[0];
|
$group = $r[0];
|
||||||
$members = group_get_members($group['id']);
|
$members = Contact::getByGroupId($group['id']);
|
||||||
$preselected = array();
|
$preselected = array();
|
||||||
$entry = array();
|
$entry = array();
|
||||||
$id = 0;
|
$id = 0;
|
||||||
|
@ -171,12 +173,12 @@ function group_content(App $a) {
|
||||||
|
|
||||||
if ($change) {
|
if ($change) {
|
||||||
if (in_array($change, $preselected)) {
|
if (in_array($change, $preselected)) {
|
||||||
group_rmv_member(local_user(), $group['name'], $change);
|
Group::removeMember($group['id'], $change);
|
||||||
} else {
|
} 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();
|
$preselected = array();
|
||||||
if (count($members)) {
|
if (count($members)) {
|
||||||
foreach ($members as $member) {
|
foreach ($members as $member) {
|
||||||
|
@ -233,7 +235,7 @@ function group_content(App $a) {
|
||||||
|
|
||||||
$groupeditor['members'][] = $entry;
|
$groupeditor['members'][] = $entry;
|
||||||
} else {
|
} else {
|
||||||
group_rmv_member(local_user(), $group['name'], $member['id']);
|
Group::removeMember($group['id'], $member['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
|
|
||||||
require_once 'include/conversation.php';
|
require_once 'include/conversation.php';
|
||||||
require_once 'include/group.php';
|
require_once 'include/group.php';
|
||||||
|
@ -157,7 +158,7 @@ function network_init(App $a) {
|
||||||
$a->page['aside'] = '';
|
$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'] .= (Feature::isEnabled(local_user(), 'forumlist_widget') ? ForumManager::widget(local_user(), $cid) : '');
|
||||||
$a->page['aside'] .= posted_date_widget('network',local_user(),false);
|
$a->page['aside'] .= posted_date_widget('network',local_user(),false);
|
||||||
$a->page['aside'] .= networks_widget('network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
|
$a->page['aside'] .= networks_widget('network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
|
||||||
|
@ -567,7 +568,7 @@ function networkThreadedView(App $a, $update = 0) {
|
||||||
$o .= $tabs;
|
$o .= $tabs;
|
||||||
|
|
||||||
if ($group) {
|
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.",
|
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.",
|
"Warning: This group contains %s members from a network that doesn't allow non public messages.",
|
||||||
$t), $t).EOL);
|
$t), $t).EOL);
|
||||||
|
@ -644,7 +645,7 @@ function networkThreadedView(App $a, $update = 0) {
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
$contacts = expand_groups(array($group));
|
$contacts = Group::expand(array($group));
|
||||||
|
|
||||||
if ((is_array($contacts)) && count($contacts)) {
|
if ((is_array($contacts)) && count($contacts)) {
|
||||||
$contact_str_self = "";
|
$contact_str_self = "";
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
|
|
||||||
require_once 'include/contact_selectors.php';
|
require_once 'include/contact_selectors.php';
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ function nogroup_init(App $a)
|
||||||
$a->page['aside'] = '';
|
$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)
|
function nogroup_content(App $a)
|
||||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
require_once 'include/datetime.php';
|
require_once 'include/datetime.php';
|
||||||
|
@ -152,7 +153,7 @@ function ping_init(App $a)
|
||||||
if ($network_count) {
|
if ($network_count) {
|
||||||
if (intval(Feature::isEnabled(local_user(), 'groups'))) {
|
if (intval(Feature::isEnabled(local_user(), 'groups'))) {
|
||||||
// Find out how unseen network posts are spread across 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)) {
|
if (DBM::is_result($group_counts)) {
|
||||||
foreach ($group_counts as $group_count) {
|
foreach ($group_counts as $group_count) {
|
||||||
if ($group_count['count'] > 0) {
|
if ($group_count['count'] > 0) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Model\GContact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Protocol\Email;
|
use Friendica\Protocol\Email;
|
||||||
|
|
||||||
|
@ -834,7 +835,7 @@ function settings_content(App $a) {
|
||||||
$default_group = PConfig::get(local_user(), 'ostatus', 'default_group');
|
$default_group = PConfig::get(local_user(), 'ostatus', 'default_group');
|
||||||
$legacy_contact = PConfig::get(local_user(), 'ostatus', 'legacy_contact');
|
$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?
|
/// @TODO Found to much different usage to test empty/non-empty strings (e.g. empty(), trim() == '') which is wanted?
|
||||||
if ($legacy_contact != "") {
|
if ($legacy_contact != "") {
|
||||||
|
@ -1218,8 +1219,7 @@ function settings_content(App $a) {
|
||||||
'network_only' => array('expire_network_only', t("Only expire posts by others:"), $expire_network_only, '', array(t('No'), t('Yes'))),
|
'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 = Group::displayGroupSelection(local_user(), $a->user['def_gid']);
|
||||||
$group_select = mini_group_select(local_user(), $a->user['def_gid']);
|
|
||||||
|
|
||||||
// Private/public post links for the non-JS ACL form
|
// Private/public post links for the non-JS ACL form
|
||||||
$private_post = 1;
|
$private_post = 1;
|
||||||
|
|
|
@ -22,7 +22,7 @@ function update_display_content(App $a)
|
||||||
$text = preg_replace($pattern, $replace, $text);
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
|
|
||||||
if (PConfig::get(local_user(), "system", "bandwith_saver")) {
|
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";
|
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||||
$text = preg_replace($pattern, $replace, $text);
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||||
|
|
|
@ -27,7 +27,7 @@ function update_network_content(App $a)
|
||||||
$text = preg_replace($pattern, $replace, $text);
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
|
|
||||||
if (PConfig::get(local_user(), "system", "bandwith_saver")) {
|
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";
|
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||||
$text = preg_replace($pattern, $replace, $text);
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||||
|
|
|
@ -376,8 +376,7 @@ class User
|
||||||
|
|
||||||
// Create a group with no members. This allows somebody to use it
|
// Create a group with no members. This allows somebody to use it
|
||||||
// right away as a default group for new contacts.
|
// right away as a default group for new contacts.
|
||||||
|
Group::create($newuid, t('Friends'));
|
||||||
group_add($newuid, t('Friends'));
|
|
||||||
|
|
||||||
$r = q("SELECT `id` FROM `group` WHERE `uid` = %d AND `name` = '%s'",
|
$r = q("SELECT `id` FROM `group` WHERE `uid` = %d AND `name` = '%s'",
|
||||||
intval($newuid),
|
intval($newuid),
|
||||||
|
|
|
@ -18,7 +18,9 @@ use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Model\GContact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
|
@ -37,7 +39,6 @@ require_once 'include/queue_fn.php';
|
||||||
*/
|
*/
|
||||||
class Diaspora
|
class Diaspora
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return a list of relay servers
|
* @brief Return a list of relay servers
|
||||||
*
|
*
|
||||||
|
@ -2462,11 +2463,7 @@ class Diaspora
|
||||||
|
|
||||||
logger("Author ".$author." was added as contact number ".$contact_record["id"].".", LOGGER_DEBUG);
|
logger("Author ".$author." was added as contact number ".$contact_record["id"].".", LOGGER_DEBUG);
|
||||||
|
|
||||||
$def_gid = get_default_group($importer['uid'], $ret["network"]);
|
Group::addMember(User::getDefaultGroup($importer['uid'], $ret["network"]), $contact_record['id']);
|
||||||
|
|
||||||
if (intval($def_gid)) {
|
|
||||||
group_add_member($importer["uid"], "", $contact_record["id"], $def_gid);
|
|
||||||
}
|
|
||||||
|
|
||||||
Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true);
|
Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Group;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
|
@ -349,9 +350,9 @@ class Notifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
$allow_people = expand_acl($parent['allow_cid']);
|
$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_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
|
// 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
|
// a delivery fork. private groups (forum_mode == 2) do not uplink
|
||||||
|
|
Loading…
Reference in a new issue