mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
Fixed some issues with avatars
git-svn-id: file:///svn/phpbb/trunk@5080 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
8527310272
commit
89b5c490ef
2 changed files with 13 additions and 6 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue