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

Added is_https() function to common.php #1094

Closed
wants to merge 4 commits into from
Closed

Added is_https() function to common.php #1094

wants to merge 4 commits into from

Conversation

it-can
Copy link
Contributor

@it-can it-can commented Feb 29, 2012

Added is_https() function to common.php

{
function is_https()
{
return ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ? TRUE : FALSE;
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't need to be ternary - the expression itself will return TRUE or FALSE.

@it-can
Copy link
Contributor Author

it-can commented Feb 29, 2012

Ok @narfbg I changed the code to your comments...

@narfbg
Copy link
Contributor

narfbg commented Feb 29, 2012

OK, looks good ... only question is - do we really need it? As I already said in the comments for #1087 - it might be too simple to really need a function, so I'll leave this one to some of the other team members to decide.

@skunkbad
Copy link

skunkbad commented Mar 1, 2012

Maybe I am wrong, but if you set $base_url to https, how can you make non-https anchors, site_urls, etc? Just my opinion, but just because you are in https doesn't mean that base_url should change. What needs to change is the helpers. There needs to be functions that can make https links, non-https links, and links that are https only if in https. A site needs to be able to go back and forth from http to https and back to http. Setting base_url is wrong.

@it-can
Copy link
Contributor Author

it-can commented Mar 1, 2012

If you set base_url in config.php, it will use that value. If there is no base_url it will automatic create a base_url config value (with https or http). Look at this line: https://github.com/IT-Can/CodeIgniter/blob/90223c8680a21a71cac24a9811f9e38e49296f5d/system/core/Config.php#L30

@skunkbad
Copy link

skunkbad commented Mar 1, 2012

Either way, the helpers should be updated. I currently do this by extending the helpers, but cant believe the helpers are not modified to accomodate http and https at the same time. Check out my helper for urls: https://bitbucket.org/skunkbad/community-auth-ci-session-version/src/6ae0d164035d/application/helpers/MY_url_helper.php

@narfbg
Copy link
Contributor

narfbg commented Oct 22, 2012

3fb0267

@it-can It would've taken me some time to explain the changes that needed to be done to your pull request and just commiting it was easier, so I just did that. Nevertheless - thank you for initially submitting this.

@narfbg narfbg closed this Oct 22, 2012
@it-can
Copy link
Contributor Author

it-can commented Oct 22, 2012

@narfbg no problem!

@it-can it-can deleted the is_https-function branch September 17, 2014 13:54
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.

3 participants