aboutsummaryrefslogtreecommitdiff
path: root/mod/apiadmin/views/default/object/api_key.php
blob: 64ca3d087bb9e971f7740036a749bf1cd2501577 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
	global $CONFIG;
	
	$entity = $vars['entity'];
	
	$icon = elgg_view(
			'graphics/icon', array(
			'entity' => $entity,
			'size' => 'small',
		  )
		);

		
	$public_label = elgg_echo('apiadmin:public');
	$private_label = elgg_echo('apiadmin:private');
	$revoke_label = elgg_echo('apiadmin:revoke');
	
	$ts = time();
	$token = generate_action_token($ts);
		
		
	$info = "<div class=\"contentWrapper\"><p><b>{$entity->title}</b> <a href=\"{$CONFIG->url}action/apiadmin/revokekey?keyid={$entity->guid}&__elgg_token=$token&__elgg_ts=$ts\">$revoke_label</a></p></div>";
	$info .= "<div><p><b>$public_label:</b> {$entity->public}<br />"; 
	if (isadminloggedin()) {
		// Only show secret portion to admins
		
		// Fetch key
		$keypair = get_api_user($CONFIG->site_id, $entity->public);
	
		$info .= "<b>$private_label:</b> {$keypair->secret}"; 
	}
	$info .= "</p></div>";
	
	echo elgg_view_listing($icon, $info);
?>