diff options
Diffstat (limited to 'phpBB')
| -rw-r--r-- | phpBB/includes/acp/acp_extensions.php | 2 | ||||
| -rw-r--r-- | phpBB/phpbb/file_downloader.php | 2 | ||||
| -rw-r--r-- | phpBB/phpbb/version_helper.php | 13 | 
3 files changed, 12 insertions, 5 deletions
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index e3eb0058bf..9fbf2f20f1 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -539,7 +539,7 @@ class acp_extensions  		$version_helper = new \phpbb\version_helper($this->cache, $this->config, new \phpbb\file_downloader(), $this->user);  		$version_helper->set_current_version($meta['version']); -		$version_helper->set_file_location($version_check['host'], $version_check['directory'], $version_check['filename']); +		$version_helper->set_file_location($version_check['host'], $version_check['directory'], $version_check['filename'], isset($version_check['ssl']) ? $version_check['ssl'] : false);  		$version_helper->force_stability($this->config['extension_force_unstable'] ? 'unstable' : null);  		return $updates = $version_helper->get_suggested_updates($force_update, $force_cache); diff --git a/phpBB/phpbb/file_downloader.php b/phpBB/phpbb/file_downloader.php index 462b87ca51..ab9505a14c 100644 --- a/phpBB/phpbb/file_downloader.php +++ b/phpBB/phpbb/file_downloader.php @@ -42,7 +42,7 @@ class file_downloader  		$this->error_number = 0;  		$this->error_string = ''; -		if ($socket = @fsockopen($host, $port, $this->error_number, $this->error_string, $timeout)) +		if ($socket = @fsockopen(($port == 443 ? 'tls://' : '') . $host, $port, $this->error_number, $this->error_string, $timeout))  		{  			@fputs($socket, "GET $directory/$filename HTTP/1.0\r\n");  			@fputs($socket, "HOST: $host\r\n"); diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index e4f68f5aab..a1e66ba8fe 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -34,6 +34,11 @@ class version_helper  	protected $file = 'versions.json';  	/** +	 * @var bool Use SSL or not +	 */ +	protected $use_ssl = false; + +	/**  	 * @var string Current version installed  	 */  	protected $current_version; @@ -85,13 +90,15 @@ class version_helper  	 * @param string $host Host (e.g. version.phpbb.com)  	 * @param string $path Path to file (e.g. /phpbb)  	 * @param string $file File name (Default: versions.json) +	 * @param bool $use_ssl Use SSL or not (Default: false)  	 * @return version_helper  	 */ -	public function set_file_location($host, $path, $file = 'versions.json') +	public function set_file_location($host, $path, $file = 'versions.json', $use_ssl = false)  	{  		$this->host = $host;  		$this->path = $path;  		$this->file = $file; +		$this->use_ssl = $use_ssl;  		return $this;  	} @@ -244,7 +251,7 @@ class version_helper  	*/  	public function get_versions($force_update = false, $force_cache = false)  	{ -		$cache_file = '_versioncheck_' . $this->host . $this->path . $this->file; +		$cache_file = '_versioncheck_' . $this->host . $this->path . $this->file . $this->use_ssl;  		$info = $this->cache->get($cache_file); @@ -255,7 +262,7 @@ class version_helper  		else if ($info === false || $force_update)  		{  			try { -				$info = $this->file_downloader->get($this->host, $this->path, $this->file); +				$info = $this->file_downloader->get($this->host, $this->path, $this->file, $this->use_ssl ? 443 : 80);  			}  			catch (\phpbb\exception\runtime_exception $exception)  			{  | 
