/**
  * Generate the callback URL to be notified when a payment is received.
  * @param string $url
  * @return string
  */
 public function generateCallbackUrl($url)
 {
     if (!is_string($url)) {
         throw new \InvalidArgumentException('$url is not string');
     }
     return http_build_url($url, array('query' => 'secret=' . $this->getSecretParameter()), HTTP_URL_STRIP_AUTH | HTTP_URL_JOIN_PATH | HTTP_URL_JOIN_QUERY | HTTP_URL_STRIP_FRAGMENT);
 }
Esempio n. 2
0
 /**
  * Test that www/no-www is handled correctly
  * 
  * If the site is using a www URL, then no-www should redirect to www.
  * If the site is using a non-www URL, then www should redirect to no-www.
  * 
  * The redirect should be done with 301 permanent redirect status
  * code.  And once the user follows the redirect, he should end up on
  * the correct page.
  */
 public function test_wwwRedirect()
 {
     $components = $this->components;
     $pos = strpos($components['host'], 'www.');
     if ($pos === false || $pos > 0) {
         $components['host'] = 'www.' . $components['host'];
     } else {
         $components['host'] = substr($components['host'], 4);
     }
     $wwwUrl = http_build_url($components);
     try {
         $res = $this->client->get($wwwUrl, ['allow_redirects' => false, 'timeout' => $this->timeout]);
         $statusCode = $res->getStatusCode();
     } catch (\Exception $e) {
         $this->fail("Failed fetching URL [{$wwwUrl}] : " . $e->getMessage());
     }
     $this->assertEquals(301, $statusCode, "The www/no-www redirect did not return 301 status code");
     try {
         $res = $this->client->get($wwwUrl, ['timeout' => $this->timeout]);
         $statusCode = $res->getStatusCode();
     } catch (\Exception $e) {
         $this->fail("Failed fetching URL [{$wwwUrl}] : " . $e->getMessage());
     }
     $this->assertEquals(200, $statusCode, "The www/no-www redirect did not end up in 200 status code");
 }
Esempio n. 3
0
 private function _buildURI($append_path = null, $append_query = null)
 {
     $uri = $this->_uri_pieces;
     if (isset($append_path)) {
         if (is_array($append_path)) {
             $uri['path'] = array_merge($uri['path'], $append_path);
         } else {
             $uri['path'][] = $append_path;
         }
     }
     if (!empty($uri['path'])) {
         $uri['path'] = '/' . implode('/', $uri['path']);
     }
     if (isset($append_query) && is_array($append_query)) {
         foreach ($append_query as $key => $value) {
             if (is_bool($value)) {
                 $append_query[$key] = $this->_boolString($value);
             }
         }
         if (!empty($uri['query'])) {
             $uri['query'] = array_merge($uri['query'], $append_query);
         } else {
             $uri['query'] = $append_query;
         }
     }
     if (!empty($uri['query'])) {
         $uri['query'] = http_build_query($uri['query']);
     }
     return http_build_url('http://localhost/', $uri);
 }
 public function __construct()
 {
     parent::__construct();
     $this->load->model('visual_themes')->library('template');
     // Determine the current visual theme.
     if ($this->input->get('theme') != '' && $this->input->method() == 'get' && !$this->input->is_ajax_request()) {
         $theme = (string) $this->input->get('theme');
         $this->visual_themes->set_current($theme);
         parse_str(parse_url(CURRENT_URL, PHP_URL_QUERY), $query);
         unset($query['theme']);
         redirect(http_build_url(current_url(), array('query' => http_build_query($query))));
     }
     $this->template->set_theme($this->visual_themes->get_current());
     $default_title = config_item('default_title');
     $default_description = config_item('default_description');
     $default_keywords = config_item('default_keywords');
     if ($default_title != '') {
         $this->template->title($default_title);
     }
     if ($default_description != '') {
         $this->template->set_metadata('description', $default_description);
     }
     if ($default_keywords != '') {
         $this->template->set_metadata('keywords', $default_keywords);
     }
     $this->template->set_breadcrumb('<i class="fa fa-home"></i> ' . $this->lang->line('ui_home'), site_url());
 }
Esempio n. 5
0
 /**
  * Creates a url with the given uri, including the base url
  *
  * @param string  $uri
  * @param array   $variables
  * @param array   $getVariables
  * @param boolean $secure
  *
  * @return string
  */
 public static function create($uri = null, $variables = [], $getVariables = [], $secure = null)
 {
     $url = '';
     $uri = $uri ?: static::string();
     // If the given uri is not a full URL
     if (!preg_match("#^(http|https|ftp)://#i", $uri)) {
         $url .= \Config::get('baseUrl');
         if ($index_file = \Config::get('indexFile')) {
             $url .= $index_file . '/';
         }
     }
     $url .= ltrim($uri, '/');
     // Add a url_suffix if defined and the url doesn't already have one
     if (substr($url, -1) != '/' and (($suffix = strrchr($url, '.')) === false or strlen($suffix) > 5)) {
         \Config::get('url_suffix') and $url .= \Config::get('url_suffix');
     }
     if (!empty($get_variables)) {
         $char = strpos($url, '?') === false ? '?' : '&';
         if (is_string($get_variables)) {
             $url .= $char . str_replace('%3A', ':', $get_variables);
         } else {
             $url .= $char . str_replace('%3A', ':', http_build_query($get_variables));
         }
     }
     array_walk($variables, function ($val, $key) use(&$url) {
         $url = str_replace(':' . $key, $val, $url);
     });
     is_bool($secure) and $url = http_build_url($url, array('scheme' => $secure ? 'https' : 'http'));
     return $url;
 }
 protected function _processAnchors($content, $url, $depth)
 {
     $dom = new DOMDocument('1.0');
     @$dom->loadHTML($content);
     $anchors = $dom->getElementsByTagName('a');
     foreach ($anchors as $element) {
         $href = $element->getAttribute('href');
         if (0 !== strpos($href, 'http')) {
             $path = '/' . ltrim($href, '/');
             if (extension_loaded('http')) {
                 $href = http_build_url($url, array('path' => $path));
             } else {
                 $parts = parse_url($url);
                 $href = $parts['scheme'] . '://';
                 if (isset($parts['user']) && isset($parts['pass'])) {
                     $href .= $parts['user'] . ':' . $parts['pass'] . '@';
                 }
                 $href .= $parts['host'];
                 if (isset($parts['port'])) {
                     $href .= ':' . $parts['port'];
                 }
                 $href .= $path;
             }
         }
         // Crawl only link that belongs to the start domain
         $this->crawl_page($href, $depth - 1);
     }
 }
 /**
  * Creates a URL for requesting a custom user photo.
  */
 public function get($photo, $size = null, $default_image = null, $force_default_image = null)
 {
     $url = $this->base_url . 'avatar/' . $photo;
     $query = array();
     $size = (int) $size;
     if ($size <= 0) {
         $size = $this->image_size;
     }
     if ($size > 0) {
         $query['s'] = $size;
     }
     if (isset($default_image)) {
         $default_image = (string) $default_image;
     } else {
         $default_image = $this->default_image;
     }
     if ($default_image != '') {
         $query['d'] = $default_image;
     }
     if (isset($force_default_image)) {
         $force_default_image = !empty($force_default_image);
     } else {
         $force_default_image = $this->force_default_image;
     }
     if ($force_default_image) {
         $query['f'] = 'y';
     }
     if (!empty($query)) {
         $url = http_build_url($url, array('query' => http_build_query($query)));
     }
     return $url;
 }
Esempio n. 8
0
/**
 * Wrapper for "http_build_url" -- will use http_build_url() if it exists, if not will do same thing.
 *
 * See: http://php.net/manual/en/function.http-build-query.php
 *
 * @param $url
 * @param array $parts
 * @param int $flags
 * @param bool|false $new_url
 *
 * @return string
 */
