From 5818e44345204e2323781adb87edcfba45e246a8 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 27 Oct 2009 05:43:39 -0400
Subject: [PATCH] - Fix $_SERVER['HTTPS'] check for SSL forcing on IIS (#1486243) + fix port check

---
 program/include/main.inc |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/program/include/main.inc b/program/include/main.inc
index 06d7780..aa0d3fa 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1401,6 +1401,27 @@
 
 
 /**
+ * Check if working in SSL mode
+ *
+ * @param integer HTTPS port number
+ * @param boolean Enables 'use_https' option checking
+ */
+function rcube_https_check($port=null, $use_https=true)
+{
+  global $RCMAIL;
+  
+  if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')
+    return true;
+  if ($port && $_SERVER['SERVER_PORT'] == $port)
+    return true;
+  if ($use_https && $RCMAIL->config->get('use_https'))
+    return true;
+
+  return false;
+}
+
+
+/**
  * E-mail address validation
  */
 function check_email($email)

--
Gitblit v1.9.1