Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add supported for SSL configuration when create link through Url class #36

Merged
merged 2 commits into from
Apr 20, 2017

Conversation

guzzilar
Copy link
Contributor

1. Objective reason

To support OpenCart SSL configuration.
If we look at the core code:

// ./system/library/url.php

class Url {
    public function __construct($domain, $ssl = '') {
        $this->domain = $domain;
        $this->ssl = $ssl;
    }

    public function link($route, $args = '', $secure = false) {
        if (!$secure) {
            $url = $this->domain;
        } else {
            $url = $this->ssl;
        }
    }
}
// ./index.php ; line: 58-65

if (!$store_query->num_rows) {
    $config->set('config_url', HTTP_SERVER);
    $config->set('config_ssl', HTTPS_SERVER);
}

// Url
$url = new Url($config->get('config_url'), $config->get('config_secure') ? $config->get('config_ssl') : $config->get('config_url'));
$registry->set('url', $url);

so, we could just add a param at the 3rd arg of that Url::link() method to tell OpenCart that we will use "SSL" config if it's possible (config_secure = true).

i.e.
$this->url->link('some/url', '', 'SSL'));

2. Description of change

  • update src/catalog/controller/payment/omise.php to support SSL config

3. Users affected by the change

None

4. Impact of the change

None, it still support for http as normal.

5. Priority of change

Normal.

6. Alternate solution (if any)

No.

@iwat
Copy link
Contributor

iwat commented Mar 23, 2017

Does it need to be 'SSL' literally? The code seems to expect 3rd argument to be boolean so it could be 'true' instead.

The following code has the same effect:

$this->url->link('some/url', '', 'SSL'));
$this->url->link('some/url', '', 'noSSL'));

Never mind, I looked into the source code and found that they are using 'SSL' literally.

Copy link
Contributor

@iwat iwat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@iwat
Copy link
Contributor

iwat commented Apr 20, 2017

@nimid The plugin is very buggy without this PR. Especially, when using AJAX with HTTPS.

@nimid
Copy link
Contributor

nimid commented Apr 20, 2017

@iwat Ok.

@nimid nimid merged commit 5251c51 into master Apr 20, 2017
@nimid nimid deleted the support-ssl-server branch April 20, 2017 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants