From 9a14d9079a46663964e0ff5228fa0db18233c59a Mon Sep 17 00:00:00 2001 From: Hani Rouatbi Date: Sun, 7 Dec 2025 13:05:51 +0100 Subject: [PATCH] Update finfo_close PHP version check to 8.1 Adjusted the conditional to only call finfo_close for PHP versions below 8.1, reflecting that finfo_close has no effect since PHP 8.1 instead of 8.0. --- admin/index.php | 2 +- includes/common.php | 2 +- includes/up_helpers/others.php | 7 ++++--- ucp.php | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/admin/index.php b/admin/index.php index 7d32c0c..c22d86f 100755 --- a/admin/index.php +++ b/admin/index.php @@ -30,7 +30,7 @@ if (! $username) is_array($plugin_run_result = Plugins::getInstance()->run('user_not_admin_admin_page', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook redirect(PATH . 'ucp.php?go=login&return=' . urlencode(ADMIN_PATH . '?cp=' . $go_to)); } -elseif(! user_can('enter_acp')) +elseif (! user_can('enter_acp')) { $usrcp->logout_cp(); redirect($config['siteurl']); diff --git a/includes/common.php b/includes/common.php index 3010446..b439f55 100755 --- a/includes/common.php +++ b/includes/common.php @@ -67,7 +67,7 @@ error_reporting(defined('DEV_STAGE') ? E_ALL : E_ALL ^ E_NOTICE); function kleeja_show_error($error_number, $error_string = '', $error_file = '', $error_line = '') { // Check if error reporting is disabled (happens with @ operator) - if (!(error_reporting() & $error_number)) + if (! (error_reporting() & $error_number)) { return false; } diff --git a/includes/up_helpers/others.php b/includes/up_helpers/others.php index 48fedfb..b8b5c89 100755 --- a/includes/up_helpers/others.php +++ b/includes/up_helpers/others.php @@ -226,9 +226,10 @@ function check_mime_type($given_file_mime, $file_ext, $file_path) { $f_info = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($f_info, $file_path); - // finfo_close() has no effect since PHP 8.0 - // Only call it for PHP < 8.0 where it actually closes the resource - if (PHP_VERSION_ID < 80000) + + // finfo_close() has no effect since PHP 8.1 + // Only call it for PHP < 8.1 where it actually closes the resource + if (PHP_VERSION_ID < 80100) { finfo_close($f_info); } diff --git a/ucp.php b/ucp.php index 0b3b33d..6a4b847 100755 --- a/ucp.php +++ b/ucp.php @@ -344,13 +344,13 @@ switch (g('go')) $your_fileuser = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $usrcp->id() . '.html' : 'ucp.php?go=fileuser&id=' . $usrcp->id()); - if($user_himself) + if ($user_himself) { $used_storage = $userinfo['storage_size']; $max_storage = $d_groups[$usrcp->group_id()]['configs']['max_storage']; $is_limited = $max_storage>0; - if($is_limited) + if ($is_limited) { $storage_per = ($used_storage*100)/$max_storage; $storage_per = round($storage_per, 2);