error_msg(htmlspecialchars("OAuth parameters not found.")); } ?>
get_name(); $consumer_key = $provider->get_consumer_key(); $consumer_secret = $provider->get_consumer_secret(); $request_token_url = $provider->get_request_token_url(); $authorize_url = $provider->get_authorize_url(); $access_token_url = $provider->get_access_token_url(); $parameters = array("oauth_verifier"=>$verifier, "oauth_token"=>$token); $ff_consumer = new OAuthConsumer($consumer_key, $consumer_secret); $oauth_request_token = new OAuthToken($_COOKIE['OAUTH_TOKEN'], $_COOKIE['OAUTH_TOKEN_SECRET']); setcookie('OAUTH_TOKEN', '', time()-3600); setcookie('OAUTH_TOKEN_SECRET', '', time()-3600); $ff_request2 = OAuthRequest::from_consumer_and_token($ff_consumer, false, "GET", $access_token_url, $parameters); $hmac = new OAuthSignatureMethod_HMAC_SHA1(); $ff_request2->sign_request($hmac, $ff_consumer, $oauth_request_token); //sending request with curl $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $ff_request2->to_url()); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //temporary workaround for untrusted security certificates $not_verify_ssl = $_COOKIE['NOT_VERIFY_SSL']?$_COOKIE['NOT_VERIFY_SSL']:0; if($not_verify_ssl) { curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0); } setcookie('NOT_VERIFY_SSL', '', time()-3600); $access_token_string = curl_exec ($curl); curl_close ($curl); parse_str($access_token_string, $access_token_array); $userid = session_get_user()->getID(); if(!$access_token_array['oauth_token'] || !$access_token_array['oauth_token_secret']) { echo $HTML->error_msg(htmlspecialchars("Access Token not received.")); } $new_access_token = new OAuthAccessToken($f_provider_id, $access_token_array['oauth_token'], $access_token_array['oauth_token_secret'], $userid); $new_access_token->write_to_db(); echo _("New access token received and saved!") . "