aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/api.php
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-19 17:03:21 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-19 17:03:21 +0000
commitd8f325d0979a97932a7d5ebba0d9c2ccd8dcf6f3 (patch)
treebd26b58cec4761999b776c19f72a8c981ff13e9e /engine/lib/api.php
parent8682dee527edc5f1e586d2c869cead1f3256aed3 (diff)
downloadelgg-d8f325d0979a97932a7d5ebba0d9c2ccd8dcf6f3.tar.gz
elgg-d8f325d0979a97932a7d5ebba0d9c2ccd8dcf6f3.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Exports working system.api.list git-svn-id: https://code.elgg.org/elgg/trunk@256 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/api.php')
-rw-r--r--engine/lib/api.php22
1 files changed, 18 insertions, 4 deletions
diff --git a/engine/lib/api.php b/engine/lib/api.php
index 26f0acf91..9c488db19 100644
--- a/engine/lib/api.php
+++ b/engine/lib/api.php
@@ -206,11 +206,10 @@
$token = sanitise_string($token);
if (!$site) throw new ConfigurationException("No site ID has been specified.");
- if (!$token) throw new APIException("User token not specified.");
$time = time();
- $user = get_data_row("SELECT * from {$CONFIG->dbprefix}users_apisessions where token='$token' and site_id=$site and expires>$time");
+ $user = get_data_row("SELECT * from {$CONFIG->dbprefix}users_apisessions where token='$token' and site_guid=$site and expires>$time");
if ($user)
return $user->user_id;
@@ -225,11 +224,11 @@
* @param string $method The api name to expose this as, eg "myapi.dosomething"
* @param string $function Your function callback.
* @param array $parameters Optional list of parameters in the same order as in your function, with optional parameters last.
- * @param string $description Optional human readable description of the function.
* @param bool $require_auth Whether this requires a user authentication token or not (default is true)
+ * @param string $description Optional human readable description of the function.
* @return bool
*/
- function expose_function($method, $function, array $parameters = NULL, $description = "", $require_auth = true)
+ function expose_function($method, $function, array $parameters = NULL, $require_auth = true, $description = "")
{
global $METHODS;
@@ -358,6 +357,21 @@
throw new APIException("Method call '$method' has not been implemented.");
}
+ // System functions ///////////////////////////////////////////////////////////////////////
+
+ /**
+ * Simple api to return a list of all api's installed on the system.
+ */
+ function list_all_apis()
+ {
+ global $METHODS;
+ return $METHODS;
+ }
+
+ // Expose some system api functions
+ expose_function("system.api.list", "list_all_apis", NULL, false, "List all available API calls on the system.");
+
+
// PAM AUTH HMAC functions ////////////////////////////////////////////////////////////////
/**