Let soudcloud fail gracefuly when unconfigured

This makes general preferences look nice again, even when no soundcloud id and secret is configured (those don't belong us).
This commit is contained in:
Lucas Bickel 2017-03-02 14:47:16 +01:00
parent 51960a891f
commit 898a1ce545
1 changed files with 4 additions and 2 deletions

View File

@ -64,8 +64,10 @@ class Application_Service_SoundcloudService extends Application_Service_ThirdPar
$clientSecret = $CC_CONFIG['soundcloud-client-secret'];
$redirectUri = $CC_CONFIG['soundcloud-redirect-uri'];
$this->_client = new Soundcloud\Service($clientId, $clientSecret, $redirectUri);
$accessToken = Application_Model_Preference::getSoundCloudRequestToken();
if ($clientId && $clientSecret && $redirectUri) {
$this->_client = new Soundcloud\Service($clientId, $clientSecret, $redirectUri);
$accessToken = Application_Model_Preference::getSoundCloudRequestToken();
}
if (!empty($accessToken)) {
$this->_accessToken = $accessToken;
$this->_client->setAccessToken($accessToken);