public function OAuthStoreOracle::updateConsumer in Lingotek Translation 7.2
Same name and namespace in other branches
- 7.7 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::updateConsumer()
- 7.3 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::updateConsumer()
- 7.4 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::updateConsumer()
- 7.5 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::updateConsumer()
- 7.6 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::updateConsumer()
* Insert/update a new consumer with this server (we will be the server) * When this is a new consumer, then also generate the consumer key and secret. * Never updates the consumer key and secret. * When the id is set, then the key and secret must correspond to the entry * being updated. * * (This is the registry at the server, registering consumers ;-) ) * *
Parameters
array consumer: * @param int user_id user registering this consumer * @param boolean user_is_admin * @return string consumer key
Overrides OAuthStoreAbstract::updateConsumer
File
- lib/
oauth-php/ library/ store/ OAuthStoreOracle.php, line 800
Class
Code
public function updateConsumer($consumer, $user_id, $user_is_admin = false) {
$consumer_key = $this
->generateKey(true);
$consumer_secret = $this
->generateKey();
$consumer['callback_uri'] = isset($consumer['callback_uri']) ? $consumer['callback_uri'] : '';
$consumer['application_uri'] = isset($consumer['application_uri']) ? $consumer['application_uri'] : '';
$consumer['application_title'] = isset($consumer['application_title']) ? $consumer['application_title'] : '';
$consumer['application_descr'] = isset($consumer['application_descr']) ? $consumer['application_descr'] : '';
$consumer['application_notes'] = isset($consumer['application_notes']) ? $consumer['application_notes'] : '';
$consumer['application_type'] = isset($consumer['application_type']) ? $consumer['application_type'] : '';
$consumer['application_commercial'] = isset($consumer['application_commercial']) ? $consumer['application_commercial'] : 0;
//sp
$sql = "BEGIN SP_UPDATE_CONSUMER(:P_OSR_USA_ID_REF, :P_OSR_CONSUMER_KEY, :P_OSR_CONSUMER_SECRET, :P_OSR_REQUESTER_NAME, :P_OSR_REQUESTER_EMAIL, :P_OSR_CALLBACK_URI, :P_OSR_APPLICATION_URI, :P_OSR_APPLICATION_TITLE , :P_OSR_APPLICATION_DESCR, :P_OSR_APPLICATION_NOTES, :P_OSR_APPLICATION_TYPE, :P_OSR_APPLICATION_COMMERCIAL, :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_OSR_USA_ID_REF', $user_id, 40);
oci_bind_by_name($stmt, ':P_OSR_CONSUMER_KEY', $consumer_key, 255);
oci_bind_by_name($stmt, ':P_OSR_CONSUMER_SECRET', $consumer_secret, 255);
oci_bind_by_name($stmt, ':P_OSR_REQUESTER_NAME', $consumer['requester_name'], 255);
oci_bind_by_name($stmt, ':P_OSR_REQUESTER_EMAIL', $consumer['requester_email'], 255);
oci_bind_by_name($stmt, ':P_OSR_CALLBACK_URI', $consumer['callback_uri'], 255);
oci_bind_by_name($stmt, ':P_OSR_APPLICATION_URI', $consumer['application_uri'], 255);
oci_bind_by_name($stmt, ':P_OSR_APPLICATION_TITLE', $consumer['application_title'], 255);
oci_bind_by_name($stmt, ':P_OSR_APPLICATION_DESCR', $consumer['application_descr'], 255);
oci_bind_by_name($stmt, ':P_OSR_APPLICATION_NOTES', $consumer['application_notes'], 255);
oci_bind_by_name($stmt, ':P_OSR_APPLICATION_TYPE', $consumer['application_type'], 255);
oci_bind_by_name($stmt, ':P_OSR_APPLICATION_COMMERCIAL', $consumer['application_commercial'], 40);
oci_bind_by_name($stmt, ':P_RESULT', $result, 20);
//Execute the statement
oci_execute($stmt);
echo $result;
return $consumer_key;
}