SAAS-848 - Modify SoundCloud code to use external redirect
This commit is contained in:
parent
b0b6e037ac
commit
63b726e6b2
|
@ -99,6 +99,7 @@ class Config {
|
||||||
$globalAirtimeConfigValues = parse_ini_file($globalAirtimeConfig, true);
|
$globalAirtimeConfigValues = parse_ini_file($globalAirtimeConfig, true);
|
||||||
$CC_CONFIG['soundcloud-client-id'] = $globalAirtimeConfigValues['soundcloud']['soundcloud_client_id'];
|
$CC_CONFIG['soundcloud-client-id'] = $globalAirtimeConfigValues['soundcloud']['soundcloud_client_id'];
|
||||||
$CC_CONFIG['soundcloud-client-secret'] = $globalAirtimeConfigValues['soundcloud']['soundcloud_client_secret'];
|
$CC_CONFIG['soundcloud-client-secret'] = $globalAirtimeConfigValues['soundcloud']['soundcloud_client_secret'];
|
||||||
|
$CC_CONFIG['soundcloud-redirect-uri'] = $globalAirtimeConfigValues['soundcloud']['soundcloud_redirect_uri'];
|
||||||
|
|
||||||
if(isset($values['demo']['demo'])){
|
if(isset($values['demo']['demo'])){
|
||||||
$CC_CONFIG['demo'] = $values['demo']['demo'];
|
$CC_CONFIG['demo'] = $values['demo']['demo'];
|
||||||
|
|
|
@ -33,12 +33,9 @@ class SoundcloudService extends ThirdPartyService {
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$CC_CONFIG = Config::getConfig();
|
$CC_CONFIG = Config::getConfig();
|
||||||
// FIXME: These values are hardcoded into conf.php right now...
|
|
||||||
// we should move these to a global config file
|
|
||||||
$clientId = $CC_CONFIG['soundcloud-client-id'];
|
$clientId = $CC_CONFIG['soundcloud-client-id'];
|
||||||
$clientSecret = $CC_CONFIG['soundcloud-client-secret'];
|
$clientSecret = $CC_CONFIG['soundcloud-client-secret'];
|
||||||
$baseUrl = $CC_CONFIG['baseUrl'] . ":" . $CC_CONFIG['basePort'];
|
$redirectUri = $CC_CONFIG['soundcloud-redirect-uri'];
|
||||||
$redirectUri = 'http://' . $baseUrl . '/soundcloud/redirect';
|
|
||||||
|
|
||||||
$this->_client = new Soundcloud\Service($clientId, $clientSecret, $redirectUri);
|
$this->_client = new Soundcloud\Service($clientId, $clientSecret, $redirectUri);
|
||||||
$accessToken = Application_Model_Preference::getSoundCloudRequestToken();
|
$accessToken = Application_Model_Preference::getSoundCloudRequestToken();
|
||||||
|
@ -127,7 +124,7 @@ class SoundcloudService extends ThirdPartyService {
|
||||||
// Pass the current URL in the state parameter in order to preserve it
|
// Pass the current URL in the state parameter in order to preserve it
|
||||||
// in the redirect. This allows us to create a singular script to redirect
|
// in the redirect. This allows us to create a singular script to redirect
|
||||||
// back to any station the request comes from.
|
// back to any station the request comes from.
|
||||||
$url = urlencode('http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
|
$url = urlencode('http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['HTTP_HOST'].'/soundcloud/redirect');
|
||||||
return $this->_client->getAuthorizeUrl(array("state" => $url));
|
return $this->_client->getAuthorizeUrl(array("state" => $url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue