\r\n"; $r = q("SELECT * FROM `group` WHERE `uid` = %d ORDER BY `name` ASC", $_SESSION['uid'] ); if(count($r)) { foreach($r as $rr) { if((is_array($preselected)) && in_array($rr['id'], $preselected)) $selected = " selected=\"selected\" "; else $selected = ''; $o .= "\r\n"; } } $o .= "\r\n"; return $o; } function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false) { $o = ''; // When used for private messages, we limit correspondence to mutual friends and the selector // to one recipient. By default our selector allows multiple selects amongst all contacts. if($privmail) { $sql_extra = " AND `issued-id` != '' AND `dfrn-id` != '' "; $o .= "\r\n"; } else { $sql_extra = ''; $o .= "\r\n"; } $r = q("SELECT `id`, `name` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra ORDER BY `name` ASC ", $_SESSION['uid'] ); if(count($r)) { foreach($r as $rr) { if((is_array($preselected)) && in_array($rr['id'], $preselected)) $selected = " selected=\"selected\" "; else $selected = ''; $o .= "\r\n"; } } $o .= "\r\n"; return $o; } function fixacl(&$item) { $item = intval(str_replace(array('<','>'),array('',''),$item)); } function populate_acl($user = null) { $allow_cid = $allow_gid = $deny_cid = $deny_gid = false; if(is_array($user)) { $allow_cid = ((strlen($user['allow_cid'])) ? explode('><', $user['allow_cid']) : array() ); $allow_gid = ((strlen($user['allow_gid'])) ? explode('><', $user['allow_gid']) : array() ); $deny_cid = ((strlen($user['deny_cid'])) ? explode('><', $user['deny_cid']) : array() ); $deny_gid = ((strlen($user['deny_gid'])) ? explode('><', $user['deny_gid']) : array() ); array_walk($allow_cid,'fixacl'); array_walk($allow_gid,'fixacl'); array_walk($deny_cid,'fixacl'); array_walk($deny_gid,'fixacl'); } $o = ''; $o .= '