From 35ad4f06a100ff23556f598c0fb51724b79f2bd0 Mon Sep 17 00:00:00 2001
From: dave
Date: Tue, 17 Jun 2008 08:07:25 +0000
Subject: removed guid exporter, exporttest and apitest from core and put them
into the plugins folder
git-svn-id: https://code.elgg.org/elgg/trunk@941 36083f99-b078-4883-b0ff-0f9b5a30f544
---
mod/apitest/index.php | 79 -------
mod/apitest/start.php | 251 ---------------------
mod/apitest/views/default/apitest/configform.php | 18 --
mod/apitest/views/default/apitest/main.php | 34 ---
mod/exporttest/index.php | 40 ----
mod/exporttest/start.php | 24 --
mod/exporttest/views/default/exporttest/main.php | 22 --
.../views/default/exporttest/outputxml.php | 15 --
mod/guidbrowser/index.php | 54 -----
mod/guidbrowser/languages/en.php | 24 --
mod/guidbrowser/start.php | 60 -----
.../views/default/guidbrowser/browser.php | 35 ---
.../views/default/guidbrowser/entity.php | 32 ---
.../views/default/guidbrowser/entity_full.php | 125 ----------
.../views/default/guidbrowser/newentity.php | 11 -
.../views/default/guidbrowser/prevnext.php | 30 ---
16 files changed, 854 deletions(-)
delete mode 100644 mod/apitest/index.php
delete mode 100644 mod/apitest/start.php
delete mode 100644 mod/apitest/views/default/apitest/configform.php
delete mode 100644 mod/apitest/views/default/apitest/main.php
delete mode 100644 mod/exporttest/index.php
delete mode 100644 mod/exporttest/start.php
delete mode 100644 mod/exporttest/views/default/exporttest/main.php
delete mode 100644 mod/exporttest/views/default/exporttest/outputxml.php
delete mode 100644 mod/guidbrowser/index.php
delete mode 100644 mod/guidbrowser/languages/en.php
delete mode 100644 mod/guidbrowser/start.php
delete mode 100644 mod/guidbrowser/views/default/guidbrowser/browser.php
delete mode 100644 mod/guidbrowser/views/default/guidbrowser/entity.php
delete mode 100644 mod/guidbrowser/views/default/guidbrowser/entity_full.php
delete mode 100644 mod/guidbrowser/views/default/guidbrowser/newentity.php
delete mode 100644 mod/guidbrowser/views/default/guidbrowser/prevnext.php
(limited to 'mod')
diff --git a/mod/apitest/index.php b/mod/apitest/index.php
deleted file mode 100644
index 105c44409..000000000
--- a/mod/apitest/index.php
+++ /dev/null
@@ -1,79 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- require_once("../../engine/start.php");
-
- global $CONFIG, $API_CLIENT;
-
-
- // Get some variables
- $apikey = get_input("apikey");
- $secret = get_input("secret");
- $endpoint = get_input("endpoint");
-
-
- if ($_REQUEST['action'] == "configure")
- apitest_configure($apikey, $secret, $endpoint);
-
- // Get a list of commands
- if ($API_CLIENT->configured == true)
- {
- $commands = apitest_call(
- array (
- 'method' => 'system.api.list'
- )
- );
- $commands = $commands->result;
- }
-
- /* See if we are executing a method - This is a quick demo, obviously use functions as they are much easier!*/
- if (isset($_REQUEST['method']))
- {
-
- $command_details = $commands[$_REQUEST['method']];
- $auth_req = $command_details['require_auth'] == 1 ? true : false;
-
- $params = array();
- $params['method'] = $_REQUEST['method'];
- if ($auth_req)
- $params['auth_token'] = $_REQUEST['auth_token'];
-
- foreach ($command_details['parameters'] as $k => $v)
- {
- $params[$k] = $_REQUEST[$k];
- }
-
- $result = apitest_call($params, $_REQUEST['post_data']);
-
-
- if ($result->status == 0)
- system_message("".print_r($result->result, true)."
");
- else
- register_error($result->message);
-
- if (!is_object($result)) echo $LAST_CALL_RAW;
-
-
-
- }
-
- // Draw command form
- $list = "";
- foreach ($commands as $command => $details)
- $list .= apitest_draw_command_form($command, $details);
-
- $body = elgg_view_layout("one_column", elgg_view("apitest/main", array(
- "config" => apitest_draw_config_panel(),
- "commandlist" => $list
- )));
-
- page_draw("API Commands",$body);
-?>
\ No newline at end of file
diff --git a/mod/apitest/start.php b/mod/apitest/start.php
deleted file mode 100644
index d03c7925a..000000000
--- a/mod/apitest/start.php
+++ /dev/null
@@ -1,251 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- $API_CLIENT = new stdClass;
-
- // Status variables we can query later
- $LAST_CALL = null;
- $LAST_CALL_RAW = "";
- $LAST_ERROR = null;
-
-
- function apitest_init($event, $object_type, $object = null) {
-
- global $CONFIG;
-
- add_menu("API Test",$CONFIG->wwwroot . "mod/apitest/",array(
- menu_item("The API Tester plugin",$CONFIG->wwwroot."mod/apitest/"),
- ));
- }
-
- /**
- * Generate our HMAC.
- */
- function apitest_calculate_hmac($algo, $time, $api_key, $secret_key, $get_variables, $post_hash = "")
- {
- $ctx = hash_init($algo, HASH_HMAC, $secret_key);
-
- hash_update($ctx, trim($time));
- hash_update($ctx, trim($api_key));
- hash_update($ctx, trim($get_variables));
- if (trim($post_hash)!="") hash_update($ctx, trim($post_hash));
-
- return hash_final($ctx);
- }
-
- /**
- * Generate our POST hash.
- */
- function apitest_calculate_posthash($postdata, $algo)
- {
- $ctx = hash_init($algo);
-
- hash_update($ctx, $postdata);
-
- return hash_final($ctx);
- }
-
- /**
- * Serialise HTTP headers.
- */
- function apitest_serialise_headers(array $headers)
- {
- $headers_str = "";
-
- foreach ($headers as $k => $v)
- $headers_str .= trim($k) . ": " . trim($v) . "\r\n";
-
- return trim($headers_str);
- }
-
- /**
- * Make a raw call.
- * @param array $method Method call parameters.
- * @param string $postdata Optional POST data.
- * @param string $content_type The content type.
- * @return stdClass
- */
- function apitest_call(array $method, $postdata = "", $content_type = 'application/octet-stream')
- {
- // Get the config
- global $API_CLIENT, $LAST_CALL, $LAST_CALL_RAW, $LAST_ERROR;
-
- $headers = array();
- $encoded_params = array();
-
- $time = microtime(true); // Get the current time in microseconds
- $request = ($postdata!="" ? "POST" : "GET"); // Get the request method, either post or get
-
- // Hard code the format - we're using PHP, so lets use PHP serialisation.
- $method['format'] = "php";
-
- // URL encode all the parameters
- foreach ($method as $k => $v){
- if (is_array($v))
- {
- foreach ($v as $v2)
- {
- $encoded_params[] = urlencode($k).'[]='.urlencode($v2);
- }
- }
- else
- $encoded_params[] = urlencode($k).'='.urlencode($v);
- }
-
- $params = implode('&', $encoded_params);
-
- // Put together the query string
- $url = $API_CLIENT->api_endpoint."?". $params;
-
- // Construct headers
- $posthash = "";
- if ($request=='POST')
- {
- $posthash = apitest_calculate_posthash($postdata, $API_CLIENT->postdata_hash_algo);
-
- $headers['X-Elgg-posthash'] = $posthash;
- $headers['X-Elgg-posthash-algo'] = $API_CLIENT->postdata_hash_algo;
- $headers['Content-type'] = $content_type;
- $headers['Content-Length'] = strlen($postdata);
- }
-
- $headers['X-Elgg-apikey'] = $API_CLIENT->api_key;
- $headers['X-Elgg-time'] = $time;
- $headers['X-Elgg-hmac-algo'] = $API_CLIENT->hmac_algo;
- $headers['X-Elgg-hmac'] = apitest_calculate_hmac($API_CLIENT->hmac_algo,
- $time,
- $API_CLIENT->api_key,
- $API_CLIENT->secret,
- $params,
- $posthash
- );
-
- // Configure stream options
- $opts = array(
- 'http'=>array(
- 'method'=> $request,
- 'header'=> apitest_serialise_headers($headers)
- )
- );
-
- // If this is a post request then set the content
- if ($request=='POST')
- $opts['http']['content'] = $postdata;
-
- // Set stream options
- $context = stream_context_create($opts);
-
- // Send the query and get the result and decode.
- $LAST_CALL_RAW = file_get_contents($url, false, $context);
- $LAST_CALL = unserialize($LAST_CALL_RAW);
-
- if (($LAST_CALL) && ($LAST_CALL->status!=0)) // Check to see if this was an error
- $LAST_ERROR = $LAST_CALL;
-
- return $LAST_CALL; // Return a stdClass containing the API result
- }
-
- function apitest_configure($apikey, $secret, $endpoint = "")
- {
- global $CONFIG;
- global $API_CLIENT;
-
- $apikey = sanitise_string($apikey);
- $secret = sanitise_string($secret);
- $endpoint = sanitise_string($endpoint);
-
- if ($endpoint=="")
- $endpoint = $CONFIG->wwwroot . "services/api/rest.php";
-
- $API_CLIENT->api_key = $apikey;
- $API_CLIENT->secret = $secret;
- $API_CLIENT->api_endpoint = $endpoint;
- $API_CLIENT->hmac_algo = 'sha1';
- $API_CLIENT->postdata_hash_algo = 'md5';
- $API_CLIENT->configured = true;
- }
-
- function apitest_draw_command_form($command, $details)
- {
- global $API_CLIENT;
-
- $params = array();
-
- // If authentication is required then ensure this is prompted for
- if ($details->require_auth == true)
- $params['auth_token'] = $_REQUEST['auth_token'];
-
-
- // Compile a list of parameters
- foreach ($details['parameters'] as $k => $v)
- {
- $params[$k] = $_REQUEST[$k];
- }
-
- // Construct list of variables
- $variables = "";
- foreach ($params as $k => $v)
- {
- $variables .= $k;
- $variables .= "";
-
- if (isset($details['parameters'][$k]['required']) && ($details['parameters'][$k]['required']!=0))
- $variables .= " (optional)";
-
- $variables .= ", ";
- }
-
- // Do we need to provide post data?
- $postdata = "";
- if ($details->call_method == 'POST')
- $postdata = "add post data...";
-
- $body = <<< END
-
-
-
-
- $command (desc):
-
- $variables
-
- $postdata
-
-
- {$details['description']}
-
-
-
-
-END;
-
- return $body;
- }
-
-
- function apitest_draw_config_panel()
- {
- global $API_CLIENT;
-
- return elgg_view("apitest/configform", array(
- "apikey" => $API_CLIENT->api_key,
- "secret" => $API_CLIENT->secret,
- "endpoint" => $API_CLIENT->api_endpoint
- ));
- }
-
- // Make sure test_init is called on initialisation
- register_elgg_event_handler('init','system','apitest_init');
-?>
\ No newline at end of file
diff --git a/mod/apitest/views/default/apitest/configform.php b/mod/apitest/views/default/apitest/configform.php
deleted file mode 100644
index ccada5940..000000000
--- a/mod/apitest/views/default/apitest/configform.php
+++ /dev/null
@@ -1,18 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-?>
-
\ No newline at end of file
diff --git a/mod/apitest/views/default/apitest/main.php b/mod/apitest/views/default/apitest/main.php
deleted file mode 100644
index bca518cc0..000000000
--- a/mod/apitest/views/default/apitest/main.php
+++ /dev/null
@@ -1,34 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-?>
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/mod/exporttest/index.php b/mod/exporttest/index.php
deleted file mode 100644
index f3010d971..000000000
--- a/mod/exporttest/index.php
+++ /dev/null
@@ -1,40 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- require_once("../../engine/start.php");
-
- global $CONFIG;
-
- $guid = get_input("guid");
- $action = get_input("action");
-
- // Get the user
- $owner_id = page_owner();
-
- if ($guid)
- {
- echo elgg_view_layout("one_column", elgg_view("exporttest/outputxml", array("xml" => export($guid))));
- }
- else if ($action=='import')
- {
- $area1 = print_r(import(get_input('xml')), true);
- $area1 .= elgg_view("exporttest/main", array("owner_id" => $owner_id));
-
- $body = elgg_view_layout("one_column", $area1);
-
- page_draw("Import results",$body);
- }
- else
- {
- $body = elgg_view_layout("one_column", elgg_view("exporttest/main", array("owner_id" => $owner_id)));
- page_draw("Export a GUID",$body);
- }
-?>
\ No newline at end of file
diff --git a/mod/exporttest/start.php b/mod/exporttest/start.php
deleted file mode 100644
index 3e1817878..000000000
--- a/mod/exporttest/start.php
+++ /dev/null
@@ -1,24 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- function exporttest_init($event, $object_type, $object = null) {
-
- global $CONFIG;
-
- add_menu("Export GUID",$CONFIG->wwwroot . "mod/exporttest/",array(
- menu_item("The GUID Exporter",$CONFIG->wwwroot."mod/exporttest/"),
- ));
- }
-
-
- // Make sure test_init is called on initialisation
- register_elgg_event_handler('init','system','exporttest_init');
-?>
\ No newline at end of file
diff --git a/mod/exporttest/views/default/exporttest/main.php b/mod/exporttest/views/default/exporttest/main.php
deleted file mode 100644
index ea338052b..000000000
--- a/mod/exporttest/views/default/exporttest/main.php
+++ /dev/null
@@ -1,22 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-?>
-
-
-
-
\ No newline at end of file
diff --git a/mod/exporttest/views/default/exporttest/outputxml.php b/mod/exporttest/views/default/exporttest/outputxml.php
deleted file mode 100644
index 92c971ccd..000000000
--- a/mod/exporttest/views/default/exporttest/outputxml.php
+++ /dev/null
@@ -1,15 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- header("Content-type: text/xml");
-
- echo $vars['xml'];
-?>
\ No newline at end of file
diff --git a/mod/guidbrowser/index.php b/mod/guidbrowser/index.php
deleted file mode 100644
index cbb3986d2..000000000
--- a/mod/guidbrowser/index.php
+++ /dev/null
@@ -1,54 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- require_once("../../engine/start.php");
-
- $eguid = get_input('eguid');
- $limit = get_input('limit', 10);
- $offset = get_input('offset');
- $type = get_input('type');
- $subtype = get_input('subtype');
-
- $action = get_input('subtype');
- $key = get_input('key');
- $value = get_input('value');
-
- $relationship = get_input('relationship');
- $guid2 = get_input('guid2');
-
-
- switch ($callaction)
- {
- case 'metadata' :
- if (!create_metadata($eguid, $key, $value))
- echo "Could not create metadata with $eguid:$key:$value";
- break;
-
- case 'annotations' :
- if (!create_annotation($eguid, $key, $value))
- echo "Could not create metadata with $eguid:$key:$value";
- break;
-
- case 'relationship' :
- if (!add_entity_relationship($eguid, $relationship, $guid2))
- echo "Could not create relationship between $eguid:$relationship:$guid2";
- break;
- }
-
- // Get the current page's owner
- $page_owner = page_owner_entity();
-
- // Display
- $body = elgg_view_layout("one_column", guidbrowser_display($offset, $limit, $type, $subtype));
-
- // Display page
- page_draw(elgg_echo("guidbrowser"), $body);
-?>
\ No newline at end of file
diff --git a/mod/guidbrowser/languages/en.php b/mod/guidbrowser/languages/en.php
deleted file mode 100644
index 0eee183eb..000000000
--- a/mod/guidbrowser/languages/en.php
+++ /dev/null
@@ -1,24 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- $english = array(
-
- /**
- * Menu items and titles
- */
-
- 'guidbrowser' => "GUID Browser"
-
-
- );
-
- add_translation("en", $english);
-?>
\ No newline at end of file
diff --git a/mod/guidbrowser/start.php b/mod/guidbrowser/start.php
deleted file mode 100644
index a75711c1d..000000000
--- a/mod/guidbrowser/start.php
+++ /dev/null
@@ -1,60 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- function guidbrowser_init($event, $object_type, $object = null) {
-
- global $CONFIG;
- // register_translations($CONFIG->pluginspath . "guidbrowser/languages/");
- add_menu("GUID Browser",$CONFIG->wwwroot . "mod/tasklist/",array(
- menu_item("The GUID browser",$CONFIG->wwwroot."mod/guidbrowser/"),
- ));
- }
-
- function guidbrowser_displayentity($entity)
- {
- return elgg_view("guidbrowser/entity",
- array(
- 'entity_guid' => $entity->guid,
- 'type' => $entity->type,
- 'subtype' => $entity->getSubtype(),
- 'full' => elgg_view(
- "guidbrowser/entity_full",
- array(
- 'entity' => $entity,
- 'metadata' => get_metadata_for_entity($entity->guid),
- 'annotations' => get_annotations($entity->guid),
- 'relationships' => get_entity_relationships($entity->guid)
- )
- )
- )
- );
- }
-
- function guidbrowser_display($offset = 0, $limit = 10, $type = "", $subtype = "")
- {
- $entities = get_entities($type, $subtype, page_owner(), "time_created desc", $limit, $offset);
- $display = "";
-
- foreach ($entities as $e)
- $display .= guidbrowser_displayentity($e);
-
- return elgg_view("guidbrowser/browser",
- array(
- 'entities' => $display,
- 'prevnext' => elgg_view("guidbrowser/prevnext", array("limit" => $limit, "offset" => $offset))
- )
- );
- }
-
-
- // Make sure test_init is called on initialisation
- register_elgg_event_handler('init','system','guidbrowser_init');
-?>
\ No newline at end of file
diff --git a/mod/guidbrowser/views/default/guidbrowser/browser.php b/mod/guidbrowser/views/default/guidbrowser/browser.php
deleted file mode 100644
index c1f5bb792..000000000
--- a/mod/guidbrowser/views/default/guidbrowser/browser.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- $navbar = $vars['prevnext'];
- $entities = $vars['entities'];
-?>
-
-
-
\ No newline at end of file
diff --git a/mod/guidbrowser/views/default/guidbrowser/entity.php b/mod/guidbrowser/views/default/guidbrowser/entity.php
deleted file mode 100644
index 94fd4e92c..000000000
--- a/mod/guidbrowser/views/default/guidbrowser/entity.php
+++ /dev/null
@@ -1,32 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- $guid = $vars['entity_guid'];
- $type = $vars['type'];
- $subtype = $vars['subtype'];
- $full = $vars['full'];
-
-?>
-
-
\ No newline at end of file
diff --git a/mod/guidbrowser/views/default/guidbrowser/entity_full.php b/mod/guidbrowser/views/default/guidbrowser/entity_full.php
deleted file mode 100644
index 62dd78264..000000000
--- a/mod/guidbrowser/views/default/guidbrowser/entity_full.php
+++ /dev/null
@@ -1,125 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- $entity = $vars['entity'];
- $metadata = $vars['metadata'];
- $annotations = $vars['annotations'];
- $relationships = $vars['relationships'];
-
-?>
-
-
-
-
-
-
\ No newline at end of file
diff --git a/mod/guidbrowser/views/default/guidbrowser/newentity.php b/mod/guidbrowser/views/default/guidbrowser/newentity.php
deleted file mode 100644
index f46524e94..000000000
--- a/mod/guidbrowser/views/default/guidbrowser/newentity.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-?>
\ No newline at end of file
diff --git a/mod/guidbrowser/views/default/guidbrowser/prevnext.php b/mod/guidbrowser/views/default/guidbrowser/prevnext.php
deleted file mode 100644
index 0624173cf..000000000
--- a/mod/guidbrowser/views/default/guidbrowser/prevnext.php
+++ /dev/null
@@ -1,30 +0,0 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- global $CONFIG;
-
- $limit = $vars['limit'];
- $offset = $vars['offset'];
- $type = $vars['type'];
- $subtype = $vars['subtype'];
-
-
- $common = "&type=$type&subtype=$subtype";
-?>
-
-
\ No newline at end of file
--
cgit v1.2.3