35 if($this->enabled = (
bool) $ilSetting->get(
'https'))
40 if ($this->automaticHTTPSDetectionEnabled = (
bool) $ilSetting->get(
"ps_auto_https_enabled"))
42 $this->headerName = $ilSetting->get(
"ps_auto_https_headername");
43 $this->headerValue = $ilSetting->get(
"ps_auto_https_headervalue");
57 return self::$instance =
new ilHTTPS();
68 case self::PROTOCOL_HTTP:
69 $should_switch_to_http = (
70 !in_array(basename($_SERVER[
'SCRIPT_NAME']), $this->protected_scripts) &&
71 !in_array(strtolower(
$_GET[
'cmdClass']), $this->protected_classes)
72 ) && $_SERVER[
'HTTPS'] ==
'on';
74 return $should_switch_to_http;
77 case self::PROTOCOL_HTTPS:
78 $should_switch_to_https = (
79 in_array(basename($_SERVER[
'SCRIPT_NAME']), $this->protected_scripts) ||
80 in_array(strtolower(
$_GET[
'cmdClass']), $this->protected_classes)
81 ) && $_SERVER[
'HTTPS'] !=
'on';
83 return $should_switch_to_https;
102 header(
"location: https://".$_SERVER[
"SERVER_NAME"].$_SERVER[
"REQUEST_URI"]);
107 header(
"location: http://".$_SERVER[
"SERVER_NAME"].$_SERVER[
"REQUEST_URI"]);
116 $this->protected_scripts[] =
'login.php';
117 $this->protected_scripts[] =
'index.php';
118 $this->protected_scripts[] =
'payment.php';
119 $this->protected_scripts[] =
'register.php';
121 $this->protected_scripts[] =
'webdav.php';
123 $this->protected_scripts[] =
'shib_login.php';
135 if (isset($_SERVER[
"HTTPS"]) && $_SERVER[
"HTTPS"] ==
"on")
138 if ($this->automaticHTTPSDetectionEnabled)
140 $headerName =
"HTTP_".str_replace(
"-",
"_",$this->headerName);
143 if (strcasecmp($_SERVER[
$headerName],$this->headerValue)==0)
145 $_SERVER[
"HTTPS"] =
"on";
162 $this->protected_classes[] =
'ilstartupgui';
163 $this->protected_classes[] =
'ilaccountregistrationgui';
164 $this->protected_classes[] =
'ilpurchasebmfgui';
165 $this->protected_classes[] =
'ilpurchasepaypal';
166 $this->protected_classes[] =
'ilshopshoppingcartgui';
167 $this->protected_classes[] =
'ilpurchasebillgui';
168 $this->protected_classes[] =
'ilpersonalsettingsgui';
181 if(($sp = fsockopen($_SERVER[
"SERVER_NAME"],$port,$errno,$error)) ===
false)
198 if(($sp = fsockopen($_SERVER[
"SERVER_NAME"],$port,$errno,$error)) ===
false)
215 global
$ilLog,$ilClientIniFile;
217 $secure_disabled = $ilClientIniFile->readVariable(
'session',
'disable_secure_cookies');
218 if(!$secure_disabled and !$this->enabled and $this->
isDetected() and !session_id())
220 #$ilLog->write(__CLASS__.': Enabled secure cookies');
224 if( version_compare(PHP_VERSION,
'5.2.0',
'>=') )
227 session_set_cookie_params(
228 IL_COOKIE_EXPIRE,
IL_COOKIE_PATH, IL_COOKIE_DOMAIN,
true, IL_COOKIE_HTTPONLY
234 session_set_cookie_params(