-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Conversation
{ | ||
function is_https() | ||
{ | ||
return ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ? TRUE : FALSE; |
There was a problem hiding this comment.
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.
Ok @narfbg I changed the code to your comments... |
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. |
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. |
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 |
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 no problem! |
Added is_https() function to common.php