public function OAuthStorePostgreSQL::getConsumerStatic in Lingotek Translation 7.5
Same name and namespace in other branches
- 7.7 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::getConsumerStatic()
- 7.2 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::getConsumerStatic()
- 7.3 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::getConsumerStatic()
- 7.4 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::getConsumerStatic()
- 7.6 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::getConsumerStatic()
Fetch the static consumer key for this provider. The user for the static consumer key is NULL (no user, shared key). If the key did not exist then the key is created.
Return value
string
Overrides OAuthStoreAbstract::getConsumerStatic
File
- lib/
oauth-php/ library/ store/ OAuthStorePostgreSQL.php, line 1153
Class
Code
public function getConsumerStatic() {
$consumer = $this
->query_one('
SELECT osr_consumer_key
FROM oauth_server_registry
WHERE osr_consumer_key LIKE \'sc-%%\'
AND osr_usa_id_ref IS NULL
');
if (empty($consumer)) {
$consumer_key = 'sc-' . $this
->generateKey(true);
$this
->query('
INSERT INTO oauth_server_registry (
osr_enabled,
osr_status,
osr_usa_id_ref,
osr_consumer_key,
osr_consumer_secret,
osr_requester_name,
osr_requester_email,
osr_callback_uri,
osr_application_uri,
osr_application_title,
osr_application_descr,
osr_application_notes,
osr_application_type,
osr_application_commercial,
osr_timestamp,
osr_issue_date
)
VALUES (\'1\',\'active\', NULL, \'%s\', \'\', \'\', \'\', \'\', \'\', \'Static shared consumer key\', \'\', \'Static shared consumer key\', \'\', 0, NOW(), NOW())
', $consumer_key);
// Just make sure that if the consumer key is truncated that we get the truncated string
$consumer = $this
->getConsumerStatic();
}
return $consumer;
}