function GetFood($foodId, $subCats = false, $flagDefaultServing = false) { $url = Client::$base . 'method=food.get'; $url = $url . '&food_id=' . $foodId; if ($subCats) { $url = $url . '&include_sub_categories=true'; } if ($flagDefaultServing) { $url = $url . '&flag_default_serving=true'; } $oauth = new OAuthBase(); $normalizedUrl; $normalizedRequestParameters; $signature = $oauth->GenerateSignature($url, $this->_consumerKey, $this->_consumerSecret, '', '', $normalizedUrl, $normalizedRequestParameters); $response = $this->GetQueryResponse($normalizedUrl, $normalizedRequestParameters . '&' . OAuthBase::$OAUTH_SIGNATURE . '=' . urlencode($signature)); return $response; }
function __construct() { global $globals; // syslog(LOG_INFO, "construct: ".$_SERVER["REQUEST_URI"]); $this->service = 'facebook'; if ($globals['mobile_version']) { $server = 'm.facebook.com'; } else { $server = 'www.facebook.com'; } $this->facebook = new Facebook(array('appId' => $globals['facebook_key'], 'secret' => $globals['facebook_secret'])); $this->user = $this->facebook->getUser(); parent::__construct(); }
function __construct() { global $globals; $server = 'api.twitter.com'; $this->request_token_url = "https://{$server}/oauth/request_token"; $this->access_token_url = "https://{$server}/oauth/access_token"; $this->authorize_url = "https://{$server}/oauth/authenticate"; $this->credentials_url = "https://{$server}/1.1/account/verify_credentials.json"; if (!$globals['oauth']['twitter']['consumer_key'] || !$globals['oauth']['twitter']['consumer_secret']) { $oauth = null; } $this->service = 'twitter'; $this->oauth = new OAuth($globals['oauth']['twitter']['consumer_key'], $globals['oauth']['twitter']['consumer_secret'], OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI); parent::__construct(); }
function __construct() { global $globals; $this->service = 'facebook'; if ($globals['mobile_version']) { $server = 'm.facebook.com'; } else { $server = 'www.facebook.com'; } // Store de FB URL for login $location_ok = urlencode('http://' . get_server_name() . $globals['base_url'] . 'oauth/fbconnect.php?op=ok' . '&t=' . time()); $location_cancel = urlencode('http://' . get_server_name() . $globals['base_url'] . 'oauth/fbconnect.php?op=cancel' . '&t=' . time()); $this->authorize_url = "http://{$server}/login.php?api_key=" . $globals['facebook_key'] . '&extern=1&fbconnect=1&return_session=1&v=1.0&next=' . $location_ok . '&cancel_url=' . $location_ok; parent::__construct(); }
function __construct() { global $globals; if (!$globals['oauth']['gplus']['consumer_key'] || !$globals['oauth']['gplus']['consumer_secret']) { $oauth = null; } $this->service = 'gplus'; $callback = $globals['scheme'] . '//' . get_server_name() . $globals['base_url'] . 'oauth/signin.php?service=gplus'; $this->client = new apiClient(); $this->client->setClientId($globals['oauth']['gplus']['consumer_key']); $this->client->setClientSecret($globals['oauth']['gplus']['consumer_secret']); $this->client->setRedirectUri($callback); // $this->client->setApprovalPrompt('auto'); // TODO: pass to auto, check token is ok $this->client->setApplicationName("Menéame Login"); $this->gplus = new apiPlusService($this->client); parent::__construct(); }
function requestapi($url, $token = null, $secret = null) { $oauth = new OAuthBase(); $normalizedUrl; $normalizedRequestParameters; $signature = $oauth->GenerateSignature($url, $this->_consumerKey, $this->_consumerSecret, $token, $secret, $normalizedUrl, $normalizedRequestParameters); $doc = simplexml_load_string($this->GetQueryResponse($normalizedUrl, $normalizedRequestParameters . '&' . OAuthBase::$OAUTH_SIGNATURE . '=' . urlencode($signature))); return $this->getArray($doc); }
function ProfileRequestScriptSessionKey($auth, $expires, $consumeWithin, $permittedReferrerRegex, $cookie, &$sessionKey) { $url = FatSecretAPI::$base . 'method=profile.request_script_session_key'; if (!empty($auth['user_id'])) { $url = $url . '&user_id=' . $auth['user_id']; } if ($expires > -1) { $url = $url . '&expires=' . $expires; } if ($consumeWithin > -1) { $url = $url . '&consume_within=' . $consumeWithin; } if (!empty($permittedReferrerRegex)) { $url = $url . '&permitted_referrer_regex=' . $permittedReferrerRegex; } if ($cookie == true) { $url = $url . "&cookie=true"; } $oauth = new OAuthBase(); $normalizedUrl; $normalizedRequestParameters; $signature = $oauth->GenerateSignature($url, $this->_consumerKey, $this->_consumerSecret, $auth['token'], $auth['secret'], $normalizedUrl, $normalizedRequestParameters); $doc = new SimpleXMLElement($this->GetQueryResponse($normalizedUrl, $normalizedRequestParameters . '&' . OAuthBase::$OAUTH_SIGNATURE . '=' . urlencode($signature))); $this->ErrorCheck($doc); $sessionKey = $doc->session_key; }