You are here

public function OAuthStoreOracle::addConsumerRequestToken in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::addConsumerRequestToken()
  2. 7.2 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::addConsumerRequestToken()
  3. 7.3 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::addConsumerRequestToken()
  4. 7.5 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::addConsumerRequestToken()
  5. 7.6 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::addConsumerRequestToken()

* Add an unautorized request token to our server. * *

Parameters

string consumer_key: * @param array options (eg. token_ttl) * @return array (token, token_secret)

Overrides OAuthStoreAbstract::addConsumerRequestToken

File

lib/oauth-php/library/store/OAuthStoreOracle.php, line 974

Class

OAuthStoreOracle

Code

public function addConsumerRequestToken($consumer_key, $options = array()) {
  $token = $this
    ->generateKey(true);
  $secret = $this
    ->generateKey();
  if (isset($options['token_ttl']) && is_numeric($options['token_ttl'])) {
    $ttl = intval($options['token_ttl']);
  }
  else {
    $ttl = $this->max_request_token_ttl;
  }
  if (!isset($options['oauth_callback'])) {

    // 1.0a Compatibility : store callback url associated with request token
    $options['oauth_callback'] = 'oob';
  }
  $options_oauth_callback = $options['oauth_callback'];
  $sql = "BEGIN SP_ADD_CONSUMER_REQUEST_TOKEN(:P_TOKEN_TTL, :P_CONSUMER_KEY, :P_TOKEN, :P_TOKEN_SECRET, :P_CALLBACK_URL, :P_RESULT); END;";

  // parse sql
  $stmt = oci_parse($this->conn, $sql) or die('Can not parse query');

  // Bind In and Out Variables
  oci_bind_by_name($stmt, ':P_TOKEN_TTL', $ttl, 20);
  oci_bind_by_name($stmt, ':P_CONSUMER_KEY', $consumer_key, 255);
  oci_bind_by_name($stmt, ':P_TOKEN', $token, 255);
  oci_bind_by_name($stmt, ':P_TOKEN_SECRET', $secret, 255);
  oci_bind_by_name($stmt, ':P_CALLBACK_URL', $options_oauth_callback, 255);
  oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

  //Execute the statement
  oci_execute($stmt);
  $returnArray = array(
    'token' => $token,
    'token_secret' => $secret,
    'token_ttl' => $ttl,
  );
  return $returnArray;
}