mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-26 05:17:22 +08:00
add user ban log from cleanup.php
This commit is contained in:
@@ -19,7 +19,7 @@ class BackupWeb extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $description = 'BackupWeb webRoot data';
|
protected $description = 'BackupWeb web data';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
@@ -39,7 +39,7 @@ class BackupWeb extends Command
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$rep = new ToolRepository();
|
$rep = new ToolRepository();
|
||||||
$result = $rep->backupWebRoot();
|
$result = $rep->backupWeb();
|
||||||
$log = sprintf('[%s], %s, result: %s', REQUEST_ID, __METHOD__, var_export($result, true));
|
$log = sprintf('[%s], %s, result: %s', REQUEST_ID, __METHOD__, var_export($result, true));
|
||||||
$this->info($log);
|
$this->info($log);
|
||||||
do_log($log);
|
do_log($log);
|
||||||
|
|||||||
@@ -124,6 +124,15 @@ class User extends Authenticatable
|
|||||||
return Locale::$languageMaps[$this->language->site_lang_folder] ?? 'en';
|
return Locale::$languageMaps[$this->language->site_lang_folder] ?? 'en';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSiteLangFolderAttribute()
|
||||||
|
{
|
||||||
|
$result = optional($this->language)->site_lang_folder;
|
||||||
|
if ($result && in_array($result, ['en', 'chs', 'cht'])) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
return 'en';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function exams()
|
public function exams()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,4 +6,5 @@ class UserBanLog extends NexusModel
|
|||||||
{
|
{
|
||||||
protected $table = 'user_ban_logs';
|
protected $table = 'user_ban_logs';
|
||||||
|
|
||||||
|
protected $fillable = ['uid', 'username', 'operator', 'reason'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -559,8 +559,8 @@ class ExamRepository extends BaseRepository
|
|||||||
$userModcommentUpdate[] = sprintf("when `id` = %s then concat_ws('\n', '%s', modcomment)", $uid, $userModcomment);
|
$userModcommentUpdate[] = sprintf("when `id` = %s then concat_ws('\n', '%s', modcomment)", $uid, $userModcomment);
|
||||||
$banLogReason = nexus_trans('exam.ban_log_reason', [
|
$banLogReason = nexus_trans('exam.ban_log_reason', [
|
||||||
'exam_name' => $exam->name,
|
'exam_name' => $exam->name,
|
||||||
'begin' => $exam->begin,
|
'begin' => $examUser->begin,
|
||||||
'end' => $exam->end,
|
'end' => $examUser->end,
|
||||||
], $locale);
|
], $locale);
|
||||||
$userBanLog[] = [
|
$userBanLog[] = [
|
||||||
'uid' => $uid,
|
'uid' => $uid,
|
||||||
@@ -587,7 +587,7 @@ class ExamRepository extends BaseRepository
|
|||||||
if (!empty($uidToDisable)) {
|
if (!empty($uidToDisable)) {
|
||||||
$uidStr = implode(', ', $uidToDisable);
|
$uidStr = implode(', ', $uidToDisable);
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'update %s set enabled = %s, set modcomment = case when %s end where id in (%s)',
|
"update %s set enabled = '%s', modcomment = case %s end where id in (%s)",
|
||||||
$userTable, User::ENABLED_NO, implode(' ', $userModcommentUpdate), $uidStr
|
$userTable, User::ENABLED_NO, implode(' ', $userModcommentUpdate), $uidStr
|
||||||
);
|
);
|
||||||
$updateResult = DB::update($sql);
|
$updateResult = DB::update($sql);
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ class ToolRepository extends BaseRepository
|
|||||||
return $systemInfo;
|
return $systemInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function backupWebRoot()
|
public function backupWeb()
|
||||||
{
|
{
|
||||||
$webRoot = base_path();
|
$webRoot = base_path();
|
||||||
$dirName = basename($webRoot);
|
$dirName = basename($webRoot);
|
||||||
$filename = sprintf('%s/%s.%s.tar.gz', sys_get_temp_dir(), $dirName, date('Ymd.His'));
|
$filename = sprintf('%s/%s.web.%s.tar.gz', sys_get_temp_dir(), $dirName, date('Ymd.His'));
|
||||||
$command = sprintf(
|
$command = sprintf(
|
||||||
'tar --exclude=vendor --exclude=.git -czf %s -C %s %s',
|
'tar --exclude=vendor --exclude=.git -czf %s -C %s %s',
|
||||||
$filename, dirname($webRoot), $dirName
|
$filename, dirname($webRoot), $dirName
|
||||||
@@ -57,7 +57,7 @@ class ToolRepository extends BaseRepository
|
|||||||
|
|
||||||
public function backupAll($uploadToGoogleDrive = false)
|
public function backupAll($uploadToGoogleDrive = false)
|
||||||
{
|
{
|
||||||
$backupWeb = $this->backupWebRoot();
|
$backupWeb = $this->backupWeb();
|
||||||
if ($backupWeb['result_code'] != 0) {
|
if ($backupWeb['result_code'] != 0) {
|
||||||
throw new \RuntimeException("backup web fail: " . json_encode($backupWeb));
|
throw new \RuntimeException("backup web fail: " . json_encode($backupWeb));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class UserRepository extends BaseRepository
|
|||||||
public function getDetail($id)
|
public function getDetail($id)
|
||||||
{
|
{
|
||||||
$with = [
|
$with = [
|
||||||
'inviter' => function (Builder $query) {return $query->select(User::$commonFields);}
|
'inviter' => function ($query) {return $query->select(User::$commonFields);}
|
||||||
];
|
];
|
||||||
$user = User::query()->with($with)->findOrFail($id, User::$commonFields);
|
$user = User::query()->with($with)->findOrFail($id, User::$commonFields);
|
||||||
$userResource = new UserResource($user);
|
$userResource = new UserResource($user);
|
||||||
|
|||||||
+123
-22
@@ -154,6 +154,66 @@ function user_to_peasant($down_floor_gb, $minratio){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ban_user_with_leech_warning_expired()
|
||||||
|
{
|
||||||
|
$dt = date("Y-m-d H:i:s"); // take date time
|
||||||
|
$results = \App\Models\User::query()
|
||||||
|
->where('enabled', \App\Models\User::ENABLED_YES)
|
||||||
|
->where('leechwarn', 'yes')
|
||||||
|
->where('leechwarnuntil', '<', $dt)
|
||||||
|
->get(['id', 'username', 'modcomment']);
|
||||||
|
if ($results->isEmpty()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$results->load('language');
|
||||||
|
$uidArr = [];
|
||||||
|
$userBanLogData = [];
|
||||||
|
foreach ($results as $user) {
|
||||||
|
$uid = $user->id;
|
||||||
|
$uidArr[] = $uid;
|
||||||
|
$userBanLogData[] = [
|
||||||
|
'uid' => $uid,
|
||||||
|
'username' => $user->username,
|
||||||
|
'reason' => nexus_trans('cleanup.ban_user_with_leech_warning_expired', [], $user->locale),
|
||||||
|
];
|
||||||
|
writecomment($uid,"Banned by System because of Leech Warning expired.", $user->modcomment);
|
||||||
|
}
|
||||||
|
$update = [
|
||||||
|
'enabled' => \App\Models\User::ENABLED_NO,
|
||||||
|
'leechwarnuntil' => null,
|
||||||
|
];
|
||||||
|
\App\Models\User::query()->whereIn('id', $uidArr)->update($update);
|
||||||
|
\App\Models\UserBanLog::query()->insert($userBanLogData);
|
||||||
|
do_log("ban user: " . implode(', ', $uidArr));
|
||||||
|
return $uidArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function delete_user(\Illuminate\Database\Eloquent\Builder $query, $reasonKey)
|
||||||
|
{
|
||||||
|
$results = $query->get(['id', 'username', 'modcomment']);
|
||||||
|
if ($results->isEmpty()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$results->load('language');
|
||||||
|
$uidArr = [];
|
||||||
|
$userBanLogData = [];
|
||||||
|
foreach ($results as $user) {
|
||||||
|
$uid = $user->id;
|
||||||
|
$uidArr[] = $uid;
|
||||||
|
$userBanLogData[] = [
|
||||||
|
'uid' => $uid,
|
||||||
|
'username' => $user->username,
|
||||||
|
'reason' => nexus_trans($reasonKey, [], $user->locale),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
\App\Models\User::query()->whereIn('id', $uidArr)->delete();
|
||||||
|
\App\Models\UserBanLog::query()->insert($userBanLogData);
|
||||||
|
do_log("delete user($reasonKey): " . implode(', ', $uidArr));
|
||||||
|
return $uidArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function docleanup($forceAll = 0, $printProgress = false) {
|
function docleanup($forceAll = 0, $printProgress = false) {
|
||||||
//require_once(get_langfile_path("cleanup.php",true));
|
//require_once(get_langfile_path("cleanup.php",true));
|
||||||
global $lang_cleanup_target;
|
global $lang_cleanup_target;
|
||||||
@@ -429,8 +489,14 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
|||||||
|
|
||||||
//3.delete unconfirmed accounts
|
//3.delete unconfirmed accounts
|
||||||
$deadtime = time() - $signup_timeout;
|
$deadtime = time() - $signup_timeout;
|
||||||
sql_query("DELETE FROM users WHERE status = 'pending' AND added < FROM_UNIXTIME($deadtime) AND last_login < FROM_UNIXTIME($deadtime) AND last_access < FROM_UNIXTIME($deadtime)") or sqlerr(__FILE__, __LINE__);
|
// sql_query("DELETE FROM users WHERE status = 'pending' AND added < FROM_UNIXTIME($deadtime) AND last_login < FROM_UNIXTIME($deadtime) AND last_access < FROM_UNIXTIME($deadtime)") or sqlerr(__FILE__, __LINE__);
|
||||||
$log = "delete unconfirmed accounts";
|
$query = \App\Models\User::query()
|
||||||
|
->where('status', 'pending')
|
||||||
|
->whereRaw("added < FROM_UNIXTIME($deadtime)")
|
||||||
|
->whereRaw("last_login < FROM_UNIXTIME($deadtime)")
|
||||||
|
->whereRaw("last_access < FROM_UNIXTIME($deadtime)");
|
||||||
|
delete_user($query, "cleanup.delete_user_unconfirmed");
|
||||||
|
$log = "delete unconfirmed accounts";
|
||||||
do_log($log);
|
do_log($log);
|
||||||
if ($printProgress) {
|
if ($printProgress) {
|
||||||
printProgress($log);
|
printProgress($log);
|
||||||
@@ -470,9 +536,19 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
|||||||
//delete inactive user accounts, no transfer. Alt. 1: last access time
|
//delete inactive user accounts, no transfer. Alt. 1: last access time
|
||||||
if ($deletenotransfer_account){
|
if ($deletenotransfer_account){
|
||||||
$secs = $deletenotransfer_account*24*60*60;
|
$secs = $deletenotransfer_account*24*60*60;
|
||||||
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs)));
|
$dt = date("Y-m-d H:i:s",(TIMENOW - $secs));
|
||||||
$maxclass = $neverdelete_account;
|
$maxclass = $neverdelete_account;
|
||||||
sql_query("DELETE FROM users WHERE parked='no' AND status='confirmed' AND class < $maxclass AND last_access < $dt AND (uploaded = 0 || uploaded = ".sqlesc($iniupload_main).") AND downloaded = 0") or sqlerr(__FILE__, __LINE__);
|
// sql_query("DELETE FROM users WHERE parked='no' AND status='confirmed' AND class < $maxclass AND last_access < $dt AND (uploaded = 0 || uploaded = ".sqlesc($iniupload_main).") AND downloaded = 0") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$query = \App\Models\User::query()
|
||||||
|
->where('parked', 'no')
|
||||||
|
->where('status', 'confirmed')
|
||||||
|
->where("class","<", $maxclass)
|
||||||
|
->where("last_access","<", $dt)
|
||||||
|
->where("downloaded",0)
|
||||||
|
->where(function (\Illuminate\Database\Eloquent\Builder $query) use ($iniupload_main) {
|
||||||
|
$query->where('uploaded', 0)->orWhere('uploaded', $iniupload_main);
|
||||||
|
});
|
||||||
|
delete_user($query, "cleanup.delete_user_no_transfer_alt_last_access_time");
|
||||||
}
|
}
|
||||||
$log = "delete inactive user accounts, no transfer. Alt. 1: last access time";
|
$log = "delete inactive user accounts, no transfer. Alt. 1: last access time";
|
||||||
do_log($log);
|
do_log($log);
|
||||||
@@ -483,9 +559,19 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
|||||||
//delete inactive user accounts, no transfer. Alt. 2: registering time
|
//delete inactive user accounts, no transfer. Alt. 2: registering time
|
||||||
if ($deletenotransfertwo_account){
|
if ($deletenotransfertwo_account){
|
||||||
$secs = $deletenotransfertwo_account*24*60*60;
|
$secs = $deletenotransfertwo_account*24*60*60;
|
||||||
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs)));
|
$dt = date("Y-m-d H:i:s",(TIMENOW - $secs));
|
||||||
$maxclass = $neverdelete_account;
|
$maxclass = $neverdelete_account;
|
||||||
sql_query("DELETE FROM users WHERE parked='no' AND status='confirmed' AND class < $maxclass AND added < $dt AND (uploaded = 0 || uploaded = ".sqlesc($iniupload_main).") AND downloaded = 0") or sqlerr(__FILE__, __LINE__);
|
// sql_query("DELETE FROM users WHERE parked='no' AND status='confirmed' AND class < $maxclass AND added < $dt AND (uploaded = 0 || uploaded = ".sqlesc($iniupload_main).") AND downloaded = 0") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$query = \App\Models\User::query()
|
||||||
|
->where('parked', 'no')
|
||||||
|
->where('status', 'confirmed')
|
||||||
|
->where("class","<", $maxclass)
|
||||||
|
->where("added","<", $dt)
|
||||||
|
->where("downloaded",0)
|
||||||
|
->where(function (\Illuminate\Database\Eloquent\Builder $query) use ($iniupload_main) {
|
||||||
|
$query->where('uploaded', 0)->orWhere('uploaded', $iniupload_main);
|
||||||
|
});
|
||||||
|
delete_user($query, "cleanup.delete_user_no_transfer_alt_last_register_time");
|
||||||
}
|
}
|
||||||
$log = "delete inactive user accounts, no transfer. Alt. 2: registering time";
|
$log = "delete inactive user accounts, no transfer. Alt. 2: registering time";
|
||||||
do_log($log);
|
do_log($log);
|
||||||
@@ -496,9 +582,15 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
|||||||
//delete inactive user accounts, not parked
|
//delete inactive user accounts, not parked
|
||||||
if ($deleteunpacked_account){
|
if ($deleteunpacked_account){
|
||||||
$secs = $deleteunpacked_account*24*60*60;
|
$secs = $deleteunpacked_account*24*60*60;
|
||||||
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs)));
|
$dt = date("Y-m-d H:i:s",(TIMENOW - $secs));
|
||||||
$maxclass = $neverdelete_account;
|
$maxclass = $neverdelete_account;
|
||||||
sql_query("DELETE FROM users WHERE parked='no' AND status='confirmed' AND class < $maxclass AND last_access < $dt") or sqlerr(__FILE__, __LINE__);
|
// sql_query("DELETE FROM users WHERE parked='no' AND status='confirmed' AND class < $maxclass AND last_access < $dt") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$query = \App\Models\User::query()
|
||||||
|
->where('parked', 'no')
|
||||||
|
->where('status', 'confirmed')
|
||||||
|
->where("class","<", $maxclass)
|
||||||
|
->where("last_access","<", $dt);
|
||||||
|
delete_user($query, "cleanup.delete_user_not_parked");
|
||||||
}
|
}
|
||||||
$log = "delete inactive user accounts, not parked";
|
$log = "delete inactive user accounts, not parked";
|
||||||
do_log($log);
|
do_log($log);
|
||||||
@@ -509,9 +601,15 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
|||||||
//delete parked user accounts, parked
|
//delete parked user accounts, parked
|
||||||
if ($deletepacked_account){
|
if ($deletepacked_account){
|
||||||
$secs = $deletepacked_account*24*60*60;
|
$secs = $deletepacked_account*24*60*60;
|
||||||
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs)));
|
$dt = date("Y-m-d H:i:s",(TIMENOW - $secs));
|
||||||
$maxclass = $neverdeletepacked_account;
|
$maxclass = $neverdeletepacked_account;
|
||||||
sql_query("DELETE FROM users WHERE parked='yes' AND status='confirmed' AND class < $maxclass AND last_access < $dt") or sqlerr(__FILE__, __LINE__);
|
// sql_query("DELETE FROM users WHERE parked='yes' AND status='confirmed' AND class < $maxclass AND last_access < $dt") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$query = \App\Models\User::query()
|
||||||
|
->where('parked', 'yes')
|
||||||
|
->where('status', 'confirmed')
|
||||||
|
->where("class","<", $maxclass)
|
||||||
|
->where("last_access","<", $dt);
|
||||||
|
delete_user($query, "cleanup.delete_user_parked");
|
||||||
}
|
}
|
||||||
$log = "delete parked user accounts, parked";
|
$log = "delete parked user accounts, parked";
|
||||||
do_log($log);
|
do_log($log);
|
||||||
@@ -607,18 +705,21 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
|||||||
// end Users to Peasant
|
// end Users to Peasant
|
||||||
|
|
||||||
//ban users with leechwarning expired
|
//ban users with leechwarning expired
|
||||||
$dt = sqlesc(date("Y-m-d H:i:s")); // take date time
|
// $dt = sqlesc(date("Y-m-d H:i:s")); // take date time
|
||||||
$res = sql_query("SELECT id FROM users WHERE enabled = 'yes' AND leechwarn = 'yes' AND leechwarnuntil < $dt") or sqlerr(__FILE__, __LINE__);
|
// $res = sql_query("SELECT id FROM users WHERE enabled = 'yes' AND leechwarn = 'yes' AND leechwarnuntil < $dt") or sqlerr(__FILE__, __LINE__);
|
||||||
|
//
|
||||||
if (mysql_num_rows($res) > 0)
|
// if (mysql_num_rows($res) > 0)
|
||||||
{
|
// {
|
||||||
while ($arr = mysql_fetch_assoc($res))
|
// while ($arr = mysql_fetch_assoc($res))
|
||||||
{
|
// {
|
||||||
writecomment($arr['id'],"Banned by System because of Leech Warning expired.");
|
// writecomment($arr['id'],"Banned by System because of Leech Warning expired.");
|
||||||
|
//
|
||||||
sql_query("UPDATE users SET enabled = 'no', leechwarnuntil = null WHERE id = {$arr['id']}") or sqlerr(__FILE__, __LINE__);
|
// sql_query("UPDATE users SET enabled = 'no', leechwarnuntil = null WHERE id = {$arr['id']}") or sqlerr(__FILE__, __LINE__);
|
||||||
}
|
//
|
||||||
}
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
ban_user_with_leech_warning_expired();
|
||||||
$log = "ban users with leechwarning expired";
|
$log = "ban users with leechwarning expired";
|
||||||
do_log($log);
|
do_log($log);
|
||||||
if ($printProgress) {
|
if ($printProgress) {
|
||||||
|
|||||||
+31
-6
@@ -2986,13 +2986,16 @@ function linkcolor($num) {
|
|||||||
return "green";
|
return "green";
|
||||||
}
|
}
|
||||||
|
|
||||||
function writecomment($userid, $comment) {
|
function writecomment($userid, $comment, $oldModcomment = null) {
|
||||||
$res = sql_query("SELECT modcomment FROM users WHERE id = '$userid'") or sqlerr(__FILE__, __LINE__);
|
if (is_null($oldModcomment)) {
|
||||||
$arr = mysql_fetch_assoc($res);
|
$res = sql_query("SELECT modcomment FROM users WHERE id = '$userid'") or sqlerr(__FILE__, __LINE__);
|
||||||
|
$arr = mysql_fetch_assoc($res);
|
||||||
$modcomment = date("d-m-Y") . " - " . $comment . "" . ($arr[modcomment] != "" ? "\n\n" : "") . "$arr[modcomment]";
|
$modcomment = date("d-m-Y") . " - " . $comment . "" . ($arr['modcomment'] != "" ? "\n" : "") . $arr['modcomment'];
|
||||||
|
} else {
|
||||||
|
$modcomment = date("d-m-Y") . " - " . $comment . "" . ($oldModcomment != "" ? "\n" : "") .$oldModcomment;
|
||||||
|
}
|
||||||
$modcom = sqlesc($modcomment);
|
$modcom = sqlesc($modcomment);
|
||||||
|
do_log("update user: $userid prepend modcomment: $comment, with oldModcomment: $oldModcomment");
|
||||||
return sql_query("UPDATE users SET modcomment = $modcom WHERE id = '$userid'") or sqlerr(__FILE__, __LINE__);
|
return sql_query("UPDATE users SET modcomment = $modcom WHERE id = '$userid'") or sqlerr(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4709,4 +4712,26 @@ function displayHotAndClassic()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function build_table(array $header, array $rows, array $options = [])
|
||||||
|
{
|
||||||
|
$table = '<table border="1" cellspacing="0" cellpadding="5" width="100%"><thead><tr>';
|
||||||
|
foreach ($header as $key => $value) {
|
||||||
|
$table .= sprintf('<td class="colhead">%s</td>', $value);
|
||||||
|
}
|
||||||
|
$table .= '</tr></thead><tbody>';
|
||||||
|
$tdClass = '';
|
||||||
|
if (isset($options['td-center']) && $options['td-center']) {
|
||||||
|
$tdClass = 'colfollow';
|
||||||
|
}
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$table .= '<tr>';
|
||||||
|
foreach ($header as $headerKey => $headerValue) {
|
||||||
|
$table .= sprintf('<td class="%s">%s</td>', $tdClass, $row[$headerKey] ?? '');
|
||||||
|
}
|
||||||
|
$table .= '</tr>';
|
||||||
|
}
|
||||||
|
$table .= '</tbody></table>';
|
||||||
|
return $table;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ $lang_login = array
|
|||||||
'p_remaining_tries' => "次尝试机会",
|
'p_remaining_tries' => "次尝试机会",
|
||||||
'p_no_account_signup' => "还没有账号? 马上<a href=\"signup.php\"><b>注册</b></a>!",
|
'p_no_account_signup' => "还没有账号? 马上<a href=\"signup.php\"><b>注册</b></a>!",
|
||||||
'p_forget_pass_recover' => "忘记了密码? 通过<a href=\"recover.php\"><b>邮件</b></a>来找回密码",
|
'p_forget_pass_recover' => "忘记了密码? 通过<a href=\"recover.php\"><b>邮件</b></a>来找回密码",
|
||||||
|
'p_account_banned' => "账号被禁用? 通过<a href=\"user-ban-log.php\"><b>封禁记录</b></a>查看原因",
|
||||||
'p_resend_confirm' => "没有收到验证邮件或验证链接无法打开? <a href=\"confirm_resend.php\"><b>重新发送验证邮件</b></a>",
|
'p_resend_confirm' => "没有收到验证邮件或验证链接无法打开? <a href=\"confirm_resend.php\"><b>重新发送验证邮件</b></a>",
|
||||||
'rowhead_username' => "用户名:",
|
'rowhead_username' => "用户名:",
|
||||||
'rowhead_password' => "密码:",
|
'rowhead_password' => "密码:",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ $lang_login = array
|
|||||||
'p_remaining_tries' => "次嘗試機會",
|
'p_remaining_tries' => "次嘗試機會",
|
||||||
'p_no_account_signup' => "還沒有帳號? 馬上<a href=\"signup.php\"><b>註冊</b></a>!",
|
'p_no_account_signup' => "還沒有帳號? 馬上<a href=\"signup.php\"><b>註冊</b></a>!",
|
||||||
'p_forget_pass_recover' => "忘記了密碼? 通過<a href=\"recover.php\"><b>郵件</b></a>來找回密碼",
|
'p_forget_pass_recover' => "忘記了密碼? 通過<a href=\"recover.php\"><b>郵件</b></a>來找回密碼",
|
||||||
|
'p_account_banned' => "賬號被禁用? 通過<a href=\"user-ban-log.php\"><b>封禁記錄</b></a>查看原因",
|
||||||
'p_resend_confirm' => "沒有收到驗證郵件或驗證鏈結無法打開? <a href=\"confirm_resend.php\"><b>重新發送驗證郵件</b></a>",
|
'p_resend_confirm' => "沒有收到驗證郵件或驗證鏈結無法打開? <a href=\"confirm_resend.php\"><b>重新發送驗證郵件</b></a>",
|
||||||
'rowhead_username' => "用戶名:",
|
'rowhead_username' => "用戶名:",
|
||||||
'rowhead_password' => "密碼:",
|
'rowhead_password' => "密碼:",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ $lang_login = array
|
|||||||
'p_remaining_tries' => "remaining tries.",
|
'p_remaining_tries' => "remaining tries.",
|
||||||
'p_no_account_signup' => "Don't have an account? <a href=\"signup.php\"><b>Sign up</b></a> right now!",
|
'p_no_account_signup' => "Don't have an account? <a href=\"signup.php\"><b>Sign up</b></a> right now!",
|
||||||
'p_forget_pass_recover' => "Forget your password? Recover your password <a href=\"recover.php\"><b>via email</b></a>",
|
'p_forget_pass_recover' => "Forget your password? Recover your password <a href=\"recover.php\"><b>via email</b></a>",
|
||||||
|
'p_account_banned' => "Account banned? view reason on<a href=\"user-ban-log.php\"><b>user ban log</b></a>",
|
||||||
'p_resend_confirm' => "Did not receive confirmation mail or confirmation link is broken? <a href=\"confirm_resend.php\"><b>Send confirmation mail again</b></a>",
|
'p_resend_confirm' => "Did not receive confirmation mail or confirmation link is broken? <a href=\"confirm_resend.php\"><b>Send confirmation mail again</b></a>",
|
||||||
'rowhead_username' => "Username:",
|
'rowhead_username' => "Username:",
|
||||||
'rowhead_password' => "Password:",
|
'rowhead_password' => "Password:",
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ if (isset($returnto))
|
|||||||
if ($smtptype != 'none'){
|
if ($smtptype != 'none'){
|
||||||
?>
|
?>
|
||||||
<p><?php echo $lang_login['p_forget_pass_recover']?></p>
|
<p><?php echo $lang_login['p_forget_pass_recover']?></p>
|
||||||
|
<p><?php echo $lang_login['p_account_banned']?></p>
|
||||||
<p><?php echo $lang_login['p_resend_confirm']?></p>
|
<p><?php echo $lang_login['p_resend_confirm']?></p>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ if ($action == "edituser")
|
|||||||
$banLog = [
|
$banLog = [
|
||||||
'uid' => $userid,
|
'uid' => $userid,
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
|
'operator' => $CURUSER['id'],
|
||||||
'reason' => nexus_trans('user.edit_ban_reason', [], $user->locale),
|
'reason' => nexus_trans('user.edit_ban_reason', [], $user->locale),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
require "../include/bittorrent.php";
|
||||||
|
|
||||||
|
$query = \App\Models\UserBanLog::query();
|
||||||
|
$q = $_REQUEST['q'] ?? '';
|
||||||
|
if (!empty($q)) {
|
||||||
|
$query->where('username', 'like', "%{$q}%");
|
||||||
|
}
|
||||||
|
$total = $query->toBase()->getCountForPagination();
|
||||||
|
$page = $_REQUEST['page'] ?? 1;
|
||||||
|
$perPage = 20;
|
||||||
|
$rows = $query->forPage($page, $perPage)->orderBy('id', 'desc')->get()->toArray();
|
||||||
|
list($paginationTop, $paginationBottom, $limit) = pager($perPage, $total, "?");
|
||||||
|
$header = [
|
||||||
|
'id' => 'ID',
|
||||||
|
'uid' => 'UID',
|
||||||
|
'username' => 'Username',
|
||||||
|
'reason' => 'Reason',
|
||||||
|
'created_at' => 'Created at',
|
||||||
|
];
|
||||||
|
$table = build_table($header, $rows);
|
||||||
|
$q = htmlspecialchars($q);
|
||||||
|
$filterForm = <<<FORM
|
||||||
|
<div>
|
||||||
|
<h1 style="text-align: center">User ban log</h1>
|
||||||
|
<form id="filterForm" action="{$_SERVER['REQUEST_URI']}" method="get">
|
||||||
|
<input id="q" type="text" name="q" value="{$q}">
|
||||||
|
<input type="submit">
|
||||||
|
<input type="reset" onclick="document.getElementById('q').value='';document.getElementById('filterForm').submit();">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
FORM;
|
||||||
|
stdhead('User ban log');
|
||||||
|
begin_main_frame();
|
||||||
|
echo $filterForm . $table . $paginationBottom;
|
||||||
|
stdfoot();
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ban_user_with_leech_warning_expired' => 'Banned by system because of leech warning expired.',
|
||||||
|
'delete_user_unconfirmed' => 'Delete by system because of unconfired excess deadline.',
|
||||||
|
'delete_user_no_transfer_alt_last_access_time' => 'Delete inactive user accounts, no transfer. Alt: last access time.',
|
||||||
|
'delete_user_no_transfer_alt_last_register_time' => 'Delete inactive user accounts, no transfer. Alt: register time.',
|
||||||
|
'delete_user_not_parked' => 'Delete inactive user accounts, not parked.',
|
||||||
|
'delete_user_parked' => 'Delete inactive user accounts, parked.',
|
||||||
|
];
|
||||||
@@ -18,5 +18,5 @@ return [
|
|||||||
'checkout_not_pass_message_subject' => 'Exam not pass, and account is banned!',
|
'checkout_not_pass_message_subject' => 'Exam not pass, and account is banned!',
|
||||||
'checkout_not_pass_message_content' => 'You did not complete the exam: :exam_name in time(:begin ~ :end), and your account has be banned!',
|
'checkout_not_pass_message_content' => 'You did not complete the exam: :exam_name in time(:begin ~ :end), and your account has be banned!',
|
||||||
'ban_log_reason' => 'Not complete exam: :exam_name in time(:begin ~ :end)',
|
'ban_log_reason' => 'Not complete exam: :exam_name in time(:begin ~ :end)',
|
||||||
'ban_user_modcomment' => 'Due to not complete exam: :exam_name(:begin ~ :end), ban by system',
|
'ban_user_modcomment' => 'Due to not complete exam: :exam_name(:begin ~ :end), ban by system.',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ban_user_with_leech_warning_expired' => '上传警告到期,被系统禁用.',
|
||||||
|
'delete_user_unconfirmed' => '超时未确认,被系统删除.',
|
||||||
|
'delete_user_no_transfer_alt_last_access_time' => '删除非活跃账号,由最近访问时间断定.',
|
||||||
|
'delete_user_no_transfer_alt_last_register_time' => '删除非活跃账号,由注册时间时间断定.',
|
||||||
|
'delete_user_not_parked' => '定时删除未挂起的非活跃账号.',
|
||||||
|
'delete_user_parked' => '定时删除已挂起的非活跃账号.',
|
||||||
|
];
|
||||||
@@ -18,5 +18,5 @@ return [
|
|||||||
'checkout_not_pass_message_subject' => '考核未通过,账号被禁用!',
|
'checkout_not_pass_message_subject' => '考核未通过,账号被禁用!',
|
||||||
'checkout_not_pass_message_content' => '你在规定时间内(:begin ~ :end)未完成考核::exam_name,账号已被禁用。',
|
'checkout_not_pass_message_content' => '你在规定时间内(:begin ~ :end)未完成考核::exam_name,账号已被禁用。',
|
||||||
'ban_log_reason' => '未完成考核::exam_name(:begin ~ :end)',
|
'ban_log_reason' => '未完成考核::exam_name(:begin ~ :end)',
|
||||||
'ban_user_modcomment' => '未完成考核: :exam_name(:begin ~ :end), 被系统禁用',
|
'ban_user_modcomment' => '未完成考核: :exam_name(:begin ~ :end), 被系统禁用.',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ban_user_with_leech_warning_expired' => '上傳警告到期,被系統禁用.',
|
||||||
|
'delete_user_unconfirmed' => '超時未確認,被系統刪除.',
|
||||||
|
'delete_user_no_transfer_alt_last_access_time' => '刪除非活躍賬號,由最近訪問時間斷定.',
|
||||||
|
'delete_user_no_transfer_alt_last_register_time' => '刪除非活躍賬號,由註冊時間時間斷定.',
|
||||||
|
'delete_user_not_parked' => '定時刪除未掛起的非活躍賬號.',
|
||||||
|
'delete_user_parked' => '定時刪除已掛起的非活躍賬號.',
|
||||||
|
];
|
||||||
@@ -18,5 +18,5 @@ return [
|
|||||||
'checkout_not_pass_message_subject' => '考核未通過,賬號被禁用!',
|
'checkout_not_pass_message_subject' => '考核未通過,賬號被禁用!',
|
||||||
'checkout_not_pass_message_content' => '你在規定時間內(:begin ~ :end)未完成考核::exam_name,賬號已被禁用。',
|
'checkout_not_pass_message_content' => '你在規定時間內(:begin ~ :end)未完成考核::exam_name,賬號已被禁用。',
|
||||||
'ban_log_reason' => '未完成考核::exam_name(:begin ~ :end)',
|
'ban_log_reason' => '未完成考核::exam_name(:begin ~ :end)',
|
||||||
'ban_user_modcomment' => '未完成考核: :exam_name(:begin ~ :end), 被系統禁用',
|
'ban_user_modcomment' => '未完成考核: :exam_name(:begin ~ :end), 被系統禁用.',
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user