blob: 32265bab31e08a6490bb6d806fee15ace9884c66 (
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;
admin_gatekeeper();
action_gatekeeper();
$ref = get_input('ref');
if ($ref)
{
$keypair = create_api_user($CONFIG->site_id);
if ($keypair)
{
$newkey = new ElggObject();
$newkey->subtype = 'api_key';
$newkey->access_id = 2;
$newkey->title = $ref;
$newkey->public = $keypair->api_key;
if (!$newkey->save())
register_error(elgg_echo('apiadmin:generationfail'));
else
system_message(elgg_echo('apiadmin:generated'));
}
else
register_error(elgg_echo('apiadmin:generationfail'));
}
else
register_error(elgg_echo('apiadmin:noreference'));
forward($_SERVER['HTTP_REFERER']);
?>
|