ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilProxySettings Class Reference

class ilProxySettings More...

+ Collaboration diagram for ilProxySettings:

Public Member Functions

 isActive ($status=null)
 Getter/Setter for status. More...
 
 setHost ($host)
 Setter for host. More...
 
 getHost ()
 Getter for host. More...
 
 setPort ($port)
 Setter for port. More...
 
 getPort ()
 Getter for port. More...
 
 save ()
 Saves the current data in database. More...
 
 checkConnection ()
 Verifies the proxy server connection. More...
 

Static Public Member Functions

static _getInstance ()
 Getter for unique instance. More...
 

Data Fields

const CONNECTION_CHECK_TIMEOUT = 10
 

Protected Member Functions

 __construct ()
 Constructor. More...
 
 read ()
 Fetches data from database. More...
 

Protected Attributes

 $host = ''
 
 $post = ''
 
 $isActive = false
 

Static Protected Attributes

static $_instance = null
 

Private Member Functions

 __clone ()
 __clone More...
 

Detailed Description

class ilProxySettings

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 13 of file class.ilProxySettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilProxySettings::__construct ( )
protected

Constructor.

@access protected

Definition at line 68 of file class.ilProxySettings.php.

69 {
70 $this->read();
71 }
read()
Fetches data from database.

References read().

+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilProxySettings::__clone ( )
private

__clone

@access private

Definition at line 80 of file class.ilProxySettings.php.

81 {
82 }

◆ _getInstance()

static ilProxySettings::_getInstance ( )
static

Getter for unique instance.

@access public

Returns
ilProxySettings

Definition at line 93 of file class.ilProxySettings.php.

94 {
95 if (null === self::$_instance) {
96 self::$_instance = new self();
97 }
98
99 return self::$_instance;
100 }

References $_instance.

Referenced by ilExternalFeed\__construct(), ilLinkChecker\__validateLinks(), ilExternalFeed\_checkUrl(), ilExternalFeed\_determineFeedUrl(), ilMediaImageUtil\getImageSize(), ilCalendarRemoteReader\initCurl(), ilObjSystemFolderGUI\printProxyStatus(), ilObjSystemFolderGUI\saveProxyObject(), and ilObjSystemFolderGUI\showProxyObject().

+ Here is the caller graph for this function:

◆ checkConnection()

ilProxySettings::checkConnection ( )

Verifies the proxy server connection.

@access public

Returns
ilProxySettings
Exceptions
ilProxyException

Definition at line 224 of file class.ilProxySettings.php.

225 {
226 global $DIC;
227
228 $errno = null;
229 $errstr = null;
230
231 set_error_handler(function ($severity, $message, $file, $line) {
232 throw new ErrorException($message, $severity, $severity, $file, $line);
233 });
234
235 try {
236 $host = $this->getHost();
237 if (strspn($host, '.0123456789') != strlen($host) && strstr($host, '/') === false) {
238 $host = gethostbyname($host);
239 }
240 $port = $this->getPort() % 65536;
241
242 if (!fsockopen($host, $port, $errno, $errstr, self::CONNECTION_CHECK_TIMEOUT)) {
243 restore_error_handler();
244 throw new ilProxyException(strlen($errstr) ? $errstr : $DIC->language()->txt('proxy_not_connectable'));
245 }
246 restore_error_handler();
247 } catch (Exception $e) {
248 restore_error_handler();
249 throw new ilProxyException(strlen($errstr) ? $errstr : $DIC->language()->txt('proxy_not_connectable'));
250 }
251
252 return $this;
253 }
Class for proxy related exception handling in ILIAS.
getHost()
Getter for host.
getPort()
Getter for port.
catch(Exception $e) $message
global $DIC
Definition: saml.php:7

References $DIC, $host, $message, getHost(), and getPort().

+ Here is the call graph for this function:

◆ getHost()

ilProxySettings::getHost ( )

Getter for host.

@access public

Returns
string

Definition at line 162 of file class.ilProxySettings.php.

163 {
164 return $this->host;
165 }

References $host.

Referenced by checkConnection(), and save().

+ Here is the caller graph for this function:

◆ getPort()

ilProxySettings::getPort ( )

Getter for port.

@access public

Returns
string

Definition at line 191 of file class.ilProxySettings.php.

192 {
193 return $this->port;
194 }

Referenced by checkConnection(), and save().

+ Here is the caller graph for this function:

◆ isActive()

ilProxySettings::isActive (   $status = null)

Getter/Setter for status.

@access public

Parameters
mixedboolean or null
Returns
mixed ilProxySettings or boolean

Definition at line 127 of file class.ilProxySettings.php.

128 {
129 if (null === $status) {
130 return (bool) $this->isActive;
131 }
132
133 $this->isActive = (bool) $status;
134
135 return $this;
136 }
isActive($status=null)
Getter/Setter for status.

References $isActive, and isActive().

Referenced by isActive(), read(), and save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilProxySettings::read ( )
protected

Fetches data from database.

@access protected

Definition at line 109 of file class.ilProxySettings.php.

110 {
111 global $ilSetting;
112
113 $this->setHost($ilSetting->get('proxy_host'));
114 $this->setPort($ilSetting->get('proxy_port'));
115 $this->isActive((bool) $ilSetting->get('proxy_status'));
116 }
setHost($host)
Setter for host.
setPort($port)
Setter for port.
global $ilSetting
Definition: privfeed.php:17

References $ilSetting, isActive(), setHost(), and setPort().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilProxySettings::save ( )

Saves the current data in database.

@access public

Returns
ilProxySettings

Definition at line 204 of file class.ilProxySettings.php.

205 {
206 global $ilSetting;
207
208 $ilSetting->set('proxy_host', $this->getHost());
209 $ilSetting->set('proxy_port', $this->getPort());
210 $ilSetting->set('proxy_status', (int) $this->isActive());
211
212 return $this;
213 }

References $ilSetting, getHost(), getPort(), and isActive().

+ Here is the call graph for this function:

◆ setHost()

ilProxySettings::setHost (   $host)

Setter for host.

@access public

Parameters
string
Returns
ilProxySettings

Definition at line 147 of file class.ilProxySettings.php.

148 {
149 $this->host = $host;
150
151 return $this;
152 }

References $host.

Referenced by read().

+ Here is the caller graph for this function:

◆ setPort()

ilProxySettings::setPort (   $port)

Setter for port.

@access public

Parameters
string
Returns
ilProxySettings

Definition at line 176 of file class.ilProxySettings.php.

177 {
178 $this->port = $port;
179
180 return $this;
181 }

Referenced by read().

+ Here is the caller graph for this function:

Field Documentation

◆ $_instance

ilProxySettings::$_instance = null
staticprotected

Definition at line 26 of file class.ilProxySettings.php.

Referenced by _getInstance().

◆ $host

ilProxySettings::$host = ''
protected

Definition at line 37 of file class.ilProxySettings.php.

Referenced by checkConnection(), getHost(), and setHost().

◆ $isActive

ilProxySettings::$isActive = false
protected

Definition at line 59 of file class.ilProxySettings.php.

Referenced by isActive().

◆ $post

ilProxySettings::$post = ''
protected

Definition at line 48 of file class.ilProxySettings.php.

◆ CONNECTION_CHECK_TIMEOUT

const ilProxySettings::CONNECTION_CHECK_TIMEOUT = 10

Definition at line 15 of file class.ilProxySettings.php.


The documentation for this class was generated from the following file: