function lookup_consumer($consumer_key) { $consumEnt = oauth_lookup_consumer_entity($consumer_key); if ($consumEnt) { return oauth_consumer_from_entity($consumEnt); } else { return NULL; } }
<?php // must be logged in gatekeeper(); global $CONFIG, $SESSION; // Get the logged in user $user = get_loggedin_user(); $consumer_key = get_input('consumer_key'); $return_to = html_entity_decode(get_input('return_to')); $user_auth = html_entity_decode(get_input('user_auth')); $request_url = html_entity_decode(get_input('request_url')); $access_url = html_entity_decode(get_input('access_url')); // make our consumer object $consumEnt = oauth_lookup_consumer_entity($consumer_key); $consumer = oauth_consumer_from_entity($consumEnt); // get a new request token if ($consumEnt->revA) { $token = oauth_get_new_request_token($consumer, $request_url, $consumEnt->callbackUrl); } else { $token = oauth_get_new_request_token($consumer, $request_url); } if ($token != null) { // save our token if ($consumEnt->revA) { $tokEnt = oauth_save_request_token($token, $consumer, $user, $consumEnt->callbackUrl); } else { $tokEnt = oauth_save_request_token($token, $consumer, $user); } // save our information to the session and send the user off to get the token validated $SESSION['oauth_return_to'] = $return_to; $SESSION['oauth_token'] = $tokEnt->getGUID();