Bugfix: "default_group" behaviour wasn't implemented correctly

This commit is contained in:
Michael Vogel 2016-04-13 22:21:23 +02:00 committed by Roland Haeder
parent bc720c0918
commit 535f382c4e
No known key found for this signature in database
GPG Key ID: B72F8185C6C7BD78
5 changed files with 17 additions and 23 deletions

View File

@ -1819,12 +1819,10 @@ class diaspora {
return;
}
$g = q("SELECT `def_gid` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($importer["uid"])
);
$def_gid = get_default_group($importer['uid'], $ret["network"]);
if($g && intval($g[0]["def_gid"]))
group_add_member($importer["uid"], "", $contact_record["id"], $g[0]["def_gid"]);
if(intval($def_gid))
group_add_member($importer["uid"], "", $contact_record["id"], $def_gid);
if($importer["page-flags"] == PAGE_NORMAL) {

View File

@ -1,6 +1,7 @@
<?php
require_once("include/Scrape.php");
require_once("include/socgraph.php");
require_once('include/group.php');
function update_contact($id) {
/*
@ -259,10 +260,8 @@ function new_contact($uid,$url,$interactive = false) {
$result['cid'] = $contact_id;
$def_gid = get_default_group($uid, $contact["network"]);
if (intval($def_gid)) {
require_once('include/group.php');
if (intval($def_gid))
group_add_member($uid, '', $contact_id, $def_gid);
}
require_once("include/Photo.php");

View File

@ -18,6 +18,7 @@ require_once('include/Contact.php');
require_once('mod/share.php');
require_once('include/enotify.php');
require_once('include/dfrn.php');
require_once('include/group.php');
require_once('library/defuse/php-encryption-1.2.1/Crypto.php');
@ -1378,7 +1379,7 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
dbesc(($sharing) ? NETWORK_ZOT : NETWORK_OSTATUS),
intval(($sharing) ? CONTACT_IS_SHARING : CONTACT_IS_FOLLOWER)
);
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `pending` = 1 LIMIT 1",
$r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `pending` = 1 LIMIT 1",
intval($importer['uid']),
dbesc($url)
);
@ -1415,10 +1416,10 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
);
}
if(intval($r[0]['def_gid'])) {
require_once('include/group.php');
group_add_member($r[0]['uid'],'',$contact_record['id'],$r[0]['def_gid']);
}
$def_gid = get_default_group($importer['uid'], $contact_record["network"]);
if(intval($def_gid))
group_add_member($importer['uid'],'',$contact_record['id'],$def_gid);
if(($r[0]['notify-flags'] & NOTIFY_INTRO) &&
in_array($r[0]['page-flags'], array(PAGE_NORMAL))) {
@ -1648,7 +1649,6 @@ function compare_permissions($obj1,$obj2) {
// returns an array of contact-ids that are allowed to see this object
function enumerate_permissions($obj) {
require_once('include/group.php');
$allow_people = expand_acl($obj['allow_cid']);
$allow_groups = expand_groups(expand_acl($obj['allow_gid']));
$deny_people = expand_acl($obj['deny_cid']);

View File

@ -15,6 +15,7 @@
*/
require_once('include/enotify.php');
require_once('include/group.php');
function dfrn_confirm_post(&$a,$handsfree = null) {
@ -491,10 +492,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
}
$def_gid = get_default_group($uid, $contact["network"]);
if($contact && intval($def_gid)) {
require_once('include/group.php');
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
// do anything special with this new friend.

View File

@ -11,6 +11,7 @@
require_once('include/enotify.php');
require_once('include/Scrape.php');
require_once('include/group.php');
if(! function_exists('dfrn_request_init')) {
function dfrn_request_init(&$a) {
@ -181,10 +182,9 @@ function dfrn_request_post(&$a) {
);
if(count($r)) {
$def_gid = get_default_group(local_user(), $r[0]["network"]);
if(intval($def_gid)) {
require_once('include/group.php');
if(intval($def_gid))
group_add_member(local_user(), '', $r[0]['id'], $def_gid);
}
$forwardurl = $a->get_baseurl()."/contacts/".$r[0]['id'];
} else
$forwardurl = $a->get_baseurl()."/contacts";
@ -394,10 +394,8 @@ function dfrn_request_post(&$a) {
$contact_id = $r[0]['id'];
$def_gid = get_default_group($uid, $r[0]["network"]);
if (intval($def_gid)) {
require_once('include/group.php');
if (intval($def_gid))
group_add_member($uid, '', $contact_id, $def_gid);
}
$photo = avatar_img($addr);