mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-23 03:25:18 +02:00
$this->error removed
git-svn-id: file:///svn/phpbb/trunk@4215 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@ -169,11 +169,13 @@ function avatar_delete()
|
|||||||
{
|
{
|
||||||
global $config, $db, $user;
|
global $config, $db, $user;
|
||||||
|
|
||||||
if (@file_exists('./' . $config['avatar_path'] . '/' . $user->data['user_avatar']))
|
if (file_exists('./' . $config['avatar_path'] . '/' . $user->data['user_avatar']))
|
||||||
{
|
{
|
||||||
@unlink('./' . $config['avatar_path'] . '/' . $user->data['user_avatar']);
|
@unlink('./' . $config['avatar_path'] . '/' . $user->data['user_avatar']);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function avatar_remote(&$data)
|
function avatar_remote(&$data)
|
||||||
{
|
{
|
||||||
@ -186,8 +188,7 @@ function avatar_remote(&$data)
|
|||||||
|
|
||||||
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[s]?)|(ftp)://(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}:?([0-9]*?).*?\.(gif|jpg|jpeg|png)$#i', $data['remotelink']))
|
||||||
{
|
{
|
||||||
$this->error[] = $user->lang['AVATAR_URL_INVALID'];
|
return $user->lang['AVATAR_URL_INVALID'];
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!($data['width'] || $data['height']) || $data['remotelink'] != $user->data['user_avatar']) && ($config['avatar_max_width'] || $config['avatar_max_height']))
|
if ((!($data['width'] || $data['height']) || $data['remotelink'] != $user->data['user_avatar']) && ($config['avatar_max_width'] || $config['avatar_max_height']))
|
||||||
@ -196,13 +197,11 @@ function avatar_remote(&$data)
|
|||||||
|
|
||||||
if (!$width || !$height)
|
if (!$width || !$height)
|
||||||
{
|
{
|
||||||
$this->error[] = $user->lang['AVATAR_NO_SIZE'];
|
return $user->lang['AVATAR_NO_SIZE'];
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else if ($width > $config['avatar_max_width'] || $height > $config['avatar_max_height'])
|
else if ($width > $config['avatar_max_width'] || $height > $config['avatar_max_height'])
|
||||||
{
|
{
|
||||||
$this->error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_max_width'], $config['avatar_max_height']);
|
return sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_max_width'], $config['avatar_max_height']);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['width'] = &$width;
|
$data['width'] = &$width;
|
||||||
@ -210,8 +209,7 @@ function avatar_remote(&$data)
|
|||||||
}
|
}
|
||||||
else if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height'])
|
else if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height'])
|
||||||
{
|
{
|
||||||
$this->error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_max_width'], $config['avatar_max_height']);
|
return sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_max_width'], $config['avatar_max_height']);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set type
|
// Set type
|
||||||
@ -239,16 +237,14 @@ function avatar_upload(&$data)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error[] = $user->lang['AVATAR_NOT_UPLOADED'];
|
return $user->lang['AVATAR_NOT_UPLOADED'];
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (preg_match('#^(http://).*?\.(jpg|jpeg|gif|png)$#i', $data['uploadurl'], $match))
|
else if (preg_match('#^(http://).*?\.(jpg|jpeg|gif|png)$#i', $data['uploadurl'], $match))
|
||||||
{
|
{
|
||||||
if (empty($match[2]))
|
if (empty($match[2]))
|
||||||
{
|
{
|
||||||
$this->error[] = $user->lang['AVATAR_URL_INVALID'];
|
return $user->lang['AVATAR_URL_INVALID'];
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = parse_url($data['uploadurl']);
|
$url = parse_url($data['uploadurl']);
|
||||||
@ -263,8 +259,7 @@ function avatar_upload(&$data)
|
|||||||
|
|
||||||
if (!($fsock = @fsockopen($host, $port, $errno, $errstr)))
|
if (!($fsock = @fsockopen($host, $port, $errno, $errstr)))
|
||||||
{
|
{
|
||||||
$this->error[] = $user->lang['AVATAR_NOT_UPLOADED'];
|
return $user->lang['AVATAR_NOT_UPLOADED'];
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs($fsock, 'GET /' . $filename . " HTTP/1.1\r\n");
|
fputs($fsock, 'GET /' . $filename . " HTTP/1.1\r\n");
|
||||||
@ -277,12 +272,11 @@ function avatar_upload(&$data)
|
|||||||
$avatar_data .= fread($fsock, $config['avatar_filesize']);
|
$avatar_data .= fread($fsock, $config['avatar_filesize']);
|
||||||
}
|
}
|
||||||
@fclose($fsock);
|
@fclose($fsock);
|
||||||
$avatar_data = array_pop(explode("\r\n", $avatar_data));
|
$avatar_data = array_pop(explode("\r\n\r\n", $avatar_data));
|
||||||
|
|
||||||
if (empty($avatar_data))
|
if (empty($avatar_data))
|
||||||
{
|
{
|
||||||
$this->error[] = $user->lang['AVATAR_NOT_UPLOADED'];
|
return $user->lang['AVATAR_NOT_UPLOADED'];
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
unset($url_ary);
|
unset($url_ary);
|
||||||
|
|
||||||
@ -291,8 +285,7 @@ function avatar_upload(&$data)
|
|||||||
|
|
||||||
if (!($fp = @fopen($filename, 'wb')))
|
if (!($fp = @fopen($filename, 'wb')))
|
||||||
{
|
{
|
||||||
$this->error[] = $user->lang['AVATAR_NOT_UPLOADED'];
|
return $user->lang['AVATAR_NOT_UPLOADED'];;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
$filesize = fwrite($fp, $avatar_data);
|
$filesize = fwrite($fp, $avatar_data);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
@ -301,8 +294,7 @@ function avatar_upload(&$data)
|
|||||||
if (!$filesize)
|
if (!$filesize)
|
||||||
{
|
{
|
||||||
unlink($filename);
|
unlink($filename);
|
||||||
$this->error[] = $user->lang['AVATAR_NOT_UPLOADED'];
|
return $user->lang['AVATAR_NOT_UPLOADED'];
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$php_move = 'copy';
|
$php_move = 'copy';
|
||||||
@ -312,8 +304,7 @@ function avatar_upload(&$data)
|
|||||||
|
|
||||||
if ($width > $config['avatar_max_width'] || $height > $config['avatar_max_height'] || $width < $config['avatar_min_width'] || $height < $config['avatar_min_height'] || !$width || !$height)
|
if ($width > $config['avatar_max_width'] || $height > $config['avatar_max_height'] || $width < $config['avatar_min_width'] || $height < $config['avatar_min_height'] || !$width || !$height)
|
||||||
{
|
{
|
||||||
$this->error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height']);
|
return sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height']);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace any chars which may cause us problems with _
|
// Replace any chars which may cause us problems with _
|
||||||
@ -323,26 +314,24 @@ function avatar_upload(&$data)
|
|||||||
$data['width'] = &$width;
|
$data['width'] = &$width;
|
||||||
$data['height'] = &$height;
|
$data['height'] = &$height;
|
||||||
|
|
||||||
if(!$php_move($filename, './' . $config['avatar_path'] . '/' . $data['filename']))
|
if(!$php_move($filename, $phpbb_root_path . $config['avatar_path'] . '/' . $data['filename']))
|
||||||
{
|
{
|
||||||
@unlink($filename);
|
@unlink($filename);
|
||||||
$this->error[] = $user->lang['AVATAR_NOT_UPLOADED'];
|
return $user->lang['AVATAR_NOT_UPLOADED'];
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
@unlink($filename);
|
@unlink($filename);
|
||||||
|
|
||||||
$filesize = filesize('./' . $config['avatar_path'] . '/' . $data['filename']);
|
$filesize = @filesize($phpbb_root_path . $config['avatar_path'] . '/' . $data['filename']);
|
||||||
if (!$filesize || $filesize > $config['avatar_filesize'])
|
if (!$filesize || $filesize > $config['avatar_filesize'])
|
||||||
{
|
{
|
||||||
@unlink('./' . $config['avatar_path'] . '/' . $data['filename']);
|
@unlink($phpbb_root_path . $config['avatar_path'] . '/' . $data['filename']);
|
||||||
$this->error[] = sprintf($user->lang['AVATAR_WRONG_FILESIZE'], $config['avatar_filesize']);
|
return sprintf($user->lang['AVATAR_WRONG_FILESIZE'], $config['avatar_filesize']);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set type
|
// Set type
|
||||||
$data['type'] = AVATAR_UPLOAD;
|
$data['type'] = AVATAR_UPLOAD;
|
||||||
|
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user