function cf_http_build_url($url, $parts = array(), $flags = HTTP_URL_REPLACE, &$new_url = false)
{
    if (function_exists('http_build_url')) {
        return http_build_url($url, $parts, $flags, $new_url);
    }
    $keys = array('user', 'pass', 'port', 'path', 'query', 'fragment');
    if ($flags & HTTP_URL_STRIP_ALL) {
        $flags |= HTTP_URL_STRIP_USER;
        $flags |= HTTP_URL_STRIP_PASS;
        $flags |= HTTP_URL_STRIP_PORT;
        $flags |= HTTP_URL_STRIP_PATH;
        $flags |= HTTP_URL_STRIP_QUERY;
        $flags |= HTTP_URL_STRIP_FRAGMENT;
    } elseif ($flags & HTTP_URL_STRIP_AUTH) {
        $flags |= HTTP_URL_STRIP_USER;
        $flags |= HTTP_URL_STRIP_PASS;
    }
    // Parse the original URL
    $parse_url = parse_url($url);
    // Scheme and Host are always replaced
    if (isset($parts['scheme'])) {
        $parse_url['scheme'] = $parts['scheme'];
    }
    if (isset($parts['host'])) {
        $parse_url['host'] = $parts['host'];
    }
    if ($flags & HTTP_URL_REPLACE) {
        foreach ($keys as $key) {
            if (isset($parts[$key])) {
                $parse_url[$key] = $parts[$key];
            }
        }
    } else {
        if (isset($parts['path']) && $flags & HTTP_URL_JOIN_PATH) {
            if (isset($parse_url['path'])) {
                $parse_url['path'] = rtrim(str_replace(basename($parse_url['path']), '', $parse_url['path']), '/') . '/' . ltrim($parts['path'], '/');
            } else {
                $parse_url['path'] = $parts['path'];
            }
        }
        if (isset($parts['query']) && $flags & HTTP_URL_JOIN_QUERY) {
            if (isset($parse_url['query'])) {
                $parse_url['query'] .= '&' . $parts['query'];
            } else {
                $parse_url['query'] = $parts['query'];
            }
        }
    }
    foreach ($keys as $key) {
        if ($flags & (int) constant('HTTP_URL_STRIP_' . strtoupper($key))) {
            unset($parse_url[$key]);
        }
        if (isset($parse_url[$key]) && is_array($parse_url[$key])) {
            $parse_url[$key] = http_build_query($parse_url[$key]);
        }
    }
    $new_url = $parse_url;
    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'] : '');
}
Esempio n. 9
0
 public static function joinURL($parts)
 {
     // imgix idiosyncracy for signing URLs when only the signature exists. Our query string must begin with '?&s='
     if (substr($parts['query'], 0, 2) === "s=") {
         $parts['query'] = "&" . $parts['query'];
     }
     return http_build_url($parts);
 }
Esempio n. 10
0
 public function action_chat()
 {
     $this->template->content = \View::forge('member/chat');
     $config = Config::get('db.nodejs.chat', array());
     $host = empty($config['host']) ? Config::get('base_url') : $config['host'];
     $port = empty($config['port']) ? 0 : (int) $config['port'];
     $this->template->content->chat_url = $port ? http_build_url('/', array('host' => $host, 'port' => $port)) : $host;
 }
 public function __construct()
 {
     parent::__construct();
     $this->load->language('welcome')->library('curl');
     $title = 'Lex Parser Test';
     $this->template->append_title($title)->set_breadcrumb($title, http_build_url(site_url('playground/lex-parser'), array('query' => http_build_query(array('q_1' => 'query_param_1', 'q_2' => 'query_param_2')))));
     $this->registry->set('nav', 'playground/lex');
 }
Esempio n. 12
0
 function validate_url($variable, $options = null)
 {
     $parsed_url = parse_url($variable);
     if (empty($parsed_url) || !is_array($parsed_url) || empty($parsed_url['host'])) {
         return false;
     }
     $parsed_url['host'] = idn_to_ascii($parsed_url['host']);
     return (bool) filter_var(http_build_url($parsed_url), FILTER_VALIDATE_URL, $options);
 }
Esempio n. 13
0
function authenticated_url($url)
{
    // we are using HTTP authentication in this example
    // if using sessions you'll want to put the session name and ID into the query string instead
    $parts = array();
    $parts['user'] = $_SERVER['PHP_AUTH_USER'];
    $parts['pass'] = $_SERVER['PHP_AUTH_PW'];
    return http_build_url($url, $parts);
}
Esempio n. 14
0
 public function buildURL()
 {
     $params = [];
     foreach ($this->paramsName as $key => $_name) {
         $params[$_name] = $this->{$key};
     }
     $this->url = ($this->region ? "{$this->region}." : "") . "{$this->site}/" . ($this->mainCategory ? "/{$this->mainCategory}/" : "") . ($this->childCategory ? "/{$this->childCategory}/" : "");
     return http_build_url($this->url, $params);
 }
Esempio n. 15
0
 /**
  * Returns domain link from url.
  * @param $url
  * @return string
  */
 protected function getDomainLink($url)
 {
     $parsedLink = parse_url($url);
     if ($parsedLink == false) {
         return "";
     }
     $domainLink = http_build_url($url, $parsedLink, HTTP_URL_STRIP_PATH | HTTP_URL_STRIP_QUERY | HTTP_URL_STRIP_FRAGMENT);
     return $domainLink;
 }
Esempio n. 16
0
 public function getAbsoluteURL($source_url, $relative_url)
 {
     $url_parts = parse_url($relative_url);
     if (array_key_exists('scheme', $url_parts)) {
         return $relative_url;
     }
     $absolute = http_build_url($source_url, $url_parts, HTTP_URL_JOIN_PATH);
     return $absolute;
 }
 /**
  * Remove ugly parts of a url to make it nice
  */
 public function Nice()
 {
     if ($this->value && ($parts = parse_url($this->URL()))) {
         $remove = array('scheme', 'user', 'pass', 'port', 'query', 'fragment');
         foreach ($remove as $part) {
             unset($parts[$part]);
         }
         return rtrim(http_build_url($parts), "/");
     }
 }
Esempio n. 18
0
/**
 * Set PhpMyAdmin language according language set in panel
 *
 * Note: If panel language doesn't match any language available for PMA, language
 * is set to English (en).
 *
 * @access private
 * @param string $location PMA URI location
 * @return string PMA URI location
 */
function _client_pmaSetLanguage($location)
{
    /** @var Zend_Translate_Adapter $translator */
    $translator = iMSCP_Registry::get('translator')->getAdapter();
    $uriComponents = parse_url($location);
    parse_str($uriComponents['query'], $queryParts);
    $queryParts['lang'] = substr($translator->getLocale(), 0, 2);
    $uriComponents['query'] = http_build_query($queryParts);
    return http_build_url($location, $uriComponents);
}
Esempio n. 19
0
 function image_process_nowm($src, $width = null, $height = null, $no_crop = null, $keep_canvas_size = null)
 {
     if ($no_crop !== null) {
         $no_crop = empty($no_crop) ? 0 : 1;
     }
     if ($keep_canvas_size !== null) {
         $keep_canvas_size = empty($keep_canvas_size) ? 0 : 1;
     }
     return http_build_url(site_url('playground/image-process-nowm'), array('query' => http_build_query(array('src' => $src, 'w' => $width, 'h' => $height, 'no_crop' => $no_crop, 'keep_canvas_size' => $keep_canvas_size))), HTTP_URL_JOIN_QUERY);
 }
 /**
  * Class constructor
  *
  * Sets the $config data from the primary config.php file as a class variable.
  *
  * @return    void
  */
 public function __construct()
 {
     $this->config =& get_config();
     global $DETECT_URL;
     // Set the base_url automatically if none was provided
     if (empty($this->config['base_url'])) {
         $this->set_item('base_url', $DETECT_URL['base_url']);
     } else {
         $this->set_item('base_url', http_build_url($this->config['base_url'], array('scheme' => $DETECT_URL['server_protocol'], 'port' => $DETECT_URL['port'])));
     }
     if (!defined('BASE_URL')) {
         define('BASE_URL', $this->add_slash($this->base_url()));
     }
     if (!defined('BASE_URI')) {
         define('BASE_URI', $DETECT_URL['base_uri']);
     }
     if (!defined('SERVER_URL')) {
         define('SERVER_URL', $this->add_slash(substr(BASE_URL, 0, strlen(BASE_URL) - strlen(BASE_URI))));
     }
     if (!defined('SITE_URL')) {
         define('SITE_URL', $this->add_slash($this->site_url()));
     }
     if (!defined('SITE_URI')) {
         define('SITE_URI', '/' . str_replace(SERVER_URL, '', SITE_URL));
     }
     if (!defined('CURRENT_URI')) {
         define('CURRENT_URI', $DETECT_URL['current_uri']);
     }
     if (!defined('CURRENT_URL')) {
         define('CURRENT_URL', rtrim(SERVER_URL, '/') . CURRENT_URI);
     }
     // Added by Ivan Tcholakov, 26-DEC-2013.
     // See https://github.com/EllisLab/CodeIgniter/issues/2792
     if (!defined('IS_UTF8_CHARSET')) {
         define('IS_UTF8_CHARSET', strtolower($this->config['charset']) === 'utf-8');
     }
     //
     // Common Purpose File System Repositories
     $public_upload_path = $this->add_slash(isset($this->config['public_upload_path']) && $this->config['public_upload_path'] != '' ? $this->config['public_upload_path'] : FCPATH . 'upload/');
     $this->set_item('public_upload_path', $public_upload_path);
     if (!defined('PUBLIC_UPLOAD_PATH')) {
         define('PUBLIC_UPLOAD_PATH', $public_upload_path);
     }
     $public_upload_url = $this->add_slash(isset($this->config['public_upload_url']) && $this->config['public_upload_url'] != '' ? str_replace('{base_url}', BASE_URL, $this->config['public_upload_url']) : BASE_URL . 'upload/');
     $this->set_item('public_upload_url', $public_upload_url);
     if (!defined('PUBLIC_UPLOAD_URL')) {
         define('PUBLIC_UPLOAD_URL', $public_upload_url);
     }
     $platform_upload_path = $this->add_slash(isset($this->config['platform_upload_path']) && $this->config['platform_upload_path'] != '' ? $this->config['platform_upload_path'] : PLATFORMPATH . 'upload/');
     $this->set_item('platform_upload_path', $platform_upload_path);
     if (!defined('PLATFORM_UPLOAD_PATH')) {
         define('PLATFORM_UPLOAD_PATH', $platform_upload_path);
     }
     log_message('info', 'Config Class Initialized');
 }
 public static function my_image_url($src = null, $width = null, $height = null, $no_crop = null, $keep_canvas_size = null)
 {
     $src = isset($src) && $src != '' ? $src : image_url('lib/blank.png');
     if ($no_crop !== null) {
         $no_crop = empty($no_crop) ? 0 : 1;
     }
     if ($keep_canvas_size !== null) {
         $keep_canvas_size = empty($keep_canvas_size) ? 0 : 1;
     }
     return http_build_url(site_url('playground/image-process'), array('query' => http_build_query(array('src' => $src, 'w' => $width, 'h' => $height, 'no_crop' => $no_crop, 'keep_canvas_size' => $keep_canvas_size))), HTTP_URL_JOIN_QUERY);
 }
 /**
  * 生成用户授权的跳转网址,便于应用执行跳转
  * @param string $redirect_uri 应用的跳转地址
  * @param string $shop_key 友好速搭安装应用的店铺唯一key
  * @param string $state 自定义的参数
  * @return string 用户授权的跳转网址
  * @throws Exception
  */
 public function authorize_url($redirect_uri, $shop_key, $state = '')
 {
     $this->validate();
     if (empty($this->app_scope)) {
         throw new Exception('未设置scope');
     }
     $params = array('response_type' => 'code', 'client_id' => $this->app_key, 'shop_key' => $shop_key, 'scope' => $this->app_scope, 'redirect_uri' => $this->redirect_uri, 'state' => $state);
     $params_str = http_build_query($params);
     $url = http_build_url($this->auth_url, array('query' => $params_str));
     return $url;
 }
Esempio n. 23
0
 private function getEndpointUrl($endpoint)
 {
     $uriParts = parse_url($this->apiUrl);
     if (!array_key_exists('path', $uriParts)) {
         $uriParts['path'] = '/' . $endpoint;
     } elseif (substr($uriParts['path'], -1) === '/') {
         $uriParts['path'] .= $endpoint;
     } else {
         $uriParts['path'] .= '/' . $endpoint;
     }
     return http_build_url($uriParts);
 }
Esempio n. 24
0
function convert_punycode($url, $is_encode = true)
{
    $url_parts = parse_url($url);
    $Punycode = new Punycode();
    if ($is_encode) {
        $host = $Punycode->encode($url_parts['host']);
    } else {
        $host = $Punycode->decode($url_parts['host']);
    }
    $url_parts['host'] = $host;
    return http_build_url($url, $url_parts);
}
Esempio n. 25
0
 /**
  * {@inheritdoc}
  * @see Scalr\Service\OpenStack\Services.AbstractService::getEndpointUrl()
  */
 public function getEndpointUrl()
 {
     //Endpoint url in the service catalog does not include version
     $cfg = $this->getOpenStack()->getConfig();
     if ($cfg->getAuthToken() === null) {
         return $cfg->getIdentityEndpoint();
     } else {
         if (!isset($this->cache['endpoint'])) {
             $this->cache['endpoint'] = http_build_url($cfg->getIdentityEndpoint(), array('port' => self::CONTRAIL_PORT, 'path' => '/'));
         }
     }
     return $this->cache['endpoint'];
 }
 function index()
 {
     if (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] !== 'on') {
         $this->obj =& get_instance();
         $this->obj->load->helper(array('url', 'http'));
         $current = current_url();
         $current = parse_url($current);
         if (stripos($current['path'], "/account/") !== false) {
             $current['scheme'] = 'https';
             redirect(http_build_url('', $current), 'refresh');
         }
     }
 }
Esempio n. 27
0
 /**
  * Creates an html link
  *
  * @param	string	the url
  * @param	string	the text value
  * @param	array	the attributes array
  * @param	bool	true to force https, false to force http
  * @return	string	the html link
  */
 public static function anchor($href, $text = null, $attr = array(), $secure = null)
 {
     if (!preg_match('#^(\\w+://|javascript:|\\#)# i', $href)) {
         $urlparts = explode('?', $href, 2);
         $href = \Uri::create($urlparts[0], array(), isset($urlparts[1]) ? $urlparts[1] : array(), $secure);
     } elseif (!preg_match('#^(javascript:|\\#)# i', $href) and is_bool($secure)) {
         $href = http_build_url($href, array('scheme' => $secure ? 'https' : 'http'));
     }
     // Create and display a URL hyperlink
     is_null($text) and $text = $href;
     $attr['href'] = $href;
     return html_tag('a', $attr, $text);
 }
 /**
  * Finish oauth authorization.
  * Builds redirect uri and performs redirect.
  * If user is not logged on or user denied to access, redirect contains the Access Denied Error
  */
 public function finishAuthorization()
 {
     $responseType = $this->getResponseType();
     if (\Yii::$app->user->isGuest || !$this->isAuthorized) {
         $responseType->errorRedirect('The User denied access to your application', Exception::ACCESS_DENIED);
     }
     $parts = $responseType->getResponseData();
     $redirectUri = http_build_url($responseType->redirect_uri, $parts, HTTP_URL_JOIN_QUERY | HTTP_URL_STRIP_FRAGMENT);
     if (isset($parts['fragment'])) {
         $redirectUri .= '#' . $parts['fragment'];
     }
     \Yii::$app->response->redirect($redirectUri);
 }
Esempio n. 29
0
 public function getAuthenticatedRequest($method, $url, $token, array $options = [])
 {
     $parsedUrl = \parse_url($url);
     $queryString = array();
     if (isset($parsedUrl['query'])) {
         parse_str($parsedUrl['query'], $queryString);
     }
     if (!isset($queryString['access_token'])) {
         $queryString['access_token'] = (string) $token;
     }
     $url = \http_build_url($url, ['query' => \http_build_query($queryString)]);
     return $this->createRequest($method, $url, null, $options);
 }
 /**
  * @param string $redirect_uri 
  * @param string $error_description (optional)
  * @param string $error A single error code
  * @param string $state Cross-Site Request Forgery
  * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-4.1.2.1
  */
 public function __construct($redirect_uri, $error_description = null, $error = self::INVALID_REQUEST, $state = null)
 {
     parent::__construct($error_description, $error);
     $query = ['error' => $error];
     if ($error_description) {
         $query['error_description'] = $error_description;
     }
     $request = \Yii::$app->request;
     if ($state) {
         $query['state'] = $state;
     }
     \Yii::$app->response->redirect(http_build_url($redirect_uri, [PHP_URL_QUERY => $query], HTTP_URL_REPLACE | HTTP_URL_JOIN_QUERY));
 }