refactor isSeedBox judgement

This commit is contained in:
xiaomlove
2025-05-11 02:33:22 +07:00
parent 6ff9d70ebc
commit 4b39d708d2
32 changed files with 1030 additions and 233 deletions

View File

@@ -78,9 +78,8 @@ function peasant_to_user($down_floor_gb, $down_roof_gb, $minratio){
while ($arr = mysql_fetch_assoc($res))
{
$locale = get_user_locale($arr['id']);
$subject = nexus_trans("cleanup.msg_low_ratio_warning_removed", [], $locale);
$msg = nexus_trans("cleanup.msg_your_ratio_warning_removed", [], $locale);
$subject = sqlesc(nexus_trans("cleanup.msg_low_ratio_warning_removed", [], $locale));
$msg = sqlesc(nexus_trans("cleanup.msg_your_ratio_warning_removed", [], $locale));
writecomment($arr['id'],"Leech Warning removed by System.");
sql_query("UPDATE users SET class = 1, leechwarn = 'no', leechwarnuntil = null WHERE id = {$arr['id']}") or sqlerr(__FILE__, __LINE__);
sql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES(0, {$arr['id']}, $dt, $subject, $msg)") or sqlerr(__FILE__, __LINE__);

View File

@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.9.0');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2025-05-08');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2025-05-11');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

View File

@@ -2812,7 +2812,7 @@ if ($msgalert)
//seed box approval
if (get_user_class() >= \App\Models\User::CLASS_ADMINISTRATOR && get_setting('seed_box.enabled') == 'yes') {
$cacheKey = 'SEED_BOX_RECORD_APPROVAL_NONE';
$cacheKey = \App\Repositories\SeedBoxRepository::APPROVAL_COUNT_CACHE_KEY;
$toApprovalCounts = $Cache->get_value($cacheKey);
if ($toApprovalCounts === false) {
$toApprovalCounts = get_row_count('seed_box_records', 'where status = 0');

View File

@@ -915,6 +915,15 @@ function isIPSeedBoxFromASN($ip, $exceptionWhenYes = false): bool
return $result;
}
/**
* @deprecated
* @param $ip
* @param $uid
* @param $withoutCache
* @param $exceptionWhenYes
* @return bool
* @throws \App\Exceptions\SeedBoxYesException
*/
function isIPSeedBox($ip, $uid, $withoutCache = false, $exceptionWhenYes = false): bool
{
$key = "nexus_is_ip_seed_box:ip:$ip:uid:$uid";