redirectUri = $redirect_uri; if ($state) { $this->errorData['state'] = $state; } } /** * Redirect the user agent. * * @ingroup oauth2_section_4 */ protected function sendHeaders() { $params = array('query' => $this->errorData); header("Location: " . $this->buildUri($this->redirectUri, $params)); exit(); // No point in printing out data if we're redirecting } /** * Build the absolute URI based on supplied URI and parameters. * * @param $uri * An absolute URI. * @param $params * Parameters to be append as GET. * * @return * An absolute URI with supplied parameters. * * @ingroup oauth2_section_4 */ protected function buildUri($uri, $params) { $parse_url = parse_url($uri); // Add our params to the parsed uri foreach ( $params as $k => $v ) { if (isset($parse_url[$k])) $parse_url[$k] .= "&" . http_build_query($v); else $parse_url[$k] = http_build_query($v); } // Put humpty dumpty back together return ((isset($parse_url["scheme"])) ? $parse_url["scheme"] . "://" : "") . ((isset($parse_url["user"])) ? $parse_url["user"] . ((isset($parse_url["pass"])) ? ":" . $parse_url["pass"] : "") . "@" : "") . ((isset($parse_url["host"])) ? $parse_url["host"] : "") . ((isset($parse_url["port"])) ? ":" . $parse_url["port"] : "") . ((isset($parse_url["path"])) ? $parse_url["path"] : "") . ((isset($parse_url["query"])) ? "?" . $parse_url["query"] : "") . ((isset($parse_url["fragment"])) ? "#" . $parse_url["fragment"] : ""); } }