From cf8b71e0c70ce600b2d9e5c5d44e37f60354854c Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 3 Aug 2024 06:55:51 +0000 Subject: [PATCH] Auto Commit - phpcbf --- zb_system/function/c_system_common.php | 76 ++++++++++++-------------- zb_system/function/lib/thumb.php | 10 ++-- 2 files changed, 41 insertions(+), 45 deletions(-) diff --git a/zb_system/function/c_system_common.php b/zb_system/function/c_system_common.php index dafd6f229..b8c943240 100644 --- a/zb_system/function/c_system_common.php +++ b/zb_system/function/c_system_common.php @@ -1898,7 +1898,6 @@ function Null2Empty($s) return (!is_null($s)) ? $s : ''; } - /** * 将序列化后的string还原为array(自动判断empty,null) * @@ -2443,10 +2442,10 @@ function Logs($logString, $level = 'INFO', $source = 'system') unset($addinfo['header']['User-Agent']); unset($addinfo['header']['Cookie']); } - ob_start(); - debug_print_backtrace(); - $trace = ob_get_contents(); - ob_end_clean(); + ob_start(); + debug_print_backtrace(); + $trace = ob_get_contents(); + ob_end_clean(); $addinfo['debug_backtrace'] = $trace; foreach ($GLOBALS['hooks']['Filter_Plugin_Logs'] as $fpname => &$fpsignal) { @@ -2478,7 +2477,7 @@ function Logs($logString, $level = 'INFO', $source = 'system') $s .= var_export($addinfo, true) . "\r\n"; } - @file_put_contents($f, $s, FILE_APPEND | LOCK_EX); + @file_put_contents($f, $s, (FILE_APPEND | LOCK_EX)); return true; } @@ -2604,7 +2603,6 @@ function Zbp_GetEnv($item, $default = null) } else { return getenv($item); } - } /** @@ -2786,63 +2784,61 @@ function zbp_throttle($name = 'default', $max_reqs = 60, $period = 60) * * @return boolean true通过,false拒绝,null为IP格式不合法 */ -function is_intranet_ip($check_ip) { +function is_intranet_ip($check_ip) +{ if (filter_var($check_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false) { - if (filter_var($check_ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE) === false) { + if (filter_var($check_ip, FILTER_VALIDATE_IP, (FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE)) === false) { return true; } else { $ip = explode('.', $check_ip); - if ( - ($ip[0] == 0) || - ($ip[0] >= 240) || - ($ip[0] == 127) || - ($ip[0] == 169 && $ip[1] == 254) + if (($ip[0] == 0) + || ($ip[0] >= 240) + || ($ip[0] == 127) + || ($ip[0] == 169 && $ip[1] == 254) ) { return true; } - if ( - ($ip[0] == 0) || - ($ip[0] >= 240) || - ($ip[0] == 127) || - ($ip[0] == 169 && $ip[1] == 254) + if (($ip[0] == 0) + || ($ip[0] >= 240) + || ($ip[0] == 127) + || ($ip[0] == 169 && $ip[1] == 254) ) { return true; } - if ( - ($ip[0] == 100 && $ip[1] >= 64 && $ip[1] <= 127 ) || - ($ip[0] == 192 && $ip[1] == 0 && $ip[2] == 0 ) || - ($ip[0] == 192 && $ip[1] == 0 && $ip[2] == 2 ) || - ($ip[0] == 198 && $ip[1] >= 18 && $ip[1] <= 19 ) || - ($ip[0] == 198 && $ip[1] == 51 && $ip[2] == 100 ) || - ($ip[0] == 203 && $ip[1] == 0 && $ip[2] == 113 ) + if (($ip[0] == 100 && $ip[1] >= 64 && $ip[1] <= 127 ) + || ($ip[0] == 192 && $ip[1] == 0 && $ip[2] == 0 ) + || ($ip[0] == 192 && $ip[1] == 0 && $ip[2] == 2 ) + || ($ip[0] == 198 && $ip[1] >= 18 && $ip[1] <= 19 ) + || ($ip[0] == 198 && $ip[1] == 51 && $ip[2] == 100 ) + || ($ip[0] == 203 && $ip[1] == 0 && $ip[2] == 113 ) ) { return true; } return false; } - } elseif(filter_var($check_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false) { + } elseif (filter_var($check_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false) { if (filter_var($check_ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE) === false) { return true; - }else{ + } else { $ip = explode(':', $check_ip); if (($ip[0] == 0 && $ip[1] == 0 && $ip[2] == 0 && $ip[3] == 0 - && $ip[4] == 0 && $ip[5] == 0 && $ip[6] == 0 && ($ip[7] == 0 || $ip[7] == 1)) - || ($ip[0] == 0x5f) - || ($ip[0] >= 0xfe80 && $ip[0] <= 0xfebf) - || ($ip[0] == 0x2001 && ($ip[1] == 0x0db8 || ($ip[1] >= 0x0010 && $ip[1] <= 0x001f))) - || ($ip[0] == 0x3ff3) - ) { + && $ip[4] == 0 && $ip[5] == 0 && $ip[6] == 0 && ($ip[7] == 0 || $ip[7] == 1)) + || ($ip[0] == 0x5f) + || ($ip[0] >= 0xfe80 && $ip[0] <= 0xfebf) + || ($ip[0] == 0x2001 && ($ip[1] == 0x0db8 || ($ip[1] >= 0x0010 && $ip[1] <= 0x001f))) + || ($ip[0] == 0x3ff3) + ) { return true; } if ($ip[0] >= 0xfc00 && $ip[0] <= 0xfdff) { return true; } - if (($ip[0] == 0 && $ip[1] == 0 && $ip[2] == 0 && $ip[3] == 0 && $ip[4] == 0 && $ip[5] == 0xffff) || - ($ip[0] == 0x0100 && $ip[1] == 0 && $ip[2] == 0 && $ip[3] == 0) || - ($ip[0] == 0x2001 && $ip[1] <= 0x01ff) || - ($ip[0] == 0x2001 && $ip[1] == 0x0002 && $ip[2] == 0) || - ($ip[0] >= 0xfc00 && $ip[0] <= 0xfdff) - ) { + if (($ip[0] == 0 && $ip[1] == 0 && $ip[2] == 0 && $ip[3] == 0 && $ip[4] == 0 && $ip[5] == 0xffff) + || ($ip[0] == 0x0100 && $ip[1] == 0 && $ip[2] == 0 && $ip[3] == 0) + || ($ip[0] == 0x2001 && $ip[1] <= 0x01ff) + || ($ip[0] == 0x2001 && $ip[1] == 0x0002 && $ip[2] == 0) + || ($ip[0] >= 0xfc00 && $ip[0] <= 0xfdff) + ) { return true; } return false; diff --git a/zb_system/function/lib/thumb.php b/zb_system/function/lib/thumb.php index f7463904f..2c245ff4d 100644 --- a/zb_system/function/lib/thumb.php +++ b/zb_system/function/lib/thumb.php @@ -418,11 +418,11 @@ protected function clip($clipx, $clipy, $clip_width, $clip_height) $ml = str_ireplace('m', '000000', $ml); $ml = str_ireplace('g', '000000000', $ml); $ml = (int) $ml; - if ($this->srcWidth * $this->srcHeight > 8000000) { + if (($this->srcWidth * $this->srcHeight) > 8000000) { if ($ml > 90000000) { imagefill($this->tmpRes, 0, 0, 0xffffff); } - } elseif ($this->srcWidth * $this->srcHeight > 2000000) { + } elseif (($this->srcWidth * $this->srcHeight) > 2000000) { if ($ml > 30000000) { imagefill($this->tmpRes, 0, 0, 0xffffff); } @@ -430,7 +430,7 @@ protected function clip($clipx, $clipy, $clip_width, $clip_height) imagefill($this->tmpRes, 0, 0, 0xffffff); } - imagecopyresampled($this->tmpRes, $this->srcRes, 0, 0, $clipx, $clipy, $this->srcWidth, $this->srcHeight, $this-> , $this->srcHeight); + imagecopyresampled($this->tmpRes, $this->srcRes, 0, 0, $clipx, $clipy, $this->srcWidth, $this->srcHeight, $this->, $this->srcHeight); } /** @@ -475,11 +475,11 @@ public function zoom($forced_width, $forced_height = 0) $ml = str_ireplace('m', '000000', $ml); $ml = str_ireplace('g', '000000000', $ml); $ml = (int) $ml; - if ($this->srcWidth * $this->srcHeight > 8000000) { + if (($this->srcWidth * $this->srcHeight) > 8000000) { if ($ml > 90000000) { imagefill($this->tmpRes, 0, 0, 0xffffff); } - } elseif ($this->srcWidth * $this->srcHeight > 2000000) { + } elseif (($this->srcWidth * $this->srcHeight) > 2000000) { if ($ml > 30000000) { imagefill($this->tmpRes, 0, 0, 0xffffff); }