35 if($this->enabled = (
bool)$ilSetting->get(
'https'))
41 if ($this->automaticHTTPSDetectionEnabled = (
bool)$ilIliasIniFile->readVariable(
'https',
"auto_https_detect_enabled"))
43 $this->headerName = $ilIliasIniFile->readVariable(
'https',
"auto_https_detect_header_name");
44 $this->headerValue = $ilIliasIniFile->readVariable(
'https',
"auto_https_detect_header_value");
58 return self::$instance =
new ilHTTPS();
69 case self::PROTOCOL_HTTP:
70 $should_switch_to_http = (
71 !in_array(basename($_SERVER[
'SCRIPT_NAME']), $this->protected_scripts) &&
72 !in_array(strtolower(
$_GET[
'cmdClass']), $this->protected_classes)
73 ) && $_SERVER[
'HTTPS'] ==
'on';
75 return $should_switch_to_http;
78 case self::PROTOCOL_HTTPS:
79 $should_switch_to_https = (
80 in_array(basename($_SERVER[
'SCRIPT_NAME']), $this->protected_scripts) ||
81 in_array(strtolower(
$_GET[
'cmdClass']), $this->protected_classes)
82 ) && $_SERVER[
'HTTPS'] !=
'on';
84 return $should_switch_to_https;
103 header(
"location: https://".$_SERVER[
"SERVER_NAME"].$_SERVER[
"REQUEST_URI"]);
108 header(
"location: http://".$_SERVER[
"SERVER_NAME"].$_SERVER[
"REQUEST_URI"]);
117 $this->protected_scripts[] =
'login.php';
118 $this->protected_scripts[] =
'index.php';
119 $this->protected_scripts[] =
'payment.php';
120 $this->protected_scripts[] =
'register.php';
122 $this->protected_scripts[] =
'webdav.php';
124 $this->protected_scripts[] =
'shib_login.php';
136 if (isset($_SERVER[
"HTTPS"]) && $_SERVER[
"HTTPS"] ==
"on")
139 if ($this->automaticHTTPSDetectionEnabled)
141 $headerName =
"HTTP_".str_replace(
"-",
"_",$this->headerName);
144 if (strcasecmp($_SERVER[
$headerName],$this->headerValue)==0)
146 $_SERVER[
"HTTPS"] =
"on";
163 $this->protected_classes[] =
'ilstartupgui';
164 $this->protected_classes[] =
'ilaccountregistrationgui';
165 $this->protected_classes[] =
'ilpurchasebmfgui';
166 $this->protected_classes[] =
'ilpurchasepaypal';
167 $this->protected_classes[] =
'ilshopshoppingcartgui';
168 $this->protected_classes[] =
'ilpurchasebillgui';
169 $this->protected_classes[] =
'ilpersonalsettingsgui';
182 if(($sp = fsockopen($_SERVER[
"SERVER_NAME"],$port,$errno,$error)) ===
false)
199 if(($sp = fsockopen($_SERVER[
"SERVER_NAME"],$port,$errno,$error)) ===
false)
216 global
$ilLog,$ilClientIniFile;
218 $secure_disabled = $ilClientIniFile->readVariable(
'session',
'disable_secure_cookies');
219 if(!$secure_disabled and !$this->enabled and $this->
isDetected() and !session_id())
221 #$ilLog->write(__CLASS__.': Enabled secure cookies');
225 if( version_compare(PHP_VERSION,
'5.2.0',
'>=') )
228 session_set_cookie_params(
229 IL_COOKIE_EXPIRE,
IL_COOKIE_PATH, IL_COOKIE_DOMAIN,
true, IL_COOKIE_HTTPONLY
235 session_set_cookie_params(