$exclude = false;
$size = 4;
- if(is_array($options)) {
- if(x($options,'size'))
+ if (is_array($options)) {
+ if (x($options,'size'))
$size = $options['size'];
- if(x($options,'mutual_friends'))
+ if (x($options,'mutual_friends')) {
$mutual = true;
- if(x($options,'single'))
+ }
+ if (x($options,'single')) {
$single = true;
- if(x($options,'multiple'))
+ }
+ if (x($options,'multiple')) {
$single = false;
- if(x($options,'exclude'))
+ }
+ if (x($options,'exclude')) {
$exclude = $options['exclude'];
+ }
- if(x($options,'networks')) {
+ if (x($options,'networks')) {
switch($options['networks']) {
case 'DFRN_ONLY':
$networks = array(NETWORK_DFRN);
if (dbm::is_result($r)) {
foreach ($r as $rr) {
- if((is_array($preselected)) && in_array($rr['id'], $preselected))
+ if ((is_array($preselected)) && in_array($rr['id'], $preselected)) {
$selected = " selected=\"selected\" ";
- else
+ } else {
$selected = '';
+ }
$trimmed = mb_substr($rr['name'],0,20);
if ($privmail) {
$trimmed = GetProfileUsername($rr['url'], $rr['name'], false);
- }
- else {
+ } else {
$trimmed = mb_substr($rr['name'],0,20);
}
function prune_deadguys($arr) {
- if(! $arr)
+ if (! $arr) {
return $arr;
+ }
+
$str = dbesc(implode(',',$arr));
+
$r = q("SELECT `id` FROM `contact` WHERE `id` IN ( " . $str . ") AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 ");
+
if ($r) {
$ret = array();
- foreach($r as $rr)
+ foreach ($r as $rr) {
$ret[] = intval($rr['id']);
+ }
return $ret;
}
+
return array();
}
dbesc(NETWORK_ZOT),
dbesc(NETWORK_DIASPORA)
);
- }
- elseif($type == 'a') {
+ } elseif ($type == 'a') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `forum`, `prv` FROM `contact`
WHERE `uid` = %d AND `pending` = 0
$sql_extra2
ORDER BY `name` ASC ",
intval(local_user())
);
- }
- elseif($type == 'x') {
+ } elseif ($type == 'x') {
// autocomplete for global contact search (e.g. navbar search)
$r = navbar_complete($a);
$contacts = array();
if ($r) {
- foreach($r as $g) {
+ foreach ($r as $g) {
$contacts[] = array(
- "photo" => proxy_url($g['photo'], false, PROXY_SIZE_MICRO),
- "name" => $g['name'],
- "nick" => (x($g['addr']) ? $g['addr'] : $g['url']),
- "network" => $g['network'],
- "link" => $g['url'],
- "forum" => (x($g['community']) ? 1 : 0),
+ 'photo' => proxy_url($g['photo'], false, PROXY_SIZE_MICRO),
+ 'name' => $g['name'],
+ 'nick' => (x($g['addr']) ? $g['addr'] : $g['url']),
+ 'network' => $g['network'],
+ 'link' => $g['url'],
+ 'forum' => (x($g['community']) ? 1 : 0),
);
}
}
$o = array(
'start' => $start,
- 'count' => $count,
- 'items' => $contacts,
+ 'count' => $count,
+ 'items' => $contacts,
);
echo json_encode($o);
killme();
if (dbm::is_result($r)) {
- foreach($r as $g){
+ foreach ($r as $g){
$contacts[] = array(
- "type" => "c",
- "photo" => proxy_url($g['micro'], false, PROXY_SIZE_MICRO),
- "name" => htmlentities($g['name']),
- "id" => intval($g['id']),
- "network" => $g['network'],
- "link" => $g['url'],
- "nick" => htmlentities(($g['attag']) ? $g['attag'] : $g['nick']),
- "forum" => ((x($g['forum']) || x($g['prv'])) ? 1 : 0),
+ 'type' => 'c',
+ 'photo' => proxy_url($g['micro'], false, PROXY_SIZE_MICRO),
+ 'name' => htmlentities($g['name']),
+ 'id' => intval($g['id']),
+ 'network' => $g['network'],
+ 'link' => $g['url'],
+ 'nick' => htmlentities(($g['attag']) ? $g['attag'] : $g['nick']),
+ 'forum' => ((x($g['forum']) || x($g['prv'])) ? 1 : 0),
);
}
}
implode("','", $known_contacts)
);
if (dbm::is_result($r)){
- foreach($r as $row) {
+ foreach ($r as $row) {
// nickname..
$up = parse_url($row['author-link']);
$nick = explode("/",$up['path']);
$nick .= "@".$up['host'];
// /nickname
$unknow_contacts[] = array(
- "type" => "c",
- "photo" => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO),
- "name" => htmlentities($row['author-name']),
- "id" => '',
- "network" => "unknown",
- "link" => $row['author-link'],
- "nick" => htmlentities($nick),
- "forum" => false
+ 'type' => 'c',
+ 'photo' => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO),
+ 'name' => htmlentities($row['author-name']),
+ 'id' => '',
+ 'network' => 'unknown',
+ 'link' => $row['author-link'],
+ 'nick' => htmlentities($nick),
+ 'forum' => false
);
}
}
}
$results = array(
- "tot" => $tot,
- "start" => $start,
- "count" => $count,
- "groups" => $groups,
- "contacts" => $contacts,
- "items" => $items,
- "type" => $type,
- "search" => $search,
+ 'tot' => $tot,
+ 'start' => $start,
+ 'count' => $count,
+ 'groups' => $groups,
+ 'contacts' => $contacts,
+ 'items' => $items,
+ 'type' => $type,
+ 'search' => $search,
);
call_hooks('acl_lookup_end', $results);
if($out_type === 'html') {
$o = array(
- 'tot' => $results["tot"],
- 'start' => $results["start"],
- 'count' => $results["count"],
- 'groups' => $results["groups"],
- 'contacts' => $results["contacts"],
+ 'tot' => $results['tot'],
+ 'start' => $results['start'],
+ 'count' => $results['count'],
+ 'groups' => $results['groups'],
+ 'contacts' => $results['contacts'],
);
return $o;
}
$o = array(
- 'tot' => $results["tot"],
- 'start' => $results["start"],
- 'count' => $results["count"],
- 'items' => $results["items"],
+ 'tot' => $results['tot'],
+ 'start' => $results['start'],
+ 'count' => $results['count'],
+ 'items' => $results['items'],
);
echo json_encode($o);
// logger('navbar_complete');
- if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+ if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
return;
}
$mode = $_REQUEST['smode'];
// don't search if search term has less than 2 characters
- if(! $search || mb_strlen($search) < 2)
+ if (! $search || mb_strlen($search) < 2) {
return array();
+ }
- if(substr($search,0,1) === '@')
+ if (substr($search,0,1) === '@') {
$search = substr($search,1);
+ }
- if($localsearch) {
+ if ($localsearch) {
$x = DirSearch::global_search_by_name($search, $mode);
return $x;
}
- if(! $localsearch) {
+ if (! $localsearch) {
$p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
$x = z_fetch_url(get_server().'/lsearch?f=' . $p . '&search=' . urlencode($search));
- if($x['success']) {
+ if ($x['success']) {
$t = 0;
$j = json_decode($x['body'],true);
- if($j && $j['results']) {
+ if ($j && $j['results']) {
return $j['results'];
}
}
}
+
+ /// @TODO Not needed here?
return;
}
$tpl = get_markup_template($template_file);
$o = replace_macros($tpl, array(
- '$type' => 'image',
- '$baseurl' => App::get_baseurl(),
- '$path' => $path,
- '$folders' => $albums,
- '$files' =>$files,
- '$cancel' => t('Cancel'),
+ '$type' => 'image',
+ '$baseurl' => App::get_baseurl(),
+ '$path' => $path,
+ '$folders' => $albums,
+ '$files' => $files,
+ '$cancel' => t('Cancel'),
'$nickname' => $a->user['nickname'],
));
break;
case "file":
- if ($a->argc==2){
+ if ($a->argc==2) {
$files = q("SELECT `id`, `filename`, `filetype` FROM `attach` WHERE `uid` = %d ",
intval(local_user())
);
list($m1,$m2) = explode("/",$rr['filetype']);
$filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
- if($a->theme['template_engine'] === 'internal') {
+ if ($a->theme['template_engine'] === 'internal') {
$filename_e = template_escape($rr['filename']);
- }
- else {
+ } else {
$filename_e = $rr['filename'];
}
$tpl = get_markup_template($template_file);
$o = replace_macros($tpl, array(
- '$type' => 'file',
- '$baseurl' => App::get_baseurl(),
- '$path' => array( array( "", t("Files")) ),
- '$folders' => false,
- '$files' =>$files,
- '$cancel' => t('Cancel'),
+ '$type' => 'file',
+ '$baseurl' => App::get_baseurl(),
+ '$path' => array( array( "", t("Files")) ),
+ '$folders' => false,
+ '$files' =>$files,
+ '$cancel' => t('Cancel'),
'$nickname' => $a->user['nickname'],
));