aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorHenry Sudhof <kellanved@phpbb.com>2007-04-25 16:30:42 +0000
committerHenry Sudhof <kellanved@phpbb.com>2007-04-25 16:30:42 +0000
commit27daba1df8dbc10db18e3ea763b16e7ccb96e537 (patch)
tree638bd724040b206a8f701f6bf70e73937b043465 /phpBB/includes
parent25219487c6a39a78a9dffe896202ea45969f1d75 (diff)
downloadforums-27daba1df8dbc10db18e3ea763b16e7ccb96e537.tar
forums-27daba1df8dbc10db18e3ea763b16e7ccb96e537.tar.gz
forums-27daba1df8dbc10db18e3ea763b16e7ccb96e537.tar.bz2
forums-27daba1df8dbc10db18e3ea763b16e7ccb96e537.tar.xz
forums-27daba1df8dbc10db18e3ea763b16e7ccb96e537.zip
Still fine-tuning remote avatar conversion. Prepare to be yelled at.
git-svn-id: file:///svn/phpbb/trunk@7401 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_convert.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 90f820dae9..16972b3704 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -912,9 +912,37 @@ function get_remote_avatar_dim($src,$axis)
return $avatar_cache[$src][$axis];
}
+ $url_info = parse_url($src);
+ $host = $url_info['host'];
+ $port = (isset($url_info['port'])) ? $url_info['port'] : 0;
+ $protocol = $url_info['scheme'];
+ if (empty($port))
+ {
+ switch(strtolower($protocol))
+ {
+ case 'ftp':
+ $port = 21;
+ break;
+
+ case 'https':
+ $port = 443;
+ break;
+
+ default:
+ $port = 80;
+ }
+ }
+
$timeout = @ini_get('default_socket_timeout');
@ini_set('default_socket_timeout', 5);
- $avatar_cache[$src] = @getimagesize($src);
+
+ // We're just trying to reach the server to avoid timeouts
+ $fp = @fsockopen($host, $port, $errno, $errstr, 3);
+ if ($fp)
+ {
+ $avatar_cache[$src] = @getimagesize($src);
+ fclose($fp);
+ }
$default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X;
$default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y;