From d8f325d0979a97932a7d5ebba0d9c2ccd8dcf6f3 Mon Sep 17 00:00:00 2001 From: icewing Date: Wed, 19 Mar 2008 17:03:21 +0000 Subject: Marcus Povey * Exports working system.api.list git-svn-id: https://code.elgg.org/elgg/trunk@256 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/api.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'engine/lib') 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 //////////////////////////////////////////////////////////////// /** -- cgit v1.2.3