You are here

public function OAuthStoreOracle::setServerTokenTtl in Lingotek Translation 7.3

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

* Set the ttl of a server access token. This is done when the * server receives a valid request with a xoauth_token_ttl parameter in it. * *

Parameters

string consumer_key: * @param string token * @param int token_ttl

File

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

Class

OAuthStoreOracle

Code

public function setServerTokenTtl($consumer_key, $token, $token_ttl) {
  if ($token_ttl <= 0) {

    // Immediate delete when the token is past its ttl
    $this
      ->deleteServerToken($consumer_key, $token, 0, true);
  }
  else {

    // Set maximum time to live for this token
    //
    $sql = "BEGIN SP_SET_SERVER_TOKEN_TTL(:P_TOKEN_TTL, :P_CONSUMER_KEY, :P_TOKEN, :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', $token_ttl, 40);
    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_RESULT', $result, 20);

    //Execute the statement
    oci_execute($stmt);

    //
  }
}