aboutsummaryrefslogtreecommitdiff
path: root/mod/apiadmin/views/default/object/api_key.php
blob: 26d452be5c34f3904b23331d5b186266d70e68f4 (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
<?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><p><b>{$entity->title}</b> <a href=\"{$CONFIG->url}actions/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}</p></div>"; 
	}
	
	echo elgg_view_listing($icon, $info);
?>