\r\n"; $r = q("SELECT * FROM `group` WHERE `deleted` = 0 ORDER BY `name` ASC"); 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) { global $a; $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"; } // ignore readonly contacts when operating in celebrity mode - // the selector HTML could grow quite large and affect a lot of pages if(x($a->config,'rockstar')) $sql_extra .= " AND `readonly` = 0 "; $r = q("SELECT `id`, `name`, `url` FROM `contact` WHERE `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra ORDER BY `name` ASC "); 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 .= '