diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-10 17:43:39 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-10 17:43:39 +0000 |
commit | df1d8b6068b0bd979cf04555cae6285c44531465 (patch) | |
tree | 28a09cc5d57e09d36ea97e0742fa88a0909327a1 /engine/lib/api.php | |
parent | eaa0e26b19e46e0391644251ec09fe2451c67f35 (diff) | |
download | elgg-df1d8b6068b0bd979cf04555cae6285c44531465.tar.gz elgg-df1d8b6068b0bd979cf04555cae6285c44531465.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* First draft api
git-svn-id: https://code.elgg.org/elgg/trunk@144 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/api.php')
-rw-r--r-- | engine/lib/api.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/engine/lib/api.php b/engine/lib/api.php index 0e9260629..7e685cdd6 100644 --- a/engine/lib/api.php +++ b/engine/lib/api.php @@ -193,9 +193,18 @@ */ function validate_user_token($site, $token) { - $u = new User(); - - return $u->getUserIDFromAuthToken($site, $token); + global $CONFIG; + + $site = (int)$site; + $token = sanitise_string($token); + + $time = time(); + + $user = get_data_row("SELECT * from {$CONFIG->dbprefix}users_apisessions where token='$token' and site_id=$site and expires>$time"); + if ($user) + return $user->user_id; + + return false; } /** |