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

FIX for schema or host agnostic web sites (e.g. multiple domain setup) #762

Closed
wants to merge 1 commit into from
Closed

Conversation

maddes
Copy link

@maddes maddes commented Jul 10, 2013

Hello Daniel.

I've made and tested this quick fix to allow schema or host agnostic webs. This is really useful when having multiple domains for the same client.

It already worked without SEO_URLs but it complained when activating, so I fixed it.

It doesn't break normal usage, it's just a verification of key existence before usage.

After this patch, these configurations are valid on the config.php file (the new default could be '/' for less installation steps!):

// Scheme agnostic website (Note: the '//' is required):
define('HTTP_SERVER', '//www.domain.com/');

// Domain agnostic website:
define('HTTP_SERVER', '/');

ps: the $url_data to $url_info renaming on last version almost lost me.

Hello Daniel.

I've made and tested this quick fix to allow schema or host agnostic webs. This is really useful when having multiple domains for the same client.

It already worked without SEO_URLs but it complained when activating, so I fixed it.

It doesn't break normal usage, it's just a verification of key existence before usage.

After this patch, these configurations are valid on the config.php file (the new default could be '/' for less installation steps!):

// Scheme agnostic website (Note: the '//' is required):
define('HTTP_SERVER', '//www.domain.com/'); 

// Domain agnostic website:
define('HTTP_SERVER', '/');
@@ -112,10 +112,10 @@ public function rewrite($link) {
}
}

return $url_info['scheme'] . '://' . $url_info['host'] . (isset($url_info['port']) ? ':' . $url_info['port'] : '') . str_replace('/index.php', '', $url_info['path']) . $url . $query;
return (array_key_exists('host', $url_info) ? (array_key_exists('scheme', $url_info) ? $url_info['scheme'] . '://' : '//') . $url_info['host'] . (array_key_exists('port', $url_info) ? ':' . $url_info['port'] : '') : '/') . str_replace('/index.php', '', $url_info['path']) . $url . $query;
Copy link
Author

Choose a reason for hiding this comment

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

Really don't know the difference between array_key_exists('host', $url_info) and isset($url_info['host']) but array_key_exists looked more standard.

@ghost
Copy link

ghost commented Jul 11, 2013

Stacking a bunch of ternary operators really hurts readability, IMO.

@maddes
Copy link
Author

maddes commented Jul 11, 2013

well, I just used them to keep it on a single line just as it was.
Do you want an if/else version?
On Jul 11, 2013 12:46 PM, "rph" notifications@github.com wrote:

Stacking a bunch of ternary operators really hurts readability, IMO.


Reply to this email directly or view it on GitHubhttps://github.com//pull/762#issuecomment-20821160
.

@opencart opencart closed this Jul 12, 2013
@maddes
Copy link
Author

maddes commented Jul 12, 2013

So.. should I edit it and make an if/else version?
Or is the idea/functionality completely rejected?

@maddes maddes deleted the patch-1 branch July 14, 2013 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants