diff options
author | Bart van Bragt <bartvb@users.sourceforge.net> | 2005-01-27 14:10:31 +0000 |
---|---|---|
committer | Bart van Bragt <bartvb@users.sourceforge.net> | 2005-01-27 14:10:31 +0000 |
commit | 89b5c490efc5e31f8a9533b9854ccb92b02bf33c (patch) | |
tree | 01dcfe4ddb0ee985a86a665d6a6de1fac8d7f166 /phpBB/includes | |
parent | 85273102727fc6e5f5819b5e739e30d054f91ce9 (diff) | |
download | forums-89b5c490efc5e31f8a9533b9854ccb92b02bf33c.tar forums-89b5c490efc5e31f8a9533b9854ccb92b02bf33c.tar.gz forums-89b5c490efc5e31f8a9533b9854ccb92b02bf33c.tar.bz2 forums-89b5c490efc5e31f8a9533b9854ccb92b02bf33c.tar.xz forums-89b5c490efc5e31f8a9533b9854ccb92b02bf33c.zip |
Fixed some issues with avatars
git-svn-id: file:///svn/phpbb/trunk@5080 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_user.php | 16 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 3 |
2 files changed, 13 insertions, 6 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 2ff884f69b..a0fcfabc48 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -883,12 +883,12 @@ function avatar_remote($data, &$error) { global $config, $db, $user, $phpbb_root_path; - if (!preg_match('#^(http[s]*?)|(ftp)://#i', $data['remotelink'])) + if (!preg_match('#^(http|https|ftp)://#i', $data['remotelink'])) { $data['remotelink'] = 'http://' . $data['remotelink']; } - if (!preg_match('#^(http[s]?)|(ftp)://(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}:?([0-9]*?).*?\.(gif|jpg|jpeg|png)$#i', $data['remotelink'])) + if (!preg_match('#^(http|https|ftp)://(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}:?([0-9]*?).*?\.(gif|jpg|jpeg|png)$#i', $data['remotelink'])) { $error[] = $user->lang['AVATAR_URL_INVALID']; return false; @@ -922,12 +922,19 @@ function avatar_upload($data, &$error) { global $phpbb_root_path, $config, $db, $user; - if (!empty($_FILES['uploadfile']['tmp_name'])) + if (!empty($_FILES['uploadfile']['name'])) { $filename = $_FILES['uploadfile']['tmp_name']; $filesize = $_FILES['uploadfile']['size']; $realname = $_FILES['uploadfile']['name']; + // Filesize is too big or it's 0 if it was larger than the maxsize in the upload form + if ($filesize > $config['avatar_filesize'] || $filesize == 0) + { + $error[] = sprintf($user->lang['AVATAR_WRONG_FILESIZE'], $config['avatar_filesize']); + return false; + } + if (file_exists($filename) && preg_match('#^(.*?)\.(jpg|jpeg|gif|png)$#i', $realname, $match)) { $realname = $match[1]; @@ -978,7 +985,8 @@ function avatar_upload($data, &$error) if (empty($avatar_data)) { - $error[] = $user->lang['AVATAR_NOT_UPLOADED']; +// TODO: The above code to fetch images doesn't work with quite a few servers. This part needs some changes.. + $error[] = $user->lang['AVATAR_NOT_UPLOADED'] . '<br />Please try uploading the file manually.'; return false; } unset($url_ary); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 0c9cba0cf9..034ba66c73 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -492,8 +492,7 @@ class ucp_profile extends module if (!sizeof($error)) { $data['user_id'] = $user->data['user_id']; - - if ((!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl']) && $can_upload) + if ( (!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) { list($type, $filename, $width, $height) = avatar_upload($data, $error); } |