public function OAuthStoreOracle::getServerForUri in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.2 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getServerForUri()
- 7.3 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getServerForUri()
- 7.4 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getServerForUri()
- 7.5 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getServerForUri()
- 7.6 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getServerForUri()
* Find the server details that might be used for a request * * The consumer_key must belong to the user or be public (user id is null) * *
Parameters
string uri uri of the server: * @param int user_id id of the logged on user * @exception OAuthException2 when no credentials found * @return array
Overrides OAuthStoreAbstract::getServerForUri
File
- lib/
oauth-php/ library/ store/ OAuthStoreOracle.php, line 445
Class
Code
public function getServerForUri($uri, $user_id) {
// Find a consumer key and token for the given uri
$ps = parse_url($uri);
$host = isset($ps['host']) ? $ps['host'] : 'localhost';
$path = isset($ps['path']) ? $ps['path'] : '';
if (empty($path) || substr($path, -1) != '/') {
$path .= '/';
}
//
$sql = "BEGIN SP_GET_SERVER_FOR_URI(:P_HOST, :P_PATH,:P_USER_ID, :P_ROWS, :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_HOST', $host, 255);
oci_bind_by_name($stmt, ':P_PATH', $path, 255);
oci_bind_by_name($stmt, ':P_USER_ID', $user_id, 40);
oci_bind_by_name($stmt, ':P_RESULT', $result, 20);
//Bind the ref cursor
$p_row = oci_new_cursor($this->conn);
oci_bind_by_name($stmt, ':P_ROWS', $p_row, -1, OCI_B_CURSOR);
//Execute the statement
oci_execute($stmt);
// treat the ref cursor as a statement resource
oci_execute($p_row, OCI_DEFAULT);
oci_fetch_all($p_row, $getServerForUriList, null, null, OCI_FETCHSTATEMENT_BY_ROW);
$server = $getServerForUriList;
//
if (empty($server)) {
throw new OAuthException2('No server available for ' . $uri);
}
$server['signature_methods'] = explode(',', $server['signature_methods']);
return $server;
}