Merge pull request #2491 from rabuzarus/2804_acl_hook

add a hook call to acl_lookup()
This commit is contained in:
Michael Vogel 2016-04-29 14:03:02 +02:00
commit 6a739b5ba2
2 changed files with 29 additions and 9 deletions

View file

@ -281,6 +281,11 @@ $b is an array with:
'template' => filename of template 'template' => filename of template
'vars' => array of vars passed to template 'vars' => array of vars passed to template
### ''acl_lookup_end'
is called after the other queries have passed.
The registered function can add, change or remove the acl_lookup() variables.
'results' => array of the acl_lookup() vars
Complete list of hook callbacks Complete list of hook callbacks
@ -338,6 +343,8 @@ include/acl_selectors.php: call_hooks($a->module . '_pre_' . $selname, $arr);
include/acl_selectors.php: call_hooks($a->module . '_post_' . $selname, $o); include/acl_selectors.php: call_hooks($a->module . '_post_' . $selname, $o);
include/acl_selectors.php call_hooks('acl_lookup_end', $results);
include/notifier.php: call_hooks('notifier_normal',$target_item); include/notifier.php: call_hooks('notifier_normal',$target_item);
include/notifier.php: call_hooks('notifier_end',$target_item); include/notifier.php: call_hooks('notifier_end',$target_item);

View file

@ -637,22 +637,35 @@ function acl_lookup(&$a, $out_type = 'json') {
$tot += count($unknow_contacts); $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') { if($out_type === 'html') {
$o = array( $o = array(
'tot' => $tot, 'tot' => $results["tot"],
'start' => $start, 'start' => $results["start"],
'count' => $count, 'count' => $results["count"],
'groups' => $groups, 'groups' => $results["groups"],
'contacts' => $contacts, 'contacts' => $results["contacts"],
); );
return $o; return $o;
} }
$o = array( $o = array(
'tot' => $tot, 'tot' => $results["tot"],
'start' => $start, 'start' => $results["start"],
'count' => $count, 'count' => $results["count"],
'items' => $items, 'items' => $results["items"],
); );
echo json_encode($o); echo json_encode($o);