/** * * Print proxy settings * * @access private * */ public function printProxyStatus($client) { require_once './Services/Http/exceptions/class.ilProxyException.php'; $settings = $client->getAllSettings(); if ((bool) $settings['proxy_status'] == true) { try { /** * * Verifies the proxy server connection */ require_once 'Services/PEAR/lib/Net/Socket.php'; $socket = new Net_Socket(); $socket->setErrorHandling(PEAR_ERROR_RETURN); $response = $socket->connect($settings['proxy_host'], $settings['proxy_port']); if (!is_bool($response)) { global $lng; throw new ilProxyException(strlen($response) ? $response : $lng->txt('proxy_not_connectable')); } ilUtil::sendSuccess($this->lng->txt('proxy_connectable')); } catch (ilProxyException $e) { ilUtil::sendFailure($this->lng->txt('proxy_pear_net_socket_error') . ': ' . $e->getMessage()); } } }
/** * * Verifies the proxy server connection * * @access public * @return ilProxySettings * @throws ilProxyException * */ public function checkConnection() { require_once 'Services/PEAR/lib/Net/Socket.php'; $socket = new Net_Socket(); $socket->setErrorHandling(PEAR_ERROR_RETURN); $response = $socket->connect($this->getHost(), $this->getPort()); if (!is_bool($response)) { global $lng; throw new ilProxyException(strlen($response) ? $response : $lng->txt('proxy_not_connectable')); } return $this; }