Fix bug HTTPS detection (issue with IIS)

This commit is contained in:
Frédéric Guillot
2014-09-08 16:49:54 +02:00
parent 532ea3b868
commit bc0fa40b24
5 changed files with 29 additions and 5 deletions

View File

@@ -32,6 +32,15 @@ class Tool
}
}
/**
* Load and register a model
*
* @static
* @access public
* @param Core\Registry $registry DPI container
* @param string $name Model name
* @return mixed
*/
public static function loadModel(Registry $registry, $name)
{
if (! isset($registry->$name)) {
@@ -41,4 +50,18 @@ class Tool
return $registry->shared($name);
}
/**
* Check if the page is requested through HTTPS
*
* Note: IIS return the value 'off' and other web servers an empty value when it's not HTTPS
*
* @static
* @access public
* @return boolean
*/
public static function isHTTPS()
{
return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== '' && $_SERVER['HTTPS'] !== 'off';
}
}