1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-09 07:58:56 +02:00

Merge PR #990 branch 'bantu/ticket/11100' into develop

* bantu/ticket/11100:
  [ticket/11100] Mark can_use_ssl() and can_use_tls() as static.
This commit is contained in:
Oleg Pudeyev 2012-10-10 00:18:25 -04:00
commit 39258c9452

View File

@ -68,7 +68,7 @@ class jabber
} }
$this->password = $password; $this->password = $password;
$this->use_ssl = ($use_ssl && $this->can_use_ssl()) ? true : false; $this->use_ssl = ($use_ssl && self::can_use_ssl()) ? true : false;
// Change port if we use SSL // Change port if we use SSL
if ($this->port == 5222 && $this->use_ssl) if ($this->port == 5222 && $this->use_ssl)
@ -83,7 +83,7 @@ class jabber
/** /**
* Able to use the SSL functionality? * Able to use the SSL functionality?
*/ */
function can_use_ssl() static public function can_use_ssl()
{ {
// Will not work with PHP >= 5.2.1 or < 5.2.3RC2 until timeout problem with ssl hasn't been fixed (http://bugs.php.net/41236) // Will not work with PHP >= 5.2.1 or < 5.2.3RC2 until timeout problem with ssl hasn't been fixed (http://bugs.php.net/41236)
return ((version_compare(PHP_VERSION, '5.2.1', '<') || version_compare(PHP_VERSION, '5.2.3RC2', '>=')) && @extension_loaded('openssl')) ? true : false; return ((version_compare(PHP_VERSION, '5.2.1', '<') || version_compare(PHP_VERSION, '5.2.3RC2', '>=')) && @extension_loaded('openssl')) ? true : false;
@ -92,7 +92,7 @@ class jabber
/** /**
* Able to use TLS? * Able to use TLS?
*/ */
function can_use_tls() static public function can_use_tls()
{ {
if (!@extension_loaded('openssl') || !function_exists('stream_socket_enable_crypto') || !function_exists('stream_get_meta_data') || !function_exists('socket_set_blocking') || !function_exists('stream_get_wrappers')) if (!@extension_loaded('openssl') || !function_exists('stream_socket_enable_crypto') || !function_exists('stream_get_meta_data') || !function_exists('socket_set_blocking') || !function_exists('stream_get_wrappers'))
{ {
@ -442,7 +442,7 @@ class jabber
} }
// Let's use TLS if SSL is not enabled and we can actually use it // Let's use TLS if SSL is not enabled and we can actually use it
if (!$this->session['ssl'] && $this->can_use_tls() && $this->can_use_ssl() && isset($xml['stream:features'][0]['#']['starttls'])) if (!$this->session['ssl'] && self::can_use_tls() && self::can_use_ssl() && isset($xml['stream:features'][0]['#']['starttls']))
{ {
$this->add_to_log('Switching to TLS.'); $this->add_to_log('Switching to TLS.');
$this->send("<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>\n"); $this->send("<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>\n");