fixed contactgroup editor

This commit is contained in:
friendica 2013-01-22 20:13:20 -08:00
parent c09fad42ea
commit d43591fb0f
4 changed files with 19 additions and 20 deletions

12
done
View File

@ -87,14 +87,14 @@ mod/
- cb.php - cb.php
common.php common.php
community.php community.php
contactgroup.php + contactgroup.php
crepair.php crepair.php
delegate.php delegate.php
directory.php ? directory.php
dirfind.php dirfind.php
display.php display.php
editpost.php editpost.php
events.php ? events.php
fbrowser.php fbrowser.php
feed.php feed.php
filerm.php filerm.php
@ -114,7 +114,7 @@ mod/
+ lockview.php + lockview.php
+ login.php + login.php
lostpass.php lostpass.php
magic.php ? magic.php
+ manage.php + manage.php
match.php match.php
? message.php ? message.php
@ -164,8 +164,8 @@ mod/
viewcontacts.php viewcontacts.php
view.php view.php
+ viewsrc.php + viewsrc.php
? wall_attach.php (needs remote permissions refactor) + wall_attach.php (needs remote permissions refactor)
? wall_upload.php (needs remote permissions refactor) + wall_upload.php (needs remote permissions refactor)
webfinger.php webfinger.php
+ _well_known.php + _well_known.php
xrd.php xrd.php

View File

@ -169,7 +169,7 @@ function group_add_member($uid,$name,$member,$gid = 0) {
function group_get_members($gid) { function group_get_members($gid) {
$ret = array(); $ret = array();
if(intval($gid)) { if(intval($gid)) {
$r = q("SELECT abook.*,xchan.*,group_member.* FROM `group_member` $r = q("SELECT * FROM `group_member`
LEFT JOIN abook ON abook_xchan = `group_member`.`xchan` left join xchan on xchan_hash = abook_xchan LEFT JOIN abook ON abook_xchan = `group_member`.`xchan` left join xchan on xchan_hash = abook_xchan
WHERE `gid` = %d AND `group_member`.`uid` = %d and not ( abook_flags & %d ) and not ( abook_flags & %d ) and not ( abook_flags & %d ) ORDER BY xchan_name ASC ", WHERE `gid` = %d AND `group_member`.`uid` = %d and not ( abook_flags & %d ) and not ( abook_flags & %d ) and not ( abook_flags & %d ) ORDER BY xchan_name ASC ",
intval($gid), intval($gid),
@ -228,7 +228,6 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0
); );
$r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC", $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
intval($_SESSION['uid']) intval($_SESSION['uid'])
); );

View File

@ -34,7 +34,7 @@ function connections_aside(&$a) {
$a->set_widget('follow', follow_widget()); $a->set_widget('follow', follow_widget());
} }
$a->set_widget('collections', group_side('connnections','group',false,0,((array_key_exists('abook',$a->data)) ? $a->data['abook']['abook_id'] : ''))); $a->set_widget('collections', group_side('connnections','group',false,0,((array_key_exists('abook',$a->data)) ? $a->data['abook']['abook_xchan'] : '')));
$a->set_widget('findpeople',findpeople_widget()); $a->set_widget('findpeople',findpeople_widget());
} }

View File

@ -4,27 +4,27 @@ require_once('include/group.php');
function contactgroup_content(&$a) { function contactgroup_content(&$a) {
if(! local_user()) { if(! local_user()) {
killme(); killme();
} }
if(($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) { if((argc() > 2) && (intval(argv(1))) && (argv(2))) {
$r = q("SELECT `id` FROM `contact` WHERE `id` = %d AND `uid` = %d and `self` = 0 and `blocked` = 0 AND `pending` = 0 LIMIT 1", $r = q("SELECT abook_xchan from abook where abook_xchan = '%s' and abook_channel = %d and not ( abook_flags & %d ) limit 1",
intval($a->argv[2]), dbesc(argv(2)),
intval(local_user()) intval(local_user()),
intval(ABOOK_FLAG_SELF)
); );
if(count($r)) if($r)
$change = intval($a->argv[2]); $change = $r[0]['abook_xchan'];
} }
if(($a->argc > 1) && (intval($a->argv[1]))) { if((argc() > 1) && (intval(argv(1)))) {
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1", $r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
intval($a->argv[1]), intval(argv(1)),
intval(local_user()) intval(local_user())
); );
if(! count($r)) { if(! $r) {
killme(); killme();
} }
@ -33,7 +33,7 @@ function contactgroup_content(&$a) {
$preselected = array(); $preselected = array();
if(count($members)) { if(count($members)) {
foreach($members as $member) foreach($members as $member)
$preselected[] = $member['id']; $preselected[] = $member['xchan_hash'];
} }
if($change) { if($change) {