|
@ -384,11 +384,18 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if($post['has_file']) { |
|
|
if($post['has_file']) { |
|
|
|
|
|
if(!in_array($post['extension'], $config['allowed_ext']) && !in_array($post['extension'], $config['allowed_ext_files'])) |
|
|
|
|
|
error($config['error']['unknownext']); |
|
|
|
|
|
|
|
|
|
|
|
if(in_array($post['extension'], $config['allowed_ext_files'])) |
|
|
|
|
|
$__file = true; |
|
|
|
|
|
|
|
|
// Just trim the filename if it's too long |
|
|
// Just trim the filename if it's too long |
|
|
if(strlen($post['filename']) > 30) $post['filename'] = substr($post['filename'], 0, 27).'…'; |
|
|
if(strlen($post['filename']) > 30) $post['filename'] = substr($post['filename'], 0, 27).'…'; |
|
|
// Move the uploaded file |
|
|
// Move the uploaded file |
|
|
if(!@move_uploaded_file($_FILES['file']['tmp_name'], $post['file'])) error($config['error']['nomove']); |
|
|
if(!@move_uploaded_file($_FILES['file']['tmp_name'], $post['file'])) error($config['error']['nomove']); |
|
|
|
|
|
|
|
|
|
|
|
if(!isset($__file)) { |
|
|
$size = @getimagesize($post['file']); |
|
|
$size = @getimagesize($post['file']); |
|
|
$post['width'] = $size[0]; |
|
|
$post['width'] = $size[0]; |
|
|
$post['height'] = $size[1]; |
|
|
$post['height'] = $size[1]; |
|
@ -411,9 +418,6 @@ |
|
|
error($config['error']['mime_exploit']); |
|
|
error($config['error']['mime_exploit']); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$post['filehash'] = $config['file_hash']($post['file']); |
|
|
|
|
|
$post['filesize'] = filesize($post['file']); |
|
|
|
|
|
|
|
|
|
|
|
if($config['minimum_copy_resize'] && $post['width'] <= $config['thumb_width'] && $post['height'] <= $config['thumb_height'] && $post['extension'] == ($config['thumb_ext'] ? $config['thumb_ext'] : $post['extension'])) { |
|
|
if($config['minimum_copy_resize'] && $post['width'] <= $config['thumb_width'] && $post['height'] <= $config['thumb_height'] && $post['extension'] == ($config['thumb_ext'] ? $config['thumb_ext'] : $post['extension'])) { |
|
|
// Copy, because there's nothing to resize |
|
|
// Copy, because there's nothing to resize |
|
|
copy($post['file'], $post['thumb']); |
|
|
copy($post['file'], $post['thumb']); |
|
@ -429,6 +433,16 @@ |
|
|
$post['thumbwidth'] = $thumb['width']; |
|
|
$post['thumbwidth'] = $thumb['width']; |
|
|
$post['thumbheight'] = $thumb['height']; |
|
|
$post['thumbheight'] = $thumb['height']; |
|
|
} |
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
copy($config['file_thumb'], $post['thumb']); |
|
|
|
|
|
|
|
|
|
|
|
$size = @getimagesize($post['thumb']); |
|
|
|
|
|
$post['thumbwidth'] = $size[0]; |
|
|
|
|
|
$post['thumbheight'] = $size[1]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$post['filehash'] = $config['file_hash']($post['file']); |
|
|
|
|
|
$post['filesize'] = filesize($post['file']); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if($post['has_file'] && $config['image_reject_repost'] && $p = getPostByHash($post['filehash'])) { |
|
|
if($post['has_file'] && $config['image_reject_repost'] && $p = getPostByHash($post['filehash'])) { |
|
|