mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
improve mybonus page + upload deny when approval deny too much
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.28');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-09-25');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-09-26');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -5887,7 +5887,7 @@ function calculate_harem_addition($uid)
|
||||
$haremsCount = $harems->count();
|
||||
foreach ($harems as $harem) {
|
||||
$result = calculate_seed_bonus($harem->id);
|
||||
$addition += $result['seed_bonus'];
|
||||
$addition += $result['seed_points'];
|
||||
}
|
||||
do_log("[HAREM_ADDITION], user: $uid, haremsCount: $haremsCount ,addition: $addition");
|
||||
return $addition;
|
||||
|
||||
@@ -145,10 +145,14 @@ $lang_mybonus = array
|
||||
'reward_type_harem_addition' => '后宫加成',
|
||||
'bonus_base' => '基础魔力',
|
||||
'lock_text' => '系统限制 %s 秒内只能点击交换按钮一次!',
|
||||
'text_get_by_seeding_official' => '官种每小时将额外得到如下的魔力值',
|
||||
'text_get_by_seeding_official' => '官种加成每小时将额外得到如下的魔力值',
|
||||
'official_calculate_method' => '官种奖励计算公式同上,只是仅针对官种进行计算',
|
||||
'official_tag_bonus_additional_factor' => '最终奖励为计算所得官种奖励乘以官种系数,当前官种系数为: ',
|
||||
'reward_type_official_addition' => '官种加成',
|
||||
'text_get_by_harem' => '后宫加成每小时将额外得到如下的魔力值',
|
||||
'harem_additional_desc' => '后宫只考虑直属后宫。每个后宫加成值可<a href="invite.php?id=%s" target="_blank" class="altlink">在此</a>查看',
|
||||
'harem_additional_factor' => '所得奖励为全部后宫的时魔(不考虑加成)之和,乘以后宫加成系数,当前值为:',
|
||||
'text_bonus_summary' => '每小时获得的合计魔力值',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -788,6 +788,8 @@ $lang_settings = array
|
||||
'text_official_tag_note' => '。带此标签的种子为官种',
|
||||
'row_zero_bonus_tag' => '零魔标签',
|
||||
'text_zero_bonus_tag_note' => '。带此标签的种子为零魔种子',
|
||||
'row_upload_deny_approval_deny_count' => '拒绝发布审核不通过数',
|
||||
'text_upload_deny_approval_deny_count_note' => "当审核不通过的种子数大于等于此数值时,不允许发布。设置为 '0' 不使用此规则",
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -41,6 +41,7 @@ $lang_upload = array
|
||||
'text_english_title' => "英文名:",
|
||||
'text_titles_note' => "(如果英文名不存在,使用拼音或不填写)",
|
||||
'fill_quality' => '填写质量',
|
||||
'approval_deny_reach_upper_limit' => '当前审核被拒绝的种子数:%s 达到上限,不允许发布。',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -145,11 +145,14 @@ $lang_mybonus = array
|
||||
'reward_type_harem_addition' => '後宮加成',
|
||||
'bonus_base' => '基礎魔力',
|
||||
'lock_text' => '系統限製 %s 秒內只能點擊交換按鈕一次!',
|
||||
'text_get_by_seeding_official' => '官種每小時將額外得到如下的魔力值',
|
||||
'text_get_by_seeding_official' => '官種加成每小時將額外得到如下的魔力值',
|
||||
'official_calculate_method' => '官種獎勵計算公式同上,只是僅針對官種進行計算',
|
||||
'official_tag_bonus_additional_factor' => '最終獎勵為計算所得官種獎勵乘以官種系數,當前官種系數為: ',
|
||||
'reward_type_official_addition' => '官種加成',
|
||||
|
||||
'text_get_by_harem' => '後宮加成每小時將額外得到如下的魔力值',
|
||||
'harem_additional_desc' => '後宮只考慮直屬後宮。每個後宮加成值可<a href="invite.php?id=%s" target="_blank" class="altlink">在此</a>查看',
|
||||
'harem_additional_factor' => '所得獎勵為全部後宮的時魔(不考慮加成)之和,乘以後宮加成系數,當前值為:',
|
||||
'text_bonus_summary' => '每小時獲得的合計魔力值',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -788,6 +788,8 @@ $lang_settings = array
|
||||
'text_official_tag_note' => '。帶此標簽的種子為官種',
|
||||
'row_zero_bonus_tag' => '零魔標簽',
|
||||
'text_zero_bonus_tag_note' => '。帶此標簽的種子為零魔種子',
|
||||
'row_upload_deny_approval_deny_count' => '拒絕發布審核不通過數',
|
||||
'text_upload_deny_approval_deny_count_note' => "當審核不通過的種子數大於等於此數值時,不允許發布。設置為 '0' 不使用此規則",
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -41,6 +41,7 @@ $lang_upload = array
|
||||
'text_english_title' => "英文名:",
|
||||
'text_titles_note' => "(如果英文名不存在,請使用拼音或不填寫)",
|
||||
'fill_quality' => '填寫質量',
|
||||
'approval_deny_reach_upper_limit' => '當前審核被拒絕的種子數:%s 達到上限,不允許發布。',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -97,7 +97,7 @@ where<ul><li><b>A</b> is an intermediate variable</li><li><b>Ti</b> is the <b>i<
|
||||
'text_bonus_formula_three' => "</li><li><b>B</b> is the number of karma points gained by seeding in an hour</li><li><b>B0</b> is a parameter, which stands for the maximum bonus points per hour a user can get by seeding. <b>B0</b> = ",
|
||||
'text_bonus_formula_four' => "</li><li><b>L</b> is a parameter. <b>L</b> = ",
|
||||
'text_bonus_formula_five' => "</li></ul>In a nutshell, you can get more bonus by seeding less-seeded and larger torrents.",
|
||||
'text_bonus_formula_wi' => "</li><li><b>Wi</b> is the <b>i</b>th torrent's weight, default is 1, zero torrent is ",
|
||||
'text_bonus_formula_wi' => "</li><li><b>Wi</b> is the <b>i</b>th torrent's weight, default is 1, zero bonus torrent is ",
|
||||
'text_user_with_ratio_above' => "User with ratio above ",
|
||||
'text_and_uploaded_amount_above' => " and uploaded amount above ",
|
||||
'text_cannot_exchange_uploading' => " GB cannot exchange for more uploading credit.",
|
||||
@@ -149,6 +149,10 @@ where<ul><li><b>A</b> is an intermediate variable</li><li><b>Ti</b> is the <b>i<
|
||||
'official_calculate_method' => 'The formula for calculating the official reward is the same as above, but only for the official type',
|
||||
'official_tag_bonus_additional_factor' => 'The final reward is the calculated official type reward multiplied by the official type factor, the current official type factor is: ',
|
||||
'reward_type_official_addition' => 'Official addition',
|
||||
'text_get_by_harem' => 'The harem addition will give the following additional bonus value per hour',
|
||||
'harem_additional_desc' => "Only direct harems will be considered for the harem. Each harem's bonus addition value can be viewed <a href=\"invite.php?id=%s\" class='altlink' target='_blank'>here</a>",
|
||||
'harem_additional_factor' => 'The reward obtained is the sum of the hourly bonus of all the harems (regardless of the addition), multiplied by the harem bonus factor, with the current value of ',
|
||||
'text_bonus_summary' => 'Total bonus gained per hour',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -788,6 +788,8 @@ $lang_settings = array
|
||||
'text_official_tag_note' => '. Torrents with this tag are official torrents',
|
||||
'row_zero_bonus_tag' => 'Zero bonus tag',
|
||||
'text_zero_bonus_tag_note' => '. Torrents with this tag are zero bonus torrents',
|
||||
'row_upload_deny_approval_deny_count' => 'Refuse to upload approval deny count',
|
||||
'text_upload_deny_approval_deny_count_note' => "When the number of torrents approval deny is greater than or equal to this value, publishing is not allowed. Set to '0' to not use this rule",
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -41,6 +41,7 @@ $lang_upload = array
|
||||
'text_english_title' => "English Name:",
|
||||
'text_titles_note' => "(If no English Name exists, use pinyin or leave it blank)",
|
||||
'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.',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -92,6 +92,7 @@ return array (
|
||||
'show_top_uploader' => 'no',
|
||||
'imdb_language' => 'en-US',
|
||||
'offer_skip_approved_count' => 5,
|
||||
'upload_deny_approval_deny_count' => 2,
|
||||
),
|
||||
'smtp' =>
|
||||
array (
|
||||
|
||||
@@ -426,51 +426,10 @@ if ($donortimes_bonus)
|
||||
|
||||
print("</ul>");
|
||||
|
||||
// $sqrtof2 = sqrt(2);
|
||||
// $logofpointone = log(0.1);
|
||||
// $valueone = $logofpointone / $tzero_bonus;
|
||||
// $pi = 3.141592653589793;
|
||||
// $valuetwo = $bzero_bonus * ( 2 / $pi);
|
||||
// $valuethree = $logofpointone / ($nzero_bonus - 1);
|
||||
// $timenow = strtotime(date("Y-m-d H:i:s"));
|
||||
// $sectoweek = 7*24*60*60;
|
||||
// $A = 0;
|
||||
// $count = 0;
|
||||
// $torrentres = sql_query("select torrents.id, torrents.added, torrents.size, torrents.seeders from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $CURUSER[id] AND peers.seeder ='yes' GROUP BY torrents.id") or sqlerr(__FILE__, __LINE__);
|
||||
// while ($torrent = mysql_fetch_array($torrentres))
|
||||
// {
|
||||
// $weeks_alive = ($timenow - strtotime($torrent['added'])) / $sectoweek;
|
||||
// $gb_size = $torrent['size'] / 1073741824;
|
||||
// $temp = (1 - exp($valueone * $weeks_alive)) * $gb_size * (1 + $sqrtof2 * exp($valuethree * ($torrent['seeders'] - 1)));
|
||||
// $A += $temp;
|
||||
// $count++;
|
||||
// }
|
||||
// if ($count > $maxseeding_bonus)
|
||||
// $count = $maxseeding_bonus;
|
||||
// $all_bonus = $valuetwo * atan($A / $l_bonus) + ($perseeding_bonus * $count);
|
||||
|
||||
$seedBonusResult = calculate_seed_bonus($CURUSER['id']);
|
||||
$A = $seedBonusResult['A'];
|
||||
|
||||
$percent = $seedBonusResult['seed_bonus'] * 100 / ($bzero_bonus + $perseeding_bonus * $maxseeding_bonus);
|
||||
print("<div align=\"center\">".$lang_mybonus['text_you_are_currently_getting'].round($seedBonusResult['seed_bonus'],3).$lang_mybonus['text_point'].add_s($seedBonusResult['seed_bonus']).$lang_mybonus['text_per_hour']." (A = ".round($A,1).")</div><table align=\"center\" border=\"0\" width=\"400\"><tr><td class=\"loadbarbg\" style='border: none; padding: 0px;'>");
|
||||
|
||||
if ($percent <= 30) $loadpic = "loadbarred";
|
||||
elseif ($percent <= 60) $loadpic = "loadbaryellow";
|
||||
else $loadpic = "loadbargreen";
|
||||
$width = $percent * 4;
|
||||
print("<img class=\"".$loadpic."\" src=\"pic/trans.gif\" style=\"width: ".$width."px;\" alt=\"".$percent."%\" /></td></tr></table>");
|
||||
|
||||
$officialAdditionalFactor = get_setting('bonus.official_addition', 0);
|
||||
$officialTag = get_setting('bonus.official_tag');
|
||||
if ($officialAdditionalFactor > 0 && $officialTag) {
|
||||
print("<h1>".$lang_mybonus['text_get_by_seeding_official']."</h1>");
|
||||
print("<ul>");
|
||||
print("<li>".$lang_mybonus['official_calculate_method']."</li>");
|
||||
print("<li>".$lang_mybonus['official_tag_bonus_additional_factor'].$officialAdditionalFactor."</li>");
|
||||
print("</ul>");
|
||||
}
|
||||
|
||||
$officialAdditionalFactor = get_setting('bonus.official_addition', 0);
|
||||
$officialTag = get_setting('bonus.official_tag');
|
||||
$haremFactor = get_setting('bonus.harem_addition');
|
||||
$haremAddition = calculate_harem_addition($CURUSER['id']);
|
||||
$isDonor = is_donor($CURUSER);
|
||||
@@ -478,13 +437,28 @@ $baseBonusFactor = 1;
|
||||
if ($isDonor) {
|
||||
$baseBonusFactor = $donortimes_bonus;
|
||||
}
|
||||
$totalBonus = number_format($seedBonusResult['seed_bonus'] * $baseBonusFactor + $haremAddition * $haremFactor + $seedBonusResult['official_bonus'] * $officialAdditionalFactor, 3);
|
||||
$baseBonus = $seedBonusResult['seed_bonus'] * $baseBonusFactor;
|
||||
$totalBonus = number_format( $baseBonus + $haremAddition * $haremFactor + $seedBonusResult['official_bonus'] * $officialAdditionalFactor, 3);
|
||||
|
||||
|
||||
$percent = $seedBonusResult['seed_bonus'] * 100 / ($bzero_bonus + $perseeding_bonus * $maxseeding_bonus);
|
||||
print("<div align=\"center\">".$lang_mybonus['text_you_are_currently_getting'].round($seedBonusResult['seed_bonus'],3).$lang_mybonus['text_point'].add_s($seedBonusResult['seed_bonus']).$lang_mybonus['text_per_hour']." (A = ".round($A,1).")</div><table align=\"center\" border=\"0\" width=\"400\"><tr><td class=\"loadbarbg\" style='border: none; padding: 0px;'>");
|
||||
|
||||
if ($percent <= 30) $loadpic = "loadbarred";
|
||||
elseif ($percent <= 60) $loadpic = "loadbaryellow";
|
||||
else $loadpic = "loadbargreen";
|
||||
$width = $percent * 4;
|
||||
print("<img class=\"".$loadpic."\" src=\"pic/trans.gif\" style=\"width: ".$width."px;\" alt=\"".$percent."%\" /></td></tr></table>");
|
||||
|
||||
$rowSpan = 1;
|
||||
$hasHaremAddition = $hasOfficialAddition = false;
|
||||
if ($haremFactor > 0) {
|
||||
$rowSpan++;
|
||||
$hasHaremAddition = true;
|
||||
}
|
||||
if ($officialAdditionalFactor > 0 && $officialTag) {
|
||||
$rowSpan++;
|
||||
$hasOfficialAddition = true;
|
||||
}
|
||||
$summaryTable = '<table cellspacing="4" cellpadding="4" style="width: 50%"><tbody>';
|
||||
$summaryTable .= '<tr style="font-weight: bold"><td>'.$lang_mybonus['reward_type'].'</td><td>'.$lang_mybonus['bonus_base'].'</td><td>'.$lang_mybonus['factor'].'</td><td>'.$lang_mybonus['got_bonus'].'</td><td>'.$lang_mybonus['total'].'</td></tr>';
|
||||
@@ -493,20 +467,17 @@ $summaryTable .= sprintf(
|
||||
$lang_mybonus['reward_type_basic'],
|
||||
number_format($seedBonusResult['seed_bonus'],3),
|
||||
$baseBonusFactor,
|
||||
number_format($seedBonusResult['seed_bonus'],3),
|
||||
number_format($baseBonus,3),
|
||||
$rowSpan,
|
||||
$totalBonus
|
||||
);
|
||||
if ($haremFactor > 0) {
|
||||
$summaryTable .= sprintf(
|
||||
'<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
|
||||
$lang_mybonus['reward_type_harem_addition'],
|
||||
number_format($haremAddition, 3),
|
||||
$haremFactor,
|
||||
number_format($haremAddition * $haremFactor, 3)
|
||||
);
|
||||
}
|
||||
if ($officialAdditionalFactor > 0 && $officialTag) {
|
||||
|
||||
if ($hasOfficialAddition) {
|
||||
print("<h1>".$lang_mybonus['text_get_by_seeding_official']."</h1>");
|
||||
print("<ul>");
|
||||
print("<li>".$lang_mybonus['official_calculate_method']."</li>");
|
||||
print("<li>".$lang_mybonus['official_tag_bonus_additional_factor'].$officialAdditionalFactor."</li>");
|
||||
print("</ul>");
|
||||
$summaryTable .= sprintf(
|
||||
'<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
|
||||
$lang_mybonus['reward_type_official_addition'],
|
||||
@@ -516,8 +487,23 @@ if ($officialAdditionalFactor > 0 && $officialTag) {
|
||||
);
|
||||
}
|
||||
|
||||
if ($hasHaremAddition) {
|
||||
print("<h1>".$lang_mybonus['text_get_by_harem']."</h1>");
|
||||
print("<ul>");
|
||||
print("<li>".sprintf($lang_mybonus['harem_additional_desc'], $CURUSER['id'])."</li>");
|
||||
print("<li>".$lang_mybonus['harem_additional_factor'].$haremFactor."</li>");
|
||||
print("</ul>");
|
||||
$summaryTable .= sprintf(
|
||||
'<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
|
||||
$lang_mybonus['reward_type_harem_addition'],
|
||||
number_format($haremAddition, 3),
|
||||
$haremFactor,
|
||||
number_format($haremAddition * $haremFactor, 3)
|
||||
);
|
||||
}
|
||||
$summaryTable .= '</tbody></table>';
|
||||
|
||||
print("<h1>".$lang_mybonus['text_bonus_summary']."</h1>");
|
||||
print '<div style="display: flex;justify-content: center;margin-top: 20px;">'.$summaryTable.'</div>';
|
||||
|
||||
print("<h1>".$lang_mybonus['text_other_things_get_bonus']."</h1>");
|
||||
|
||||
@@ -41,7 +41,8 @@ if ($action == 'savesettings_main') // save main
|
||||
'showpolls','showstats','showlastxtorrents', 'showtrackerload','showshoutbox','showfunbox','showoffer','sptime','showhelpbox','enablebitbucket',
|
||||
'smalldescription','altname','extforum','extforumurl','defaultlang','defstylesheet', 'donation','spsct','browsecat','specialcat','waitsystem',
|
||||
'maxdlsystem','bitbucket','torrentnameprefix', 'showforumstats','verification','invite_count','invite_timeout', 'seeding_leeching_time_calc_start',
|
||||
'startsubid', 'logo', 'showlastxforumposts', 'enable_technical_info', 'site_language_enabled', 'show_top_uploader', 'imdb_language', 'offer_skip_approved_count'
|
||||
'startsubid', 'logo', 'showlastxforumposts', 'enable_technical_info', 'site_language_enabled', 'show_top_uploader', 'imdb_language', 'offer_skip_approved_count',
|
||||
'upload_deny_approval_deny_count'
|
||||
);
|
||||
GetVar($validConfig);
|
||||
$MAIN = [];
|
||||
@@ -871,6 +872,7 @@ JS;
|
||||
tr($lang_settings['row_offer_vote_timeout'],"<input type='text' style=\"width: 100px\" name=offervotetimeout value='".(isset($MAIN["offervotetimeout"]) ? $MAIN["offervotetimeout"] : 259200)."'> ".$lang_settings['text_offer_vote_timeout_note'], 1);
|
||||
tr($lang_settings['row_offer_upload_timeout'],"<input type='text' style=\"width: 100px\" name=offeruptimeout value='".(isset($MAIN["offeruptimeout"]) ? $MAIN["offeruptimeout"] : 86400)."'> ".$lang_settings['text_offer_upload_timeout_note'], 1);
|
||||
tr($lang_settings['row_offer_skip_approved_count'],"<input type='text' style=\"width: 100px\" name=offer_skip_approved_count value='".($MAIN["offer_skip_approved_count"] ?? '')."'> ".$lang_settings['text_offer_skip_approved_count_note'], 1);
|
||||
tr($lang_settings['row_upload_deny_approval_deny_count'],"<input type='text' style=\"width: 100px\" name=upload_deny_approval_deny_count value='".($MAIN["upload_deny_approval_deny_count"] ?? '')."'> ".$lang_settings['text_upload_deny_approval_deny_count_note'], 1);
|
||||
|
||||
tr($lang_settings['row_max_subtitle_size'],"<input type='text' style=\"width: 100px\" name=maxsubsize value='".(isset($MAIN["maxsubsize"]) ? $MAIN["maxsubsize"] : 3145728)."'> ". $lang_settings['text_max_subtitle_size_note'], 1);
|
||||
tr($lang_settings['row_posts_per_page'],"<input type='text' style=\"width: 100px\" name=postsperpage value='".($MAIN["postsperpage"] ? $MAIN["postsperpage"] : 10)."'> ".$lang_settings['text_posts_per_page_note'], 1);
|
||||
|
||||
@@ -14,10 +14,15 @@ if ($enableoffer == 'yes')
|
||||
else $has_allowed_offer = 0;
|
||||
$uploadfreely = user_can_upload("torrents");
|
||||
$offerSkipApprovedCount = get_setting('main.offer_skip_approved_count');
|
||||
do_log("uploadfreely: $uploadfreely, has_allowed_offer: $has_allowed_offer, offerSkipApprovedCount: $offerSkipApprovedCount");
|
||||
$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");
|
||||
|
||||
if ($uploadDenyApprovalDenyCount > 0 && $approvalDenyCount >= $uploadDenyApprovalDenyCount) {
|
||||
stderr($lang_upload['std_sorry'],sprintf($lang_upload['approval_deny_reach_upper_limit'], $uploadDenyApprovalDenyCount),false);
|
||||
}
|
||||
if (!$allowtorrents && !$allowspecial)
|
||||
stderr($lang_upload['std_sorry'],$lang_upload['std_please_offer'],false);
|
||||
$allowtwosec = ($allowtorrents && $allowspecial);
|
||||
|
||||
Reference in New Issue
Block a user