X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Facl_selectors.php;h=71a42478ba92c06b80c02f6f3d332af6382deba4;hb=6ef69ad2dac6938643c8995dcbf39b63a7f235e2;hp=d78393aeee462725509f9334eac2f17b62ee9f92;hpb=39a849c113de16a4e1f09a9b197cd2491cf4d6fa;p=friendica.git diff --git a/include/acl_selectors.php b/include/acl_selectors.php index d78393aeee..71a42478ba 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -1,13 +1,15 @@ $g['photo'], + "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), ); } } @@ -581,7 +587,7 @@ function acl_lookup(&$a, $out_type = 'json') { "network" => $g['network'], "link" => $g['url'], "nick" => htmlentities(($g['attag']) ? $g['attag'] : $g['nick']), - "forum" => $g['forum'] + "forum" => ((x($g['forum']) || x($g['prv'])) ? 1 : 0), ); } } @@ -631,29 +637,47 @@ function acl_lookup(&$a, $out_type = 'json') { $tot += count($unknow_contacts); } + $results = array( + "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' => $tot, - 'start' => $start, - 'count' => $count, - 'groups' => $groups, - 'contacts' => $contacts, + 'tot' => $results["tot"], + 'start' => $results["start"], + 'count' => $results["count"], + 'groups' => $results["groups"], + 'contacts' => $results["contacts"], ); return $o; } $o = array( - 'tot' => $tot, - 'start' => $start, - 'count' => $count, - 'items' => $items, + 'tot' => $results["tot"], + 'start' => $results["start"], + 'count' => $results["count"], + 'items' => $results["items"], ); echo json_encode($o); killme(); } - +/** + * @brief Searching for global contacts for autocompletion + * + * @param App $a + * @return array with the search results + */ function navbar_complete(&$a) { // logger('navbar_complete'); @@ -662,41 +686,26 @@ function navbar_complete(&$a) { return; } - $local = get_config('system','poco_local_search'); - $local = true; + // check if searching in the local global contact table is enabled + $localsearch = get_config('system','poco_local_search'); $search = $prefix.notags(trim($_REQUEST['search'])); + $mode = $_REQUEST['smode']; + + // don't search if search term has less than 2 characters if(! $search || mb_strlen($search) < 2) return array(); - $star = false; - $address = false; - if(substr($search,0,1) === '@') $search = substr($search,1); - if(substr($search,0,1) === '*') { - $star = true; - $search = substr($search,1); - } - - if(strpos($search,'@') !== false) { - $address = true; - } - - if($local) { - require_once("include/dir_fns.php"); - $x = dirsearch_autocomplete($search); + if($localsearch) { + $x = DirSearch::global_search_by_name($search, $mode); return $x; } - if(! $local) { - require_once("include/dir_fns.php"); - $url = $directory['url'] . '/dirsearch'; - - + 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']) { @@ -708,4 +717,4 @@ function navbar_complete(&$a) { } } return; -} \ No newline at end of file +}