HTTPS. More...
Public Member Functions | |
| ilHTTPS () | |
| checkPort () | |
| check if current port usage is right: if https should be used than redirection is done, to http otherwise. | |
| __readProtectedScripts () | |
| isDetected () | |
| check if https is detected | |
| __readProtectedClasses () | |
| _checkHTTPS () | |
| static method to check if https connections are possible for this server public | |
| _checkHTTP () | |
| static method to check if http connections are possible for this server | |
| enableSecureCookies () | |
| enable secure cookies | |
Data Fields | |
| $enabled = false | |
| $protected_scripts = array() | |
| $automaticHTTPSDetectionEnabled = false | |
| $headerName = false | |
| $headerValue = false | |
HTTPS.
Definition at line 33 of file class.ilHTTPS.php.
| ilHTTPS::__readProtectedClasses | ( | ) |
Definition at line 121 of file class.ilHTTPS.php.
Referenced by ilHTTPS().
{
$this->protected_classes[] = 'ilstartupgui';
$this->protected_classes[] = 'ilregistrationgui';
}
Here is the caller graph for this function:| ilHTTPS::__readProtectedScripts | ( | ) |
Definition at line 86 of file class.ilHTTPS.php.
Referenced by ilHTTPS().
{
$this->protected_scripts[] = 'login.php';
$this->protected_scripts[] = 'index.php';
$this->protected_scripts[] = 'payment.php';
$this->protected_scripts[] = 'register.php';
return true;
}
Here is the caller graph for this function:| ilHTTPS::_checkHTTP | ( | ) |
static method to check if http connections are possible for this server
public
Definition at line 150 of file class.ilHTTPS.php.
Referenced by ilSecuritySettings::validate().
{
$port = 80;
if(($sp = @fsockopen($_SERVER["SERVER_NAME"],$port,$errno,$error)) === false)
{
return false;
}
fclose($sp);
return true;
}
Here is the caller graph for this function:| ilHTTPS::_checkHTTPS | ( | ) |
static method to check if https connections are possible for this server public
Definition at line 132 of file class.ilHTTPS.php.
Referenced by ilSecuritySettings::validate().
{
// only check standard port in the moment
$port = 443;
if(($sp = @fsockopen($_SERVER["SERVER_NAME"],$port,$errno,$error)) === false)
{
return false;
}
fclose($sp);
return true;
}
Here is the caller graph for this function:| ilHTTPS::checkPort | ( | ) |
check if current port usage is right: if https should be used than redirection is done, to http otherwise.
Definition at line 63 of file class.ilHTTPS.php.
{
// if https is enabled for scripts or classes, check for redirection
if ($this->enabled)
{
if((in_array(basename($_SERVER["SCRIPT_NAME"]),$this->protected_scripts) or
in_array($_GET['cmdClass'],$this->protected_classes)) and
$_SERVER["HTTPS"] != "on")
{
header("location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
exit;
}
if((!in_array(basename($_SERVER["SCRIPT_NAME"]),$this->protected_scripts) and
!in_array($_GET['cmdClass'],$this->protected_classes)) and
$_SERVER["HTTPS"] == "on")
{
header("location: http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
exit;
}
}
return true;
}
| ilHTTPS::enableSecureCookies | ( | ) |
enable secure cookies
public
| @return |
Definition at line 169 of file class.ilHTTPS.php.
References $ilLog, and isDetected().
{
global $ilLog,$ilClientIniFile;
$secure_disabled = $ilClientIniFile->readVariable('session','disable_secure_cookies');
if(!$secure_disabled and !$this->enabled and $this->isDetected() and !session_id())
{
#$ilLog->write(__CLASS__.': Enabled secure cookies');
session_set_cookie_params(0,'/','',true);
}
return true;
}
Here is the call graph for this function:| ilHTTPS::ilHTTPS | ( | ) |
Definition at line 42 of file class.ilHTTPS.php.
References $ilSetting, __readProtectedClasses(), and __readProtectedScripts().
{
global $ilSetting;
if($this->enabled = (bool) $ilSetting->get('https'))
{
$this->__readProtectedScripts();
$this->__readProtectedClasses();
}
if ($this->automaticHTTPSDetectionEnabled = (bool) $ilSetting->get("ps_auto_https_enabled"))
{
$this->headerName = $ilSetting->get("ps_auto_https_headername");
$this->headerValue = $ilSetting->get("ps_auto_https_headervalue");
}
}
Here is the call graph for this function:| ilHTTPS::isDetected | ( | ) |
check if https is detected
Definition at line 101 of file class.ilHTTPS.php.
References $headerName.
Referenced by enableSecureCookies().
{
if ($_SERVER["HTTPS"] == "on")
return true;
if ($this->automaticHTTPSDetectionEnabled)
{
$headerName = "HTTP_".str_replace("-","_",$this->headerName);
/* echo $headerName;
echo $_SERVER[$headerName];*/
if (strcasecmp($_SERVER[$headerName],$this->headerValue)==0)
{
$_SERVER["HTTPS"] = "on";
return true;
}
}
return false;
}
Here is the caller graph for this function:| ilHTTPS::$automaticHTTPSDetectionEnabled = false |
Definition at line 38 of file class.ilHTTPS.php.
| ilHTTPS::$enabled = false |
Definition at line 35 of file class.ilHTTPS.php.
| ilHTTPS::$headerName = false |
Definition at line 39 of file class.ilHTTPS.php.
Referenced by isDetected().
| ilHTTPS::$headerValue = false |
Definition at line 40 of file class.ilHTTPS.php.
| ilHTTPS::$protected_scripts = array() |
Definition at line 36 of file class.ilHTTPS.php.
1.7.1