diff --git a/include/functions.php b/include/functions.php index db018608..292bf454 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2092,9 +2092,6 @@ function userlogin() { // error_reporting(E_ALL & ~E_NOTICE); // error_reporting(-1); // } - if ($row['enabled'] !== 'yes') { - - } return $loginResult = true; } @@ -3184,7 +3181,7 @@ function loggedinorreturn($mainpage = false) { } exit(); } - if ($CURUSER['enabled'] != 'yes' && $script != 'self-enable') { + if ($CURUSER['enabled'] != 'yes' && $script != 'self-enable' && \App\Models\Setting::getSelfEnableBonus() > 0) { nexus_redirect('self-enable.php'); } } diff --git a/lang/chs/lang_settings.php b/lang/chs/lang_settings.php index 186bcf2e..8ef0dac8 100644 --- a/lang/chs/lang_settings.php +++ b/lang/chs/lang_settings.php @@ -827,7 +827,7 @@ $lang_settings = array 'row_reward_times_limit' => '魔力奖励次数限制', 'text_reward_times_limit_note' => '种子详情页的魔力奖励每人每天次数限制,设置为 0 不限制。默认:0', 'row_self_enable' => '自助解封', - 'text_self_enable_note' => '个魔力值,如果他选择在被封禁 1 天内解封。封禁时长为 N 天,失去的魔力值将会是此值的 N 倍。', + 'text_self_enable_note' => '个魔力值,如果他选择在被封禁 1 天内解封。封禁时长为 N 天,失去的魔力值将会是此值的 N 倍。设置为 0 禁用此功能。', ); ?> diff --git a/lang/cht/lang_settings.php b/lang/cht/lang_settings.php index ddb111fb..f9d27a3c 100644 --- a/lang/cht/lang_settings.php +++ b/lang/cht/lang_settings.php @@ -827,7 +827,7 @@ $lang_settings = array 'row_reward_times_limit' => '魔力獎勵次數限制', 'text_reward_times_limit_note' => '種子詳情頁的魔力獎勵每人每天次數限制,設置爲 0 不限制。默認:0', 'row_self_enable' => '自助解封', - 'text_self_enable_note' => '個魔力值,如果他選擇在被封禁 1 天內解封。封禁時長為 N 天,失去的魔力值將會是此值的 N 倍。', + 'text_self_enable_note' => '個魔力值,如果他選擇在被封禁 1 天內解封。封禁時長為 N 天,失去的魔力值將會是此值的 N 倍。設置為 0 禁用此功能。', ); ?> diff --git a/lang/en/lang_settings.php b/lang/en/lang_settings.php index e1c2b10c..34e669cb 100644 --- a/lang/en/lang_settings.php +++ b/lang/en/lang_settings.php @@ -827,7 +827,7 @@ $lang_settings = array 'row_reward_times_limit' => 'Reward Frequency Limit', 'text_reward_times_limit_note' => 'Daily limit per user for bonus rewards on seed detail pages. Set to 0 for no limit. Default: 0', 'row_self_enable' => 'Self-service unblocking', - 'text_self_enable_note' => 'points. If he chooses to unblock within 1 day of being banned. If the ban duration is N days, the lost mana points will be N times this value.', + 'text_self_enable_note' => 'points. If he chooses to unblock within 1 day of being banned. If the ban duration is N days, the lost mana points will be N times this value. Setting it to 0 disables this feature.', ); ?> diff --git a/public/self-enable.php b/public/self-enable.php index e632318a..851d47bc 100644 --- a/public/self-enable.php +++ b/public/self-enable.php @@ -9,9 +9,10 @@ $title = nexus_trans('self-enable.title'); stdhead($title); begin_main_frame(); begin_frame($title, true,10,"100%","center"); - - -if ($CURUSER['enabled'] == 'yes') { +$unit = \App\Models\Setting::getSelfEnableBonus(); +if ($unit <= 0) { + printf('

%s

', nexus_trans('self-enable.feature_disabled')); +} elseif ($CURUSER['enabled'] == 'yes') { printf('

%s

', nexus_trans('self-enable.enable_status_normal')); } else { $latestBanLog = \App\Models\UserBanLog::query() @@ -21,7 +22,6 @@ if ($CURUSER['enabled'] == 'yes') { if (!$latestBanLog) { printf('

%s

', nexus_trans('self-enable.no_ban_info')); } else { - $unit = \App\Models\Setting::getSelfEnableBonus(); $elapsedDay = ceil((time() - $latestBanLog->created_at->getTimestamp()) / 86400); $total = $unit * $elapsedDay; $isUserBonusEnough = $CURUSER['seedbonus'] >= $total; diff --git a/resources/lang/en/self-enable.php b/resources/lang/en/self-enable.php index d6c11683..4c858eb7 100644 --- a/resources/lang/en/self-enable.php +++ b/resources/lang/en/self-enable.php @@ -10,4 +10,5 @@ return [ 'deduct_bonus_total' => 'Currently banned for :days days, total bonus to be deducted :total', 'enable_desc' => 'If you need to unblock, click the button below, the corresponding bonus points will be deducted and the account will return to normal.', 'enable_button' => 'Click to unblock', + 'feature_disabled' => 'Feature not enabled', ]; diff --git a/resources/lang/zh_CN/self-enable.php b/resources/lang/zh_CN/self-enable.php index 6304b6ab..a7ba41d9 100644 --- a/resources/lang/zh_CN/self-enable.php +++ b/resources/lang/zh_CN/self-enable.php @@ -10,4 +10,5 @@ return [ 'deduct_bonus_total' => '当前已封禁 :days 天,共需扣除魔力 :total', 'enable_desc' => '若需要解封,点击下面按钮,扣除相应魔力后账号即恢复正常。', 'enable_button' => '点我解封', + 'feature_disabled' => '功能未启用', ]; diff --git a/resources/lang/zh_TW/self-enable.php b/resources/lang/zh_TW/self-enable.php index 502a3491..c801f751 100644 --- a/resources/lang/zh_TW/self-enable.php +++ b/resources/lang/zh_TW/self-enable.php @@ -10,4 +10,5 @@ return [ 'deduct_bonus_total' => '當前已封禁 :days 天,共需扣除魔力 :total', 'enable_desc' => '若需要解封,點擊下面按鈕,扣除相應魔力後賬號即恢復正常。', 'enable_button' => '點我解封', + 'feature_disabled' => '功能未啟用', ];