Replaced some file exists to is file (#1276)

* Replaced some file_exists to is_file

* Update functions_thumbs.php

* Updated

* Update CronHelper.php

* Updated

* Update IPHelper.php

* Updated

* Update update_forums_atom.php

* Update functions.php

* Update Validate.php
This commit is contained in:
Roman Kelesidis 2023-12-27 20:08:00 +07:00 committed by GitHub
commit 3626143879
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 107 additions and 89 deletions

View file

@ -24,13 +24,14 @@ function createThumbnail(string $source, string $newFile, string $mimeType): boo
{
global $attach_config;
// Get the file information
$source = realpath($source);
$min_filesize = (int)$attach_config['img_min_thumb_filesize'];
$img_filesize = file_exists($source) ? filesize($source) : false;
// Check for source image existence
if (!$source = realpath($source)) {
return false;
}
// Checks the max allowed filesize
if (!$img_filesize || $img_filesize <= $min_filesize) {
$min_filesize = (int)$attach_config['img_min_thumb_filesize'];
if (!filesize($source) || filesize($source) <= $min_filesize) {
return false;
}
@ -48,7 +49,7 @@ function createThumbnail(string $source, string $newFile, string $mimeType): boo
}
// Check the thumbnail existence after creating
if (!file_exists($newFile)) {
if (!is_file($newFile)) {
return false;
}