aboutsummaryrefslogtreecommitdiff
path: root/mod/apiadmin/actions/generate.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/apiadmin/actions/generate.php')
-rw-r--r--mod/apiadmin/actions/generate.php68
1 files changed, 34 insertions, 34 deletions
diff --git a/mod/apiadmin/actions/generate.php b/mod/apiadmin/actions/generate.php
index 32265bab3..cbc43e228 100644
--- a/mod/apiadmin/actions/generate.php
+++ b/mod/apiadmin/actions/generate.php
@@ -1,35 +1,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']);
+<?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 = ACCESS_PUBLIC;
+ $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']);
?> \ No newline at end of file