32 if($this->enabled = (
bool) $ilSetting->get(
'https'))
37 if ($this->automaticHTTPSDetectionEnabled = (
bool) $ilSetting->get(
"ps_auto_https_enabled"))
39 $this->headerName = $ilSetting->get(
"ps_auto_https_headername");
40 $this->headerValue = $ilSetting->get(
"ps_auto_https_headervalue");
54 return self::$instance =
new ilHTTPS();
67 if((in_array(basename($_SERVER[
"SCRIPT_NAME"]),$this->protected_scripts) or
68 in_array(
$_GET[
'cmdClass'],$this->protected_classes)) and
69 $_SERVER[
"HTTPS"] !=
"on")
71 header(
"location: https://".$_SERVER[
"SERVER_NAME"].$_SERVER[
"REQUEST_URI"]);
74 if((!in_array(basename($_SERVER[
"SCRIPT_NAME"]),$this->protected_scripts) and
75 !in_array(
$_GET[
'cmdClass'],$this->protected_classes)) and
76 $_SERVER[
"HTTPS"] ==
"on")
78 header(
"location: http://".$_SERVER[
"SERVER_NAME"].$_SERVER[
"REQUEST_URI"]);
87 $this->protected_scripts[] =
'login.php';
88 $this->protected_scripts[] =
'index.php';
89 $this->protected_scripts[] =
'payment.php';
90 $this->protected_scripts[] =
'register.php';
92 $this->protected_scripts[] =
'webdav.php';
94 $this->protected_scripts[] =
'shib_login.php';
106 if ($_SERVER[
"HTTPS"] ==
"on")
109 if ($this->automaticHTTPSDetectionEnabled)
111 $headerName =
"HTTP_".str_replace(
"-",
"_",$this->headerName);
114 if (strcasecmp($_SERVER[
$headerName],$this->headerValue)==0)
116 $_SERVER[
"HTTPS"] =
"on";
133 $this->protected_classes[] =
'ilstartupgui';
134 $this->protected_classes[] =
'ilaccountregistrationgui';
135 $this->protected_classes[] =
'ilpurchasebmfgui';
136 $this->protected_classes[] =
'ilpurchasepaypal';
137 $this->protected_classes[] =
'ilshopshoppingcartgui';
138 $this->protected_classes[] =
'ilpurchasebillgui';
151 if(($sp = fsockopen($_SERVER[
"SERVER_NAME"],$port,$errno,
$error)) ===
false)
168 if(($sp = fsockopen($_SERVER[
"SERVER_NAME"],$port,$errno,
$error)) ===
false)
185 global
$ilLog,$ilClientIniFile;
187 $secure_disabled = $ilClientIniFile->readVariable(
'session',
'disable_secure_cookies');
188 if(!$secure_disabled and !$this->enabled and $this->
isDetected() and !session_id())
190 $ilLog->write(__CLASS__.
': Enabled secure cookies');
194 if( version_compare(PHP_VERSION,
'5.2.0',
'>=') )
197 session_set_cookie_params(
198 IL_COOKIE_EXPIRE, IL_COOKIE_PATH, IL_COOKIE_DOMAIN,
true, IL_COOKIE_HTTPONLY
204 session_set_cookie_params(
205 IL_COOKIE_EXPIRE, IL_COOKIE_PATH, IL_COOKIE_DOMAIN,
true