ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

protected

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

References read().

69  {
70  $this->read();
71  }
read()
Fetches data from database.
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilProxySettings::__clone ( )
private

__clone

private

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

81  {
82  }

◆ _getInstance()

static ilProxySettings::_getInstance ( )
static

Getter for unique instance.

public

Returns
ilProxySettings

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

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

94  {
95  if(null === self::$_instance)
96  {
97  self::$_instance = new self();
98  }
99 
100  return self::$_instance;
101  }
+ Here is the caller graph for this function:

◆ checkConnection()

ilProxySettings::checkConnection ( )

Verifies the proxy server connection.

public

Returns
ilProxySettings
Exceptions
ilProxyException

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

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

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

◆ getHost()

ilProxySettings::getHost ( )

Getter for host.

public

Returns
string

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

References $host.

Referenced by checkConnection(), and save().

165  {
166  return $this->host;
167  }
+ Here is the caller graph for this function:

◆ getPort()

ilProxySettings::getPort ( )

Getter for port.

public

Returns
string

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

Referenced by checkConnection(), and save().

194  {
195  return $this->port;
196  }
+ Here is the caller graph for this function:

◆ isActive()

ilProxySettings::isActive (   $status = null)

Getter/Setter for status.

public

Parameters
mixedboolean or null
Returns
mixed ilProxySettings or boolean

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

References $isActive.

Referenced by read(), and save().

129  {
130  if(null === $status)
131  {
132  return (bool)$this->isActive;
133  }
134 
135  $this->isActive = (bool)$status;
136 
137  return $this;
138  }
isActive($status=null)
Getter/Setter for status.
+ Here is the caller graph for this function:

◆ read()

ilProxySettings::read ( )
protected

Fetches data from database.

protected

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

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

Referenced by __construct().

111  {
112  global $ilSetting;
113 
114  $this->setHost($ilSetting->get('proxy_host'));
115  $this->setPort($ilSetting->get('proxy_port'));
116  $this->isActive((bool)$ilSetting->get('proxy_status'));
117  }
isActive($status=null)
Getter/Setter for status.
setPort($port)
Setter for port.
global $ilSetting
Definition: privfeed.php:17
setHost($host)
Setter for host.
+ 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.

public

Returns
ilProxySettings

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

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

207  {
208  global $ilSetting;
209 
210  $ilSetting->set('proxy_host', $this->getHost());
211  $ilSetting->set('proxy_port', $this->getPort());
212  $ilSetting->set('proxy_status', (int)$this->isActive());
213 
214  return $this;
215  }
getHost()
Getter for host.
isActive($status=null)
Getter/Setter for status.
getPort()
Getter for port.
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ setHost()

ilProxySettings::setHost (   $host)

Setter for host.

public

Parameters
string
Returns
ilProxySettings

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

References $host.

Referenced by read().

150  {
151  $this->host = $host;
152 
153  return $this;
154  }
+ Here is the caller graph for this function:

◆ setPort()

ilProxySettings::setPort (   $port)

Setter for port.

public

Parameters
string
Returns
ilProxySettings

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

Referenced by read().

179  {
180  $this->port = $port;
181 
182  return $this;
183  }
+ Here is the caller graph for this function:

Field Documentation

◆ $_instance

ilProxySettings::$_instance = null
staticprotected

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

◆ $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: