Added check for avatar type before attempting deletion

git-svn-id: file:///svn/phpbb/trunk@1279 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-11-05 01:24:26 +00:00
parent 1372a6c220
commit be63e70bce

View file

@ -699,11 +699,14 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
} }
if( isset($HTTP_POST_VARS['avatardel']) && $mode == "editprofile" ) if( isset($HTTP_POST_VARS['avatardel']) && $mode == "editprofile" )
{
if( $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $userdata['user_avatar'] != "" )
{ {
if( @file_exists("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']) ) if( @file_exists("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']) )
{ {
@unlink("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']); @unlink("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']);
} }
}
$avatar_sql = ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE; $avatar_sql = ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
} }
else if( $user_avatar_loc != "" && $board_config['allow_avatar_upload'] ) else if( $user_avatar_loc != "" && $board_config['allow_avatar_upload'] )
@ -742,14 +745,13 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{ {
list($width, $height) = @getimagesize($user_avatar_loc); list($width, $height) = @getimagesize($user_avatar_loc);
if( $width <= $board_config['avatar_max_width'] && if( $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
$height <= $board_config['avatar_max_height'] )
{ {
$user_id = ($mode == "register") ? $new_user_id : $userdata['user_id']; $user_id = ($mode == "register") ? $new_user_id : $userdata['user_id'];
$avatar_filename = $user_id . $imgtype; $avatar_filename = $user_id . $imgtype;
if($mode == "editprofile") if( $mode == "editprofile" && $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $userdata['user_avatar'] != "" )
{ {
if( @file_exists("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']) ) if( @file_exists("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']) )
{ {
@ -854,7 +856,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$avatar_filename = $user_id . $imgtype; $avatar_filename = $user_id . $imgtype;
if($mode == "editprofile") if( $mode == "editprofile" && $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $userdata['user_avatar'] != "")
{ {
if( file_exists("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']) ) if( file_exists("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']) )
{ {