SAAS-848 - Add soundcloud_callback file

This commit is contained in:
Duncan Sommerville 2015-06-04 12:01:04 -04:00
parent 63b726e6b2
commit 80bfb7fd93

View file

@ -0,0 +1,28 @@
<?php
class Router {
/**
* Parse the URL query string and store the key->val pairs
* into an array, then redirect
*/
public function reroute() {
$params = array();
parse_str($_SERVER['QUERY_STRING'], $params);
$this->_redirect($params);
}
/**
* Redirect to the URL passed in the 'state' parameter
* when we're redirected here from SoundCloud
*
* @param $params array array of URL query parameters
*/
private function _redirect($params) {
$url = urldecode($params['state']);
header("Location: $url?" . $_SERVER['QUERY_STRING']);
}
}
(new Router())->reroute();