diff options
Diffstat (limited to 'mod/apiadmin')
-rw-r--r-- | mod/apiadmin/actions/generate.php | 35 | ||||
-rw-r--r-- | mod/apiadmin/actions/revokekey.php | 23 | ||||
-rw-r--r-- | mod/apiadmin/index.php | 36 | ||||
-rw-r--r-- | mod/apiadmin/languages/en.php | 41 | ||||
-rw-r--r-- | mod/apiadmin/manifest.xml | 9 | ||||
-rw-r--r-- | mod/apiadmin/start.php | 79 | ||||
-rw-r--r-- | mod/apiadmin/views/default/apiadmin/forms/add_key.php | 13 | ||||
-rw-r--r-- | mod/apiadmin/views/default/object/api_key.php | 35 |
8 files changed, 0 insertions, 271 deletions
diff --git a/mod/apiadmin/actions/generate.php b/mod/apiadmin/actions/generate.php deleted file mode 100644 index cbc43e228..000000000 --- a/mod/apiadmin/actions/generate.php +++ /dev/null @@ -1,35 +0,0 @@ -<?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 diff --git a/mod/apiadmin/actions/revokekey.php b/mod/apiadmin/actions/revokekey.php deleted file mode 100644 index 6252c3828..000000000 --- a/mod/apiadmin/actions/revokekey.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - - global $CONFIG; - - admin_gatekeeper(); - action_gatekeeper(); - - $key = (int)get_input('keyid'); - - $obj = get_entity($key); - - if (($obj) && ($obj instanceof ElggObject) && ($obj->subtype == get_subtype_id('object', 'api_key'))) - { - if ($obj->delete()) - system_message(elgg_echo('apiadmin:keyrevoked')); - else - register_error(elgg_echo('apiadmin:keynotrevoked')); - } - else - register_error(elgg_echo('apiadmin:keynotrevoked')); - - forward($_SERVER['HTTP_REFERER']); -?>
\ No newline at end of file diff --git a/mod/apiadmin/index.php b/mod/apiadmin/index.php deleted file mode 100644 index 3c6e5c541..000000000 --- a/mod/apiadmin/index.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - /** - * Elgg API Admin - * - * @package ElggAPIAdmin - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2009 - * @link http://elgg.com/ - */ - - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - admin_gatekeeper(); - set_context('admin'); - - $limit = get_input('limit', 10); - $offset = get_input('offset', 0); - - // Set admin user for user block - set_page_owner($_SESSION['guid']); - - - $title = elgg_view_title(elgg_echo('apiadmin')); - - // Display add form - $body .= elgg_view('apiadmin/forms/add_key'); - - // List entities - set_context('search'); - $body .= list_entities('object', 'api_key'); - set_context('admin'); - - // Display main admin menu - page_draw(elgg_echo('apitest'),elgg_view_layout("two_column_left_sidebar", '', $title . $body)); -?>
\ No newline at end of file diff --git a/mod/apiadmin/languages/en.php b/mod/apiadmin/languages/en.php deleted file mode 100644 index c1cfb9984..000000000 --- a/mod/apiadmin/languages/en.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - /** - * API Admin language pack. - * - * @package ElggAPIAdmin - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2009 - * @link http://elgg.com/ - */ - - - $english = array( - - /** - * Menu items and titles - */ - - 'apiadmin' => 'API Administration', - - - 'apiadmin:keyrevoked' => 'API Key revoked', - 'apiadmin:keynotrevoked' => 'API Key could not be revoked', - 'apiadmin:generated' => 'API Key successfully generated', - - 'apiadmin:yourref' => 'Your reference', - 'apiadmin:generate' => 'Generate a new keypair', - - 'apiadmin:noreference' => 'You must provide a reference for your new key.', - 'apiadmin:generationfail' => 'There was a problem generating the new keypair', - 'apiadmin:generated' => 'New API keypair generated successfully', - - 'apiadmin:revoke' => 'Revoke key', - 'apiadmin:public' => 'Public', - 'apiadmin:private' => 'Private', - - - 'item:object:api_key' => 'API Keys', - ); - - add_translation("en",$english); -?>
\ No newline at end of file diff --git a/mod/apiadmin/manifest.xml b/mod/apiadmin/manifest.xml deleted file mode 100644 index 469cfe006..000000000 --- a/mod/apiadmin/manifest.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<plugin_manifest> - <field key="author" value="Curverider Ltd" /> - <field key="version" value="1.0" /> - <field key="description" value="API Admin" /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2009" /> - <field key="elgg_version" value="2009021901" /> -</plugin_manifest>
\ No newline at end of file diff --git a/mod/apiadmin/start.php b/mod/apiadmin/start.php deleted file mode 100644 index 5c9d4cce2..000000000 --- a/mod/apiadmin/start.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php - /** - * Elgg API Admin - * - * @package ElggAPIAdmin - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2009 - * @link http://elgg.com/ - */ - - /** - * Initialise the API Admin tool - * - * @param unknown_type $event - * @param unknown_type $object_type - * @param unknown_type $object - */ - function apiadmin_init($event, $object_type, $object = null) { - - global $CONFIG; - - // Register a page handler, so we can have nice URLs - register_page_handler('apiadmin','apiadmin_page_handler'); - - // Register some actions - register_action("apiadmin/revokekey",false, $CONFIG->pluginspath . "apiadmin/actions/revokekey.php", true); - register_action("apiadmin/generate",false, $CONFIG->pluginspath . "apiadmin/actions/generate.php", true); - } - - /** - * Page setup. Adds admin controls to the admin panel. - * - */ - function apiadmin_pagesetup() - { - if (get_context() == 'admin' && isadminloggedin()) { - global $CONFIG; - add_submenu_item(elgg_echo('apiadmin'), $CONFIG->wwwroot . 'pg/apiadmin/'); - } - } - - - function apiadmin_page_handler($page) - { - global $CONFIG; - - if ($page[0]) - { - switch ($page[0]) - { - default : include($CONFIG->pluginspath . "apiadmin/index.php"); - } - } - else - include($CONFIG->pluginspath . "apiadmin/index.php"); - } - - function apiadmin_delete_key($event, $object_type, $object = null) - { - global $CONFIG; - - if (($object) && ($object->subtype == get_subtype_id('object', 'api_key'))) - { - // Delete - return remove_api_user($CONFIG->site_id, $object->public); - } - - return true; - } - - - // Make sure test_init is called on initialisation - register_elgg_event_handler('init','system','apiadmin_init'); - register_elgg_event_handler('pagesetup','system','apiadmin_pagesetup'); - - // Hook into delete to revoke secret keys - register_elgg_event_handler('delete','object','apiadmin_delete_key'); -?>
\ No newline at end of file diff --git a/mod/apiadmin/views/default/apiadmin/forms/add_key.php b/mod/apiadmin/views/default/apiadmin/forms/add_key.php deleted file mode 100644 index efa871e70..000000000 --- a/mod/apiadmin/views/default/apiadmin/forms/add_key.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - $ref_label = elgg_echo('apiadmin:yourref'); - $ref_control = elgg_view('input/text', array('internalname' => 'ref')); - $gen_control = elgg_view('input/submit', array('value' => elgg_echo('apiadmin:generate'))); - - $form_body = <<< END - <div class="contentWrapper"> - <p>$ref_label: $ref_control $gen_control</p> - </div> -END; - - echo elgg_view('input/form', array('action' => "{$vars['url']}action/apiadmin/generate", "body" => $form_body)); -?>
\ No newline at end of file diff --git a/mod/apiadmin/views/default/object/api_key.php b/mod/apiadmin/views/default/object/api_key.php deleted file mode 100644 index 64ca3d087..000000000 --- a/mod/apiadmin/views/default/object/api_key.php +++ /dev/null @@ -1,35 +0,0 @@ -<?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); -?>
\ No newline at end of file |