Merge branch '1.7' into php8

This commit is contained in:
xiaomlove
2022-12-04 00:23:48 +08:00
8 changed files with 20 additions and 16 deletions

View File

@@ -4959,12 +4959,24 @@ function get_user_class_image($class){
} }
function user_can_upload($where = "torrents"){ function user_can_upload($where = "torrents"){
global $CURUSER,$upload_class,$enablespecial,$uploadspecial_class; global $CURUSER,$upload_class,$enablespecial,$uploadspecial_class, $lang_functions;
if ($CURUSER["uploadpos"] != 'yes') {
if ($CURUSER["uploadpos"] != 'yes') return false;
return false; }
$uploadDenyApprovalDenyCount = get_setting('main.upload_deny_approval_deny_count');
$approvalDenyCount = \App\Models\Torrent::query()->where('owner', $CURUSER['id'])
->where('approval_status', \App\Models\Torrent::APPROVAL_STATUS_DENY)
->count()
;
if ($uploadDenyApprovalDenyCount > 0 && $approvalDenyCount >= $uploadDenyApprovalDenyCount) {
stderr($lang_functions['std_sorry'], sprintf($lang_functions['approval_deny_reach_upper_limit'], $uploadDenyApprovalDenyCount),false);
}
if ($where == "torrents") if ($where == "torrents")
{ {
$offerSkipApprovedCount = get_setting('main.offer_skip_approved_count');
if ($CURUSER['offer_allowed_count'] >= $offerSkipApprovedCount) {
return true;
}
if (user_can('upload')) if (user_can('upload'))
return true; return true;
if (get_if_restricted_is_open()) if (get_if_restricted_is_open())

View File

@@ -330,6 +330,7 @@ $lang_functions = array
'input_uncheck_all' => "全不选", 'input_uncheck_all' => "全不选",
'select_at_least_one_record' => '至少选择一条记录!', 'select_at_least_one_record' => '至少选择一条记录!',
'text_seed_box_record_to_approval' => '有 %s%u 条待审核的 SeedBox 记录%s', 'text_seed_box_record_to_approval' => '有 %s%u 条待审核的 SeedBox 记录%s',
'approval_deny_reach_upper_limit' => '当前审核被拒绝的种子数:%s 达到上限,不允许发布。',
); );
?> ?>

View File

@@ -41,7 +41,6 @@ $lang_upload = array
'text_english_title' => "英文名:", 'text_english_title' => "英文名:",
'text_titles_note' => "(如果英文名不存在,使用拼音或不填写)", 'text_titles_note' => "(如果英文名不存在,使用拼音或不填写)",
'fill_quality' => '填写质量', 'fill_quality' => '填写质量',
'approval_deny_reach_upper_limit' => '当前审核被拒绝的种子数:%s 达到上限,不允许发布。',
); );
?> ?>

View File

@@ -337,6 +337,7 @@ $lang_functions = array
'input_uncheck_all' => "全不選", 'input_uncheck_all' => "全不選",
'select_at_least_one_record' => '至少選擇一條記錄!', 'select_at_least_one_record' => '至少選擇一條記錄!',
'text_seed_box_record_to_approval' => '有 %s%u 條待審核的 SeedBox 記錄%s', 'text_seed_box_record_to_approval' => '有 %s%u 條待審核的 SeedBox 記錄%s',
'approval_deny_reach_upper_limit' => '當前審核被拒絕的種子數:%s 達到上限,不允許發布。',
); );
?> ?>

View File

@@ -41,7 +41,6 @@ $lang_upload = array
'text_english_title' => "英文名:", 'text_english_title' => "英文名:",
'text_titles_note' => "(如果英文名不存在,請使用拼音或不填寫)", 'text_titles_note' => "(如果英文名不存在,請使用拼音或不填寫)",
'fill_quality' => '填寫質量', 'fill_quality' => '填寫質量',
'approval_deny_reach_upper_limit' => '當前審核被拒絕的種子數:%s 達到上限,不允許發布。',
); );
?> ?>

View File

@@ -338,6 +338,7 @@ $lang_functions = array
'input_uncheck_all' => "Uncheck All", 'input_uncheck_all' => "Uncheck All",
'select_at_least_one_record' => 'Select at least one record!', 'select_at_least_one_record' => 'Select at least one record!',
'text_seed_box_record_to_approval' => 'There %s%u not approval seed box record%s.', 'text_seed_box_record_to_approval' => 'There %s%u not approval seed box record%s.',
'approval_deny_reach_upper_limit' => 'The number of torrents whose current approval was denied: %s reached the upper limit and is not allowed to be upload.',
); );
?> ?>

View File

@@ -41,7 +41,6 @@ $lang_upload = array
'text_english_title' => "English Name:", 'text_english_title' => "English Name:",
'text_titles_note' => "(If no English Name exists, use pinyin or leave it blank)", 'text_titles_note' => "(If no English Name exists, use pinyin or leave it blank)",
'fill_quality' => 'Fill quality', 'fill_quality' => 'Fill quality',
'approval_deny_reach_upper_limit' => 'The number of torrents whose current approval was denied: %s reached the upper limit and is not allowed to be upload.',
); );
?> ?>

View File

@@ -5,7 +5,6 @@ require_once(get_langfile_path());
require_once(get_langfile_path('edit.php')); require_once(get_langfile_path('edit.php'));
loggedinorreturn(); loggedinorreturn();
parked(); parked();
$userInfo = \App\Models\User::query()->findOrFail($CURUSER['id']);
if ($CURUSER["uploadpos"] == 'no') if ($CURUSER["uploadpos"] == 'no')
stderr($lang_upload['std_sorry'], $lang_upload['std_unauthorized_to_upload'],false); stderr($lang_upload['std_sorry'], $lang_upload['std_unauthorized_to_upload'],false);
@@ -13,16 +12,9 @@ if ($enableoffer == 'yes')
$has_allowed_offer = get_row_count("offers","WHERE allowed='allowed' AND userid = ". sqlesc($CURUSER["id"])); $has_allowed_offer = get_row_count("offers","WHERE allowed='allowed' AND userid = ". sqlesc($CURUSER["id"]));
else $has_allowed_offer = 0; else $has_allowed_offer = 0;
$uploadfreely = user_can_upload("torrents"); $uploadfreely = user_can_upload("torrents");
$offerSkipApprovedCount = get_setting('main.offer_skip_approved_count'); $allowtorrents = ($has_allowed_offer || $uploadfreely);
$uploadDenyApprovalDenyCount = get_setting('main.upload_deny_approval_deny_count');
$approvalDenyCount = \App\Models\Torrent::query()->where('owner', $CURUSER['id'])->where('approval_status', \App\Models\Torrent::APPROVAL_STATUS_DENY)->count();
do_log("uploadfreely: $uploadfreely, has_allowed_offer: $has_allowed_offer, offerSkipApprovedCount: $offerSkipApprovedCount, uploadDenyApprovalDenyCount: $uploadDenyApprovalDenyCount, approvalDenyCount: $approvalDenyCount");
$allowtorrents = ($has_allowed_offer || $uploadfreely || ($userInfo->offer_allowed_count >= $offerSkipApprovedCount));
$allowspecial = user_can_upload("music"); $allowspecial = user_can_upload("music");
if ($uploadDenyApprovalDenyCount > 0 && $approvalDenyCount >= $uploadDenyApprovalDenyCount) {
stderr($lang_upload['std_sorry'],sprintf($lang_upload['approval_deny_reach_upper_limit'], $uploadDenyApprovalDenyCount),false);
}
if (!$allowtorrents && !$allowspecial) if (!$allowtorrents && !$allowspecial)
stderr($lang_upload['std_sorry'],$lang_upload['std_please_offer'],false); stderr($lang_upload['std_sorry'],$lang_upload['std_please_offer'],false);
$allowtwosec = ($allowtorrents && $allowspecial); $allowtwosec = ($allowtorrents && $allowspecial);