Elgg  Version 1.11
contents.php
Go to the documentation of this file.
1 <?php
2 
3 // capture global state necessary for menus
4 $state = [
5  'contexts' => elgg_get_context_stack(),
6  'input' => elgg_get_config("input"),
7  'page_owner_guid' => elgg_get_page_owner_guid(),
8 ];
9 
10 // g = guid, pog = page_owner_guid, c = contexts, m = mac
11 $guid = (int) get_input("g", 0, false);
12 $page_owner_guid = (int) get_input("pog", 0, false);
13 $contexts = (array) get_input("c", [], false);
14 $mac = get_input("m", "", false);
15 $input = (array) get_input("i", [], false);
16 
17 // verify MAC
19 
20 if (!elgg_build_hmac($data)->matchesToken($mac)) {
21  return;
22 }
23 
25 if (!$user) {
26  return;
27 }
28 
29 // render view using state as it was in the placeholder view
31 elgg_set_config("input", $input);
33 
35  "entity" => $user,
36  "username" => $user->username,
37  "name" => $user->name,
38 ];
39 
40 echo elgg_view_menu("user_hover", $params);
41 
42 // revert global state
43 elgg_set_context_stack($state['contexts']);
44 elgg_set_config("input", $state['input']);
45 elgg_set_page_owner_guid($state['page_owner_guid']);
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
$contexts
Definition: contents.php:13
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
$input
Definition: contents.php:15
if(!elgg_build_hmac($data) ->matchesToken($mac)) $user
Definition: contents.php:24
$mac
Definition: contents.php:14
elgg_set_context_stack(array $stack)
Set the entire context stack.
Definition: pageowner.php:271
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:73
$guid
Definition: contents.php:11
$state
Definition: contents.php:4
elgg_view_menu($menu_name, array $vars=array())
Render a menu.
Definition: views.php:692
get_user($guid)
Get a user object from a GUID.
Definition: users.php:87
elgg_set_config($name, $value)
Set an Elgg configuration value.
elgg_build_hmac($data)
Get an HMAC token builder/validator object.
Definition: actions.php:107
$params
Definition: contents.php:34
elgg echo
Translates a string.
Definition: languages.js:43
$page_owner_guid
Definition: contents.php:12
$data
Definition: contents.php:18
elgg_get_context_stack()
Get the entire context stack (e.g.
Definition: pageowner.php:260
elgg_get_page_owner_guid($guid=0)
Gets the guid of the entity that owns the current page.
Definition: pageowner.php:18