Singleton class that stores all security settings. More...
Collaboration diagram for ilSecuritySettings:Public Member Functions | |
| _getInstance () | |
| Get instance of ilSecuritySettings. | |
| getSecuritySettingsRefId () | |
| setAutomaticHTTPSEnabled ($varname) | |
| write access to enable automatic https detection | |
| setAutomaticHTTPSHeaderName ($varname) | |
| set header name for automatic https detection | |
| setAutomaticHTTPSHeaderValue ($varname) | |
| set header value for automatic https detection | |
| getAutomaticHTTPSHeaderName () | |
| read access to header name for automatic https detection | |
| getAutomaticHTTPSHeaderValue () | |
| read access to header value for automatic https detection | |
| isAutomaticHTTPSEnabled () | |
| read access to switch if automatic https detection is enabled | |
| setHTTPSEnabled ($value) | |
| Enable https for certain scripts. | |
| isHTTPSEnabled () | |
| read access to https enabled property | |
| save () | |
| Save settings. | |
| validate () | |
| validate settings | |
Static Public Attributes | |
| static | $SECURITY_SETTINGS_ERR_CODE_AUTO_HTTPS = 1 |
| static | $SECURITY_SETTINGS_ERR_CODE_HTTP_NOT_AVAILABLE = 2 |
| static | $SECURITY_SETTINGS_ERR_CODE_HTTPS_NOT_AVAILABLE = 3 |
Private Member Functions | |
| __construct () | |
| Private constructor: use _getInstance(). | |
| read () | |
| read settings | |
Private Attributes | |
| $db | |
| $settings | |
| $https_header_enable | |
| $https_header_name | |
| $https_header_value | |
| $https_enable | |
Static Private Attributes | |
| static | $instance = null |
Singleton class that stores all security settings.
/
Definition at line 34 of file class.ilSecuritySettings.php.
| ilSecuritySettings::__construct | ( | ) | [private] |
Private constructor: use _getInstance().
private
Definition at line 56 of file class.ilSecuritySettings.php.
References $ilSetting, and read().
{
global $ilSetting,$ilDB;
$this->db = $ilDB;
$this->settings = $ilSetting;
$this->read();
}
Here is the call graph for this function:| ilSecuritySettings::_getInstance | ( | ) |
Get instance of ilSecuritySettings.
Definition at line 73 of file class.ilSecuritySettings.php.
Referenced by ilObjPrivacySecurityGUI::showSecurity().
{
if(is_object(self::$instance))
{
return self::$instance;
}
return self::$instance = new ilSecuritySettings();
}
Here is the caller graph for this function:| ilSecuritySettings::getAutomaticHTTPSHeaderName | ( | ) |
read access to header name for automatic https detection
Definition at line 124 of file class.ilSecuritySettings.php.
Referenced by save(), and validate().
{
return $this->https_header_name;
}
Here is the caller graph for this function:| ilSecuritySettings::getAutomaticHTTPSHeaderValue | ( | ) |
read access to header value for automatic https detection
Definition at line 134 of file class.ilSecuritySettings.php.
Referenced by save(), and validate().
{
return $this->https_header_value;
}
Here is the caller graph for this function:| ilSecuritySettings::getSecuritySettingsRefId | ( | ) |
Definition at line 82 of file class.ilSecuritySettings.php.
{
return $this->ref_id;
}
| ilSecuritySettings::isAutomaticHTTPSEnabled | ( | ) |
read access to switch if automatic https detection is enabled
Definition at line 144 of file class.ilSecuritySettings.php.
Referenced by save(), and validate().
{
return $this->https_header_enable;
}
Here is the caller graph for this function:| ilSecuritySettings::isHTTPSEnabled | ( | ) |
read access to https enabled property
Definition at line 165 of file class.ilSecuritySettings.php.
Referenced by save(), and validate().
{
return $this->https_enable;
}
Here is the caller graph for this function:| ilSecuritySettings::read | ( | ) | [private] |
read settings
private
Definition at line 188 of file class.ilSecuritySettings.php.
References $res.
Referenced by __construct().
{
global $ilDB;
$query = "SELECT object_reference.ref_id FROM object_reference,tree,object_data ".
"WHERE tree.parent = ".$ilDB->quote(SYSTEM_FOLDER_ID)." ".
"AND object_data.type = 'ps' ".
"AND object_reference.ref_id = tree.child ".
"AND object_reference.obj_id = object_data.obj_id";
$res = $this->db->query($query);
$row = $res->fetchRow(DB_FETCHMODE_ASSOC);
$this->ref_id = $row["ref_id"];
$this->https_header_enable = (bool) $this->settings->get('ps_auto_https_enabled',false);
$this->https_header_name = (string) $this->settings->get('ps_auto_https_headername',"ILIAS_HTTPS_ENABLED");
$this->https_header_value = (string) $this->settings->get('ps_auto_https_headervalue',"1");
$this->https_enable = (boolean) $this->settings->get('https', false);
}
Here is the caller graph for this function:| ilSecuritySettings::save | ( | ) |
Save settings.
Definition at line 174 of file class.ilSecuritySettings.php.
References getAutomaticHTTPSHeaderName(), getAutomaticHTTPSHeaderValue(), isAutomaticHTTPSEnabled(), and isHTTPSEnabled().
{
$this->settings->set('ps_auto_https_enabled',(bool) $this->isAutomaticHTTPSEnabled());
$this->settings->set('ps_auto_https_headername',(string) $this->getAutomaticHTTPSHeaderName());
$this->settings->set('ps_auto_https_headervalue',(string) $this->getAutomaticHTTPSHeaderValue());
$this->settings->set('https',(string) $this->isHTTPSEnabled());
}
Here is the call graph for this function:| ilSecuritySettings::setAutomaticHTTPSEnabled | ( | $ | varname | ) |
write access to enable automatic https detection
| boolean | $varname |
Definition at line 93 of file class.ilSecuritySettings.php.
{
$this->https_header_enable = $varname;
}
| ilSecuritySettings::setAutomaticHTTPSHeaderName | ( | $ | varname | ) |
set header name for automatic https detection
| string | $varname |
Definition at line 104 of file class.ilSecuritySettings.php.
{
$this->https_header_name = $varname;
}
| ilSecuritySettings::setAutomaticHTTPSHeaderValue | ( | $ | varname | ) |
set header value for automatic https detection
| string | $varname |
Definition at line 114 of file class.ilSecuritySettings.php.
{
$this->https_header_value = $varname;
}
| ilSecuritySettings::setHTTPSEnabled | ( | $ | value | ) |
Enable https for certain scripts.
| boolean | $value |
Definition at line 154 of file class.ilSecuritySettings.php.
{
$this->https_enable = $value;
}
| ilSecuritySettings::validate | ( | ) |
validate settings
Definition at line 212 of file class.ilSecuritySettings.php.
References $SECURITY_SETTINGS_ERR_CODE_AUTO_HTTPS, $SECURITY_SETTINGS_ERR_CODE_HTTP_NOT_AVAILABLE, $SECURITY_SETTINGS_ERR_CODE_HTTPS_NOT_AVAILABLE, ilHTTPS::_checkHTTP(), ilHTTPS::_checkHTTPS(), getAutomaticHTTPSHeaderName(), getAutomaticHTTPSHeaderValue(), isAutomaticHTTPSEnabled(), and isHTTPSEnabled().
{
if ($this->isAutomaticHTTPSEnabled() &&
(strlen($this->getAutomaticHTTPSHeaderName()) == 0 ||
strlen($this->getAutomaticHTTPSHeaderValue()) == 0)
)
{
return ilSecuritySettings::$SECURITY_SETTINGS_ERR_CODE_AUTO_HTTPS;
}
include_once './classes/class.ilHTTPS.php';
if ($this->isHTTPSEnabled())
{
if(!ilHTTPS::_checkHTTPS())
{
return ilSecuritySettings::$SECURITY_SETTINGS_ERR_CODE_HTTPS_NOT_AVAILABLE;
}
} elseif(!ilHTTPS::_checkHTTP())
{
return ilSecuritySettings::$SECURITY_SETTINGS_ERR_CODE_HTTP_NOT_AVAILABLE;
}
return 0;
}
Here is the call graph for this function:ilSecuritySettings::$db [private] |
Definition at line 41 of file class.ilSecuritySettings.php.
ilSecuritySettings::$https_enable [private] |
Definition at line 47 of file class.ilSecuritySettings.php.
ilSecuritySettings::$https_header_enable [private] |
Definition at line 44 of file class.ilSecuritySettings.php.
ilSecuritySettings::$https_header_name [private] |
Definition at line 45 of file class.ilSecuritySettings.php.
ilSecuritySettings::$https_header_value [private] |
Definition at line 46 of file class.ilSecuritySettings.php.
ilSecuritySettings::$instance = null [static, private] |
Definition at line 40 of file class.ilSecuritySettings.php.
ilSecuritySettings::$SECURITY_SETTINGS_ERR_CODE_AUTO_HTTPS = 1 [static] |
Definition at line 36 of file class.ilSecuritySettings.php.
Referenced by ilObjPrivacySecurityGUI::__construct(), and validate().
ilSecuritySettings::$SECURITY_SETTINGS_ERR_CODE_HTTP_NOT_AVAILABLE = 2 [static] |
Definition at line 37 of file class.ilSecuritySettings.php.
Referenced by ilObjPrivacySecurityGUI::__construct(), and validate().
ilSecuritySettings::$SECURITY_SETTINGS_ERR_CODE_HTTPS_NOT_AVAILABLE = 3 [static] |
Definition at line 38 of file class.ilSecuritySettings.php.
Referenced by ilObjPrivacySecurityGUI::__construct(), and validate().
ilSecuritySettings::$settings [private] |
Definition at line 42 of file class.ilSecuritySettings.php.
1.7.1