diff --git a/app/Console/Commands/NexusUpdate.php b/app/Console/Commands/NexusUpdate.php
index 08f85f3a..5fc7205c 100644
--- a/app/Console/Commands/NexusUpdate.php
+++ b/app/Console/Commands/NexusUpdate.php
@@ -45,7 +45,7 @@ class NexusUpdate extends Command
require ROOT_PATH . 'nexus/Database/helpers.php';
//Step 1
$step = $this->update->currentStep();
- $log = "Step 1, Checking environment...";
+ $log = sprintf('Step %s, %s...', $step, $this->update->getStepName($step));
$this->doLog($log);
$requirements = $this->update->listRequirementTableRows();
$fails = $requirements['fails'];
@@ -58,17 +58,17 @@ class NexusUpdate extends Command
$this->update->gotoStep(++$step);
//Step 2
- $log = "Step 2, get files, cli skip...";
+ $log = sprintf('Step %s, %s, cli skip...', $step, $this->update->getStepName($step));
$this->doLog($log);
$this->update->gotoStep(++$step);
//Step 3
- $log = "Step 3, update .env, cli skip...";
+ $log = sprintf('Step %s, %s, cli skip...', $step, $this->update->getStepName($step));
$this->doLog($log);
$this->update->gotoStep(++$step);
//Step 4
- $log = "Step 4, perform update...";
+ $log = sprintf('Step %s, %s...', $step, $this->update->getStepName($step));
$this->doLog($log);
$settingTableRows = $this->update->listSettingTableRows();
$settings = $settingTableRows['settings'];
diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php
index d6e6ae42..98d2b181 100644
--- a/app/Repositories/UserRepository.php
+++ b/app/Repositories/UserRepository.php
@@ -282,6 +282,22 @@ class UserRepository extends BaseRepository
return true;
}
+ public function removeLeechWarn($operator, $uid): bool
+ {
+ if (!$operator instanceof User) {
+ $operator = User::query()->findOrFail(intval($operator), User::$commonFields);
+ }
+ $classRequire = Setting::get('authority.prfmanage');
+ if ($operator->class < $classRequire) {
+ throw new \RuntimeException("No permission.");
+ }
+ $user = User::query()->findOrFail($uid, User::$commonFields);
+ NexusDB::cache_del('user_'.$uid.'_content');
+ $user->leechwarn = 'no';
+ $user->leechwarnuntil = null;
+ return $user->save();
+ }
+
}
diff --git a/lang/chs/lang_userdetails.php b/lang/chs/lang_userdetails.php
index d0a28f66..6c6345b5 100644
--- a/lang/chs/lang_userdetails.php
+++ b/lang/chs/lang_userdetails.php
@@ -151,5 +151,6 @@ $lang_userdetails = array
'row_donoruntil' => '捐赠状态截止时间',
'text_donoruntil_note' => "时间格式为'年年年年-月月-日日 时时:分分:秒秒'。留空永久有效。",
'change_field_value_migrated' => '修改请到管理后台操作',
+ 'sure_to_remove_leech_warn' => '确定要清除此吸血警告吗?',
);
?>
diff --git a/lang/cht/lang_usercp.php b/lang/cht/lang_usercp.php
index 4b7c14ec..986decf2 100644
--- a/lang/cht/lang_usercp.php
+++ b/lang/cht/lang_usercp.php
@@ -243,7 +243,12 @@ $lang_usercp = array
'text_show_advertisement_note' => "我想看到廣告",
'row_promotion_link' => "宣傳鏈結",
'text_update_promotion_link' => "更新宣傳鏈結",
- 'text_read_more' => "了解更多"
+ 'text_read_more' => "了解更多",
+ 'row_two_step_secret' => '兩步驗證',
+ 'text_two_step_secret_bind_by_qrdoe_note' => '你可以使用 Google Authenticator 或 Authy 掃描左側二維碼
如果左側二維碼沒有加載成功,可以嘗試打開此鏈接進行加載:',
+ 'text_two_step_secret_bind_manually_note' => '或者在 APP 中手動輸入以下 Key:',
+ 'text_two_step_secret_bind_complete_note' => '輸入 code 完成兩步驗證',
+ 'text_two_step_secret_unbind_note' => '輸入 code 取消兩步驗證',
);
?>
diff --git a/lang/cht/lang_userdetails.php b/lang/cht/lang_userdetails.php
index 95d742f9..9ed3c38e 100644
--- a/lang/cht/lang_userdetails.php
+++ b/lang/cht/lang_userdetails.php
@@ -151,5 +151,6 @@ $lang_userdetails = array
'row_donoruntil' => '捐贈狀態截止時間',
'text_donoruntil_note' => "時間格式為'年年年年-月月-日日 時時:分分:秒秒'。留空永久有效。",
'change_field_value_migrated' => '修改請到管理後臺操作',
+ 'sure_to_remove_leech_warn' => '確定要清除此吸血警告嗎?',
);
?>
diff --git a/lang/en/lang_usercp.php b/lang/en/lang_usercp.php
index abc25b87..389b06d3 100644
--- a/lang/en/lang_usercp.php
+++ b/lang/en/lang_usercp.php
@@ -247,8 +247,10 @@ $lang_usercp = array
'text_update_promotion_link' => "Update Promotion Link",
'text_read_more' => "Read More",
'row_two_step_secret' => 'Two step authentication',
- 'text_two_step_secret_bind_note' => '',
- 'text_two_step_secret_remove_note' => '',
+ 'text_two_step_secret_bind_by_qrdoe_note' => 'You can use Google Authenticator or Authy to scan the QR code on the left
If the QR code on the left does not load successfully, you can try to open this link to load: ',
+ 'text_two_step_secret_bind_manually_note' => 'Or manually enter the following key in the APP: ',
+ 'text_two_step_secret_bind_complete_note' => 'Enter code to complete the two-step authentication',
+ 'text_two_step_secret_unbind_note' => 'Enter code to cancel two-step authentication',
);
?>
diff --git a/lang/en/lang_userdetails.php b/lang/en/lang_userdetails.php
index 906105ed..4c055b33 100644
--- a/lang/en/lang_userdetails.php
+++ b/lang/en/lang_userdetails.php
@@ -151,5 +151,6 @@ $lang_userdetails = array
'row_donoruntil' => 'Donated until',
'text_donoruntil_note' => "Time format is YYYY-MM-DD hh:mm:ss. Leave blank permanently.",
'change_field_value_migrated' => 'Modification please go to the background management system.',
+ 'sure_to_remove_leech_warn' => 'Are you sure to remove this leech warn ?',
);
?>
diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php
index fdb20605..ce97b99e 100644
--- a/nexus/Install/Install.php
+++ b/nexus/Install/Install.php
@@ -672,4 +672,9 @@ class Install
$this->doLog("set lock at: $fullFilename, result: " . var_export($res, true));
}
+ public function getStepName($step): string
+ {
+ return $this->steps[$step - 1] ?? '';
+ }
+
}
diff --git a/public/ajax.php b/public/ajax.php
index 5c2ef046..ad428827 100644
--- a/public/ajax.php
+++ b/public/ajax.php
@@ -61,3 +61,10 @@ function removeClaim($params)
return $rep->delete($params['id'], $CURUSER['id']);
}
+function removeUserLeechWarn($params)
+{
+ global $CURUSER;
+ $rep = new \App\Repositories\UserRepository();
+ return $rep->removeLeechWarn($CURUSER['id'], $params['uid']);
+}
+
diff --git a/public/userdetails.php b/public/userdetails.php
index 951828c0..373703ca 100644
--- a/public/userdetails.php
+++ b/public/userdetails.php
@@ -279,6 +279,20 @@ tr_small($lang_userdetails['row_avatar'], return_avatar_image(htmlspecialchars(t
if ($userInfo->valid_medals->isNotEmpty()) {
tr_small($lang_userdetails['row_medal'], build_medal_image($userInfo->valid_medals, 200, $CURUSER['id'] == $user['id']), 1);
+ $warnMedalJs = <<= $prfmanage_class && $user["class"] < get_user_class())
{
print($lang_userdetails['text_until'].$leechwarnuntil);
print("
(" . mkprettytime(strtotime($leechwarnuntil) - strtotime(date("Y-m-d H:i:s"))) .$lang_userdetails['text_to_go'].")");
+ printf(' ', $user['id']);
+ $removeLeechWarnJs = <<".$lang_userdetails['text_for_unlimited_time']."");
}
@@ -504,21 +536,5 @@ if (get_user_class() >= $prfmanage_class && $user["class"] < get_user_class())
}
}
end_main_frame();
-
-echo <<
-jQuery('input[type="checkbox"][name="medal_wearing_status"]').on("change", function (e) {
- let input = jQuery(this);
- let checked = input.prop("checked")
- jQuery.post('ajax.php', {params: {id: this.value}, action: 'toggleUserMedalStatus'}, function (response) {
- console.log(response)
- if (response.ret != 0) {
- input.prop("checked", !checked)
- alert(response.msg)
- }
- }, 'json')
-})
-
-EOT;
stdfoot();
?>