diff options
Diffstat (limited to 'phpBB/includes/functions_admin.php')
| -rw-r--r-- | phpBB/includes/functions_admin.php | 65 | 
1 files changed, 9 insertions, 56 deletions
| diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 5ddaf31cf5..0b9ea23fe7 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2982,68 +2982,21 @@ function get_database_size()  /**  * Retrieve contents from remotely stored file +* +* @deprecated	3.1.2	Use file_downloader instead  */  function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6)  { -	global $user; - -	if ($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout)) -	{ -		@fputs($fsock, "GET $directory/$filename HTTP/1.0\r\n"); -		@fputs($fsock, "HOST: $host\r\n"); -		@fputs($fsock, "Connection: close\r\n\r\n"); +	global $phpbb_container; -		$timer_stop = time() + $timeout; -		stream_set_timeout($fsock, $timeout); - -		$file_info = ''; -		$get_info = false; - -		while (!@feof($fsock)) -		{ -			if ($get_info) -			{ -				$file_info .= @fread($fsock, 1024); -			} -			else -			{ -				$line = @fgets($fsock, 1024); -				if ($line == "\r\n") -				{ -					$get_info = true; -				} -				else if (stripos($line, '404 not found') !== false) -				{ -					$errstr = $user->lang('FILE_NOT_FOUND', $filename); -					return false; -				} -			} +	// Get file downloader and assign $errstr and $errno +	$file_downloader = $phpbb_container->get('file_downloader'); -			$stream_meta_data = stream_get_meta_data($fsock); - -			if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop) -			{ -				$errstr = $user->lang['FSOCK_TIMEOUT']; -				return false; -			} -		} -		@fclose($fsock); -	} -	else -	{ -		if ($errstr) -		{ -			$errstr = utf8_convert_message($errstr); -			return false; -		} -		else -		{ -			$errstr = $user->lang['FSOCK_DISABLED']; -			return false; -		} -	} +	$file_data = $file_downloader->get($host, $directory, $filename, $port, $timeout); +	$errstr = $file_downloader->get_error_string(); +	$errno = $file_downloader->get_error_number(); -	return $file_info; +	return $file_data;  }  /* | 
