summaryrefslogtreecommitdiff
path: root/app/Core/Tool.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-09-08 16:49:54 +0200
committerFrédéric Guillot <fred@kanboard.net>2014-09-08 16:49:54 +0200
commitbc0fa40b24f73ccce067f2d23e9aae1335c46694 (patch)
treefbb29773ce539428caed617738db2ccd4bf59df3 /app/Core/Tool.php
parent532ea3b8685cb141526fbcd2cd3dd13667452783 (diff)
Fix bug HTTPS detection (issue with IIS)
Diffstat (limited to 'app/Core/Tool.php')
-rw-r--r--app/Core/Tool.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/Core/Tool.php b/app/Core/Tool.php
index 85b684e2..e54a0d3b 100644
--- a/app/Core/Tool.php
+++ b/app/Core/Tool.php
@@ -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';
+ }
}