Merge pull request #329 from git-marijus/master
fix #328 by using a seperate query instead of group_concat
This commit is contained in:
commit
48e62bb50a
@ -211,6 +211,22 @@ function group_get_members($gid) {
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function group_get_members_xchan($gid) {
|
||||||
|
$ret = array();
|
||||||
|
if(intval($gid)) {
|
||||||
|
$r = q("SELECT xchan FROM group_member WHERE gid = %d AND uid = %d",
|
||||||
|
intval($gid),
|
||||||
|
intval(local_channel())
|
||||||
|
);
|
||||||
|
if(count($r)) {
|
||||||
|
foreach($r as $rr) {
|
||||||
|
$ret[] = $rr['xchan'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
function mini_group_select($uid,$group = '') {
|
function mini_group_select($uid,$group = '') {
|
||||||
|
|
||||||
$grps = array();
|
$grps = array();
|
||||||
|
11
mod/acl.php
11
mod/acl.php
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
/* ACL selector json backend */
|
/* ACL selector json backend */
|
||||||
require_once("include/acl_selectors.php");
|
require_once("include/acl_selectors.php");
|
||||||
|
require_once("include/group.php");
|
||||||
|
|
||||||
function acl_init(&$a){
|
function acl_init(&$a){
|
||||||
|
|
||||||
@ -48,8 +49,7 @@ function acl_init(&$a){
|
|||||||
|
|
||||||
if ($type=='' || $type=='g'){
|
if ($type=='' || $type=='g'){
|
||||||
|
|
||||||
$r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name`,
|
$r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name`
|
||||||
%s as uids
|
|
||||||
FROM `groups`,`group_member`
|
FROM `groups`,`group_member`
|
||||||
WHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d
|
WHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d
|
||||||
AND `group_member`.`gid`=`groups`.`id`
|
AND `group_member`.`gid`=`groups`.`id`
|
||||||
@ -57,23 +57,20 @@ function acl_init(&$a){
|
|||||||
GROUP BY `groups`.`id`
|
GROUP BY `groups`.`id`
|
||||||
ORDER BY `groups`.`name`
|
ORDER BY `groups`.`name`
|
||||||
LIMIT %d OFFSET %d",
|
LIMIT %d OFFSET %d",
|
||||||
db_concat('group_member.xchan', ','),
|
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
intval($count),
|
intval($count),
|
||||||
intval($start)
|
intval($start)
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($r as $g){
|
foreach($r as $g){
|
||||||
// logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']);
|
// logger('acl: group: ' . $g['name'] . ' members: ' . group_get_members_xchan($g['id']));
|
||||||
$groups[] = array(
|
$groups[] = array(
|
||||||
"type" => "g",
|
"type" => "g",
|
||||||
"photo" => "images/twopeople.png",
|
"photo" => "images/twopeople.png",
|
||||||
"name" => $g['name'],
|
"name" => $g['name'],
|
||||||
"id" => $g['id'],
|
"id" => $g['id'],
|
||||||
"xid" => $g['hash'],
|
"xid" => $g['hash'],
|
||||||
//FIXME: db_concat aka GROUP_CONCAT has a defoult setting of group_concat_max_len = 1024 in mysql.
|
"uids" => group_get_members_xchan($g['id']),
|
||||||
// This value is quickly exceeded here. As a result $g['uids'] only contains a part of the complete xchan set.
|
|
||||||
"uids" => explode(",",$g['uids']),
|
|
||||||
"link" => ''
|
"link" => ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -121,8 +121,10 @@ ACL.prototype.on_button_show = function(event) {
|
|||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
|
if(!$(this).parent().hasClass("grouphide")) {
|
||||||
that.set_allow($(this).parent().attr('id'));
|
that.set_allow($(this).parent().attr('id'));
|
||||||
that.on_submit();
|
that.on_submit();
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@ -245,12 +247,15 @@ ACL.prototype.update_view = function() {
|
|||||||
break;
|
break;
|
||||||
case "c":
|
case "c":
|
||||||
if (that.allow_cid.indexOf(id)>=0){
|
if (that.allow_cid.indexOf(id)>=0){
|
||||||
|
if(!$(this).hasClass("grouphide") ) {
|
||||||
btshow.removeClass("btn-default").addClass("btn-success");
|
btshow.removeClass("btn-default").addClass("btn-success");
|
||||||
bthide.removeClass("btn-danger").addClass("btn-default");
|
bthide.removeClass("btn-danger").addClass("btn-default");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (that.deny_cid.indexOf(id)>=0){
|
if (that.deny_cid.indexOf(id)>=0){
|
||||||
btshow.removeClass("btn-success").addClass("btn-default");
|
btshow.removeClass("btn-success").addClass("btn-default");
|
||||||
bthide.removeClass("btn-default").addClass("btn-danger");
|
bthide.removeClass("btn-default").addClass("btn-danger");
|
||||||
|
$(this).removeClass("groupshow");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user