PhileCMS/Phile — pull request #172 by DenBeke (2014-12-23 11:47:43+00:00)
Title: [Fix] Nginx: https/http protocol detection

In Nginx the `$_SERVER['HTTPS']` is always set, but when it is not https, it will be empty.

In Wordpress they use the following function
```php
function is_ssl() {
if ( isset($_SERVER['HTTPS']) ) {
if ( 'on' == strtolower($_SERVER['HTTPS']) )
return true;
if ( '1' == $_SERVER['HTTPS'] )
return true;
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
return true;
}
return false;
}
```

Checking for the port is not very good, imho, but the first part of the function should be correct.
Instead of checking for the variable not to be `off`, you should check for it to be `on`.

I have tested it on Nginx with/without https. I have tested it on Apache without https, but haven't any https Apache hosts where I can check it.

So please do some little testing before merging it. I have fixed this for a client, running on my Nginx installation, but I'm not experienced with PhileCMS, so please test a bit more than I have doen :)