public function OAuthStoreSQL::getConsumerStatic in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.7 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::getConsumerStatic()
- 7.2 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::getConsumerStatic()
- 7.3 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::getConsumerStatic()
- 7.5 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::getConsumerStatic()
- 7.6 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::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/ OAuthStoreSQL.php, line 1144
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
SET osr_enabled = 1,
osr_status = \'active\',
osr_usa_id_ref = NULL,
osr_consumer_key = \'%s\',
osr_consumer_secret = \'\',
osr_requester_name = \'\',
osr_requester_email = \'\',
osr_callback_uri = \'\',
osr_application_uri = \'\',
osr_application_title = \'Static shared consumer key\',
osr_application_descr = \'\',
osr_application_notes = \'Static shared consumer key\',
osr_application_type = \'\',
osr_application_commercial = 0,
osr_timestamp = NOW(),
osr_issue_date = NOW()
', $consumer_key);
// Just make sure that if the consumer key is truncated that we get the truncated string
$consumer = $this
->getConsumerStatic();
}
return $consumer;
}