diff --git a/app/Filament/Resources/Section/IconResource.php b/app/Filament/Resources/Section/IconResource.php index cff2a8b0..fad77bb3 100644 --- a/app/Filament/Resources/Section/IconResource.php +++ b/app/Filament/Resources/Section/IconResource.php @@ -41,6 +41,12 @@ class IconResource extends Resource { return $form ->schema([ + Forms\Components\Textarea::make('tip') + ->default(nexus_trans('label.icon.desc')) + ->disabled() + ->columnSpanFull() + ->rows(18) + , Forms\Components\TextInput::make('name') ->label(__('label.name')) ->required() diff --git a/app/Filament/Resources/Section/IconResource/Pages/CreateIcon.php b/app/Filament/Resources/Section/IconResource/Pages/CreateIcon.php index e06407c5..3906d83c 100644 --- a/app/Filament/Resources/Section/IconResource/Pages/CreateIcon.php +++ b/app/Filament/Resources/Section/IconResource/Pages/CreateIcon.php @@ -8,7 +8,7 @@ use Filament\Resources\Pages\CreateRecord; class CreateIcon extends CreateRecord { - protected static string $view = 'filament.resources.system.category-icon-resource.pages.create-record'; +// protected static string $view = 'filament.resources.system.category-icon-resource.pages.create-record'; protected static string $resource = IconResource::class; diff --git a/app/Filament/Resources/Section/IconResource/Pages/EditIcon.php b/app/Filament/Resources/Section/IconResource/Pages/EditIcon.php index 674cc781..d3dfc2fc 100644 --- a/app/Filament/Resources/Section/IconResource/Pages/EditIcon.php +++ b/app/Filament/Resources/Section/IconResource/Pages/EditIcon.php @@ -13,7 +13,7 @@ class EditIcon extends EditRecord protected static string $resource = IconResource::class; - protected static string $view = 'filament.resources.system.category-icon-resource.pages.edit-record'; +// protected static string $view = 'filament.resources.system.category-icon-resource.pages.edit-record'; protected function getHeaderActions(): array { @@ -22,6 +22,12 @@ class EditIcon extends EditRecord ]; } + protected function mutateFormDataBeforeFill(array $data): array + { + $data['tip'] = nexus_trans('label.icon.desc'); + return $data; + } + protected function getViewData(): array { return [ diff --git a/app/Filament/Resources/User/ExamUserResource.php b/app/Filament/Resources/User/ExamUserResource.php index 5e71af94..2487653b 100644 --- a/app/Filament/Resources/User/ExamUserResource.php +++ b/app/Filament/Resources/User/ExamUserResource.php @@ -11,6 +11,7 @@ use App\Repositories\HitAndRunRepository; use Carbon\Carbon; use Filament\Forms; use Filament\Forms\Form; +use Filament\Infolists\Infolist; use Filament\Resources\Resource; use Filament\Tables\Table; use Filament\Tables; @@ -19,6 +20,8 @@ use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Auth; use Illuminate\Support\HtmlString; +use Filament\Infolists; +use Filament\Infolists\Components; class ExamUserResource extends Resource { @@ -138,6 +141,96 @@ class ExamUserResource extends Resource ]); } + public static function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + Components\Grid::make(2)->schema([ + Components\Group::make([ + Infolists\Components\TextEntry::make('id'), + Infolists\Components\TextEntry::make('statusText') + ->label(__("label.status")) + , + Infolists\Components\TextEntry::make('uid') + ->formatStateUsing(fn ($record) => username_for_admin($record->uid)) + ->label(__("label.username")) + , + Infolists\Components\TextEntry::make('exam.name') +// ->formatStateUsing(fn ($record) => $record->torrent->name) + ->label(__("label.exam.label")) + , + Infolists\Components\TextEntry::make('begin') + ->label(__("label.begin")) + , + Infolists\Components\TextEntry::make('end') + ->label(__("label.end")) + , + Infolists\Components\TextEntry::make('isDoneText') + ->label(__("label.exam_user.is_done")) + , + Infolists\Components\TextEntry::make('created_at') + ->label(__("label.created_at")) + , + Infolists\Components\TextEntry::make('updated_at') + ->label(__("label.updated_at")) + , + ]) + ->columnSpan(1) + ->columns(2) + , + Components\Group::make([ + Components\Grid::make(3) // 3 列的网格 + ->schema([ + Infolists\Components\TextEntry::make('header1')->label('Header 1'), + Infolists\Components\TextEntry::make('header2')->label('Header 2'), + Infolists\Components\TextEntry::make('header3')->label('Header 3'), + ]), + Components\Grid::make(3) // 数据行 + ->schema([ + Infolists\Components\TextEntry::make('data1')->getStateUsing(fn ($record) => $record->data1), + Infolists\Components\TextEntry::make('data2')->getStateUsing(fn ($record) => $record->data2), + Infolists\Components\TextEntry::make('data3')->getStateUsing(fn ($record) => $record->data3), + ]), + // 更多数据行... + Components\Grid::make(3) // 数据行 + ->schema([ + Infolists\Components\TextEntry::make('data1')->getStateUsing(fn ($record) => $record->data4), + Infolists\Components\TextEntry::make('data2')->getStateUsing(fn ($record) => $record->data5), + Infolists\Components\TextEntry::make('data3')->getStateUsing(fn ($record) => $record->data6), + ]), + ])->columnSpan(1), + ]), + ]); + + } + +// private static function buildProgressTable(): array +// { +// $exam = $record->exam; +// $passTransKey = $exam->getPassResultTransKey('pass'); +// $notPassTransKey = $exam->getPassResultTransKey('not_pass'); +// $result = []; +// $result[] = Components\Grid::make(4) // 4 列的网格 +// ->schema([ +// Infolists\Components\TextEntry::make('index')->label(__('label.exam.index_required_label')), +// Infolists\Components\TextEntry::make('require')->label(__('label.exam.index_required_value')), +// Infolists\Components\TextEntry::make('current')->label(__('label.exam.index_current_value')), +// Infolists\Components\TextEntry::make('result')->label(__('label.exam.index_result')), +// ]); +// foreach($record->progressFormatted as $key => $index) { +// $result[] = Components\Grid::make(4) // 4 列的网格 +// ->schema([ +// Infolists\Components\TextEntry::make('index'.$key)->label($index['index_formatted']), +// Infolists\Components\TextEntry::make('require'.$key)->label($index['require_value_formatted']), +// Infolists\Components\TextEntry::make('current'.$key)->label($index['current_value_formatted']), +// Infolists\Components\TextEntry::make('result'.$key)->label($index['passed'] ? __($passTransKey) : __($notPassTransKey)), +// ]); +// } +// +// +// return $result; +// } + public static function getEloquentQuery(): Builder { return parent::getEloquentQuery()->with(['user', 'exam']); diff --git a/app/Filament/Resources/User/ExamUserResource/Pages/ViewExamUser.php b/app/Filament/Resources/User/ExamUserResource/Pages/ViewExamUser.php index 9996eb13..0c77a00c 100644 --- a/app/Filament/Resources/User/ExamUserResource/Pages/ViewExamUser.php +++ b/app/Filament/Resources/User/ExamUserResource/Pages/ViewExamUser.php @@ -15,7 +15,7 @@ class ViewExamUser extends ViewRecord { protected static string $resource = ExamUserResource::class; - protected static string $view = 'filament.resources.user.exam-user-resource.pages.detail'; +// protected static string $view = 'filament.resources.user.exam-user-resource.pages.detail'; private function getDetailCardData(): array { diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index 49fe9bee..ad5dde5e 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -14,6 +14,7 @@ use App\Models\Snatch; use App\Models\User; use App\Models\UserBanLog; use App\Models\UserMeta; +use App\Models\UserModifyLog; use App\Models\UsernameChangeLog; use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; @@ -286,13 +287,11 @@ class UserRepository extends BaseRepository 'new' => $formatSize ? mksize($new) : $new, 'reason' => $reason, ], 'en'); - $modCommentText = date('Y-m-d') . " - $modCommentText"; do_log("user: $uid, $modCommentText", 'alert'); $update = [ $sourceField => $new, - 'modcomment' => NexusDB::raw("if(modcomment = '', '$modCommentText', concat_ws('\n', '$modCommentText', modcomment))"), +// 'modcomment' => NexusDB::raw("if(modcomment = '', '$modCommentText', concat_ws('\n', '$modCommentText', modcomment))"), ]; - $locale = $targetUser->locale; $fieldLabel = nexus_trans("user.labels.$sourceField", [], $locale); $msg = nexus_trans('message.field_value_change_message_body', [ @@ -309,7 +308,7 @@ class UserRepository extends BaseRepository 'msg' => $msg, 'added' => Carbon::now(), ]; - NexusDB::transaction(function () use ($uid, $sourceField, $old, $new, $update, $message) { + NexusDB::transaction(function () use ($uid, $sourceField, $old, $new, $update, $message, $modCommentText) { $affectedRows = User::query() ->where('id', $uid) ->where($sourceField, $old) @@ -319,6 +318,12 @@ class UserRepository extends BaseRepository throw new \RuntimeException("Change fail, affected rows != 1($affectedRows)"); } Message::query()->insert($message); + UserModifyLog::query()->insert([ + 'user_id' => $uid, + 'content' => $modCommentText, + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]); }); $this->clearCache($targetUser); return true; diff --git a/include/constants.php b/include/constants.php index 557b38b2..8dab6281 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ cache_value($cacheKey, $toApprovalCounts, 60); } if ($toApprovalCounts) { - msgalert('/nexusphp/seed-box-records?tableFilters[status][value]=0', sprintf($lang_functions['text_seed_box_record_to_approval'], is_or_are($toApprovalCounts), $toApprovalCounts, add_s($toApprovalCounts)), 'darkred'); + msgalert('/nexusphp/system/seed-box-records?tableFilters[status][value]=0', sprintf($lang_functions['text_seed_box_record_to_approval'], is_or_are($toApprovalCounts), $toApprovalCounts, add_s($toApprovalCounts)), 'darkred'); } } diff --git a/lang/chs/lang_shoutbox.php b/lang/chs/lang_shoutbox.php index cb65e5b9..c674a7b8 100644 --- a/lang/chs/lang_shoutbox.php +++ b/lang/chs/lang_shoutbox.php @@ -10,6 +10,7 @@ $lang_shoutbox = array 'text_ago' => "前", 'text_helpbox_disabled' => "求助区当前关闭中。你在搞什么鬼?", 'text_no_permission_to_shoutbox' => "你没有在群聊区发言的权力。你在搞什么鬼?", + "speaking_too_often" => "不要刷屏!", ); ?> diff --git a/lang/cht/lang_shoutbox.php b/lang/cht/lang_shoutbox.php index 9f667552..7725a173 100644 --- a/lang/cht/lang_shoutbox.php +++ b/lang/cht/lang_shoutbox.php @@ -10,6 +10,7 @@ $lang_shoutbox = array 'text_ago' => "前", 'text_helpbox_disabled' => "求助區當前關閉中。你在搞什麼鬼?", 'text_no_permission_to_shoutbox' => "你沒有在群聊區發言的權力。你在搞什麼鬼?", + "speaking_too_often" => "不要刷屏!", ); ?> diff --git a/lang/en/lang_shoutbox.php b/lang/en/lang_shoutbox.php index fadb328d..bb373870 100644 --- a/lang/en/lang_shoutbox.php +++ b/lang/en/lang_shoutbox.php @@ -10,6 +10,7 @@ $lang_shoutbox = array 'text_ago' => " ago", 'text_helpbox_disabled' => "Helpbox is currently disabled. How the hell do you get here?", 'text_no_permission_to_shoutbox' => "You have no permission to send messages to shoutbox. How the hell do you get here?", + "speaking_too_often" => "Speaking too often!", ); ?> diff --git a/public/modtask.php b/public/modtask.php index 3c44c244..bbb58245 100644 --- a/public/modtask.php +++ b/public/modtask.php @@ -88,11 +88,12 @@ if ($action == "edituser") $updateset[] = "supportfor = " . sqlesc($supportfor); $updateset[] = "supportlang = ".sqlesc($supportlang); $banLog = []; + $userModifyLogs = []; - if(!user_can('cruprfmanage')) - { - $modcomment = $arr["modcomment"]; - } +// if(!user_can('cruprfmanage')) +// { +// $modcomment = $arr["modcomment"]; +// } if(user_can('cruprfmanage')) { $email = $_POST["email"]; @@ -108,15 +109,17 @@ if ($action == "edituser") $added = sqlesc(date("Y-m-d H:i:s")); if ($arr['email'] != $email){ $updateset[] = "email = " . sqlesc($email); - $modcomment = date("Y-m-d") . " - Email changed from $arr[email] to $email by {$CURUSER['username']}.\n". $modcomment; +// $modcomment = date("Y-m-d") . " - Email changed from $arr[email] to $email by {$CURUSER['username']}.\n". $modcomment; + $userModifyLogs[] = "Email changed from $arr[email] to $email by {$CURUSER['username']}."; $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_email_change']); $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_email_changed_from'].$arr['email'].$lang_modtask_target[get_user_lang($userid)]['msg_to_new'] . $email .$lang_modtask_target[get_user_lang($userid)]['msg_by'].$CURUSER['username']); sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__); } if ($arr['username'] != $username){ $updateset[] = "username = " . sqlesc($username); - $modcomment = date("Y-m-d") . " - Username changed from {$arr['username']} to $username by {$CURUSER['username']}.\n". $modcomment; - $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_username_change']); +// $modcomment = date("Y-m-d") . " - Username changed from {$arr['username']} to $username by {$CURUSER['username']}.\n". $modcomment; + $userModifyLogs[] = "Username changed from {$arr['username']} to $username by {$CURUSER['username']}"; + $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_username_change']); $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_username_changed_from'].$arr['username'].$lang_modtask_target[get_user_lang($userid)]['msg_to_new'] . $username .$lang_modtask_target[get_user_lang($userid)]['msg_by'].$CURUSER['username']); sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__); $changeLog = [ @@ -183,7 +186,8 @@ if ($action == "edituser") $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_donor_status_changed_by'].$CURUSER['username']); $added = sqlesc(date("Y-m-d H:i:s")); sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__); - $modcomment = date("Y-m-d") . " - donor status changed by {$CURUSER['username']}. Current donor status: $donor \n". $modcomment; +// $modcomment = date("Y-m-d") . " - donor status changed by {$CURUSER['username']}. Current donor status: $donor \n". $modcomment; + $userModifyLogs[] = "donor status changed by {$CURUSER['username']}. Current donor status: $donor"; } } @@ -228,7 +232,8 @@ if ($action == "edituser") $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_vip_status_changed_by'].$CURUSER['username']); $added = sqlesc(date("Y-m-d H:i:s")); sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, $userid, $subject, $msg, $added)") or sqlerr(__FILE__, __LINE__); - $modcomment = date("Y-m-d") . " - VIP status changed by {$CURUSER['username']}. VIP added: ".$vip_added.($vip_added == 'yes' ? "; VIP until: ".$vip_until : "").".\n". $modcomment; +// $modcomment = date("Y-m-d") . " - VIP status changed by {$CURUSER['username']}. VIP added: ".$vip_added.($vip_added == 'yes' ? "; VIP until: ".$vip_until : "").".\n". $modcomment; + $userModifyLogs[] = "VIP status changed by {$CURUSER['username']}. VIP added: ".$vip_added.($vip_added == 'yes' ? "; VIP until: ".$vip_until : ""); } if ($warned && $curwarned != $warned) @@ -238,7 +243,8 @@ if ($action == "edituser") if ($warned == 'no') { - $modcomment = date("Y-m-d") . " - Warning removed by {$CURUSER['username']}.\n". $modcomment; +// $modcomment = date("Y-m-d") . " - Warning removed by {$CURUSER['username']}.\n". $modcomment; + $userModifyLogs[] = "Warning removed by {$CURUSER['username']}"; $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_warn_removed']); $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_warning_removed_by'] . $CURUSER['username'] . "."); } @@ -250,14 +256,17 @@ if ($action == "edituser") { if ($warnlength == 255) { - $modcomment = date("Y-m-d") . " - Warned by " . $CURUSER['username'] . ".\nReason: $warnpm.\n". $modcomment; +// $modcomment = date("Y-m-d") . " - Warned by " . $CURUSER['username'] . ".\nReason: $warnpm.\n". $modcomment; + $userModifyLogs[] = "Warned by " . $CURUSER['username'] . ".\nReason: $warnpm."; + $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_you_are_warned_by'].$CURUSER['username']."." . ($warnpm ? $lang_modtask_target[get_user_lang($userid)]['msg_reason'].$warnpm : "")); $updateset[] = "warneduntil = null"; }else{ $warneduntil = date("Y-m-d H:i:s",(strtotime(date("Y-m-d H:i:s")) + $warnlength * 604800)); $dur = $warnlength . $lang_modtask_target[get_user_lang($userid)]['msg_week'] . ($warnlength > 1 ? $lang_modtask_target[get_user_lang($userid)]['msg_s'] : ""); $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_you_are_warned_for'].$dur.$lang_modtask_target[get_user_lang($userid)]['msg_by'] . $CURUSER['username'] . "." . ($warnpm ? $lang_modtask_target[get_user_lang($userid)]['msg_reason'].$warnpm : "")); - $modcomment = date("Y-m-d") . " - Warned for $dur by " . $CURUSER['username'] . ".\nReason: $warnpm.\n". $modcomment; +// $modcomment = date("Y-m-d") . " - Warned for $dur by " . $CURUSER['username'] . ".\nReason: $warnpm.\n". $modcomment; + $userModifyLogs[] = "Warned for $dur by " . $CURUSER['username'] . ".Reason: $warnpm"; $updateset[] = "warneduntil = '$warneduntil'"; } $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_you_are_warned']); @@ -290,11 +299,13 @@ if ($action == "edituser") // } if ($arr['noad'] != $noad){ $updateset[]='noad = '.sqlesc($noad); - $modcomment = date("Y-m-d") . " - No Ad set to ".$noad." by ". $CURUSER['username']. ".\n". $modcomment; +// $modcomment = date("Y-m-d") . " - No Ad set to ".$noad." by ". $CURUSER['username']. ".\n". $modcomment; + $userModifyLogs[] = "No Ad set to ".$noad." by ". $CURUSER['username']; } if ($arr['noaduntil'] != $noaduntil){ $updateset[]='noaduntil = '.sqlesc($noaduntil); - $modcomment = date("Y-m-d") . " - No Ad Until set to ".$noaduntil." by ". $CURUSER['username']. ".\n". $modcomment; +// $modcomment = date("Y-m-d") . " - No Ad Until set to ".$noaduntil." by ". $CURUSER['username']. ".\n". $modcomment; + $userModifyLogs[] = "No Ad Until set to ".$noaduntil." by ". $CURUSER['username']; } if ($privacy == "low" OR $privacy == "normal" OR $privacy == "strong") $updateset[] = "privacy = " . sqlesc($privacy); @@ -308,7 +319,8 @@ if ($action == "edituser") { if ($forumpost == 'yes') { - $modcomment = date("Y-m-d") . " - Posting enabled by " . $CURUSER['username'] . ".\n" . $modcomment; +// $modcomment = date("Y-m-d") . " - Posting enabled by " . $CURUSER['username'] . ".\n" . $modcomment; + $userModifyLogs[] = "Posting enabled by " . $CURUSER['username']; $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_posting_rights_restored']); $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_posting_rights_restored']. $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_you_can_post']); $added = sqlesc(date("Y-m-d H:i:s")); @@ -316,7 +328,8 @@ if ($action == "edituser") } else { - $modcomment = date("Y-m-d") . " - Posting disabled by " . $CURUSER['username'] . ".\n" . $modcomment; +// $modcomment = date("Y-m-d") . " - Posting disabled by " . $CURUSER['username'] . ".\n" . $modcomment; + $userModifyLogs[] = "Posting disabled by " . $CURUSER['username']; $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_posting_rights_removed']); $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_posting_rights_removed'] . $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_probable_reason']); $added = sqlesc(date("Y-m-d H:i:s")); @@ -327,7 +340,8 @@ if ($action == "edituser") { if ($uploadpos == 'yes') { - $modcomment = date("Y-m-d") . " - Upload enabled by " . $CURUSER['username'] . ".\n" . $modcomment; +// $modcomment = date("Y-m-d") . " - Upload enabled by " . $CURUSER['username'] . ".\n" . $modcomment; + $userModifyLogs[] = "Upload enabled by " . $CURUSER['username']; $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_upload_rights_restored']); $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_upload_rights_restored'] . $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_you_upload_can_upload']); $added = sqlesc(date("Y-m-d H:i:s")); @@ -335,7 +349,8 @@ if ($action == "edituser") } else { - $modcomment = date("Y-m-d") . " - Upload disabled by " . $CURUSER['username'] . ".\n" . $modcomment; +// $modcomment = date("Y-m-d") . " - Upload disabled by " . $CURUSER['username'] . ".\n" . $modcomment; + $userModifyLogs[] = "Upload disabled by " . $CURUSER['username']; $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_upload_rights_removed']); $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_upload_rights_removed'] . $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_probably_reason_two']); $added = sqlesc(date("Y-m-d H:i:s")); @@ -346,7 +361,8 @@ if ($action == "edituser") { if ($downloadpos == 'yes') { - $modcomment = date("Y-m-d") . " - Download enabled by " . $CURUSER['username'] . ".\n" . $modcomment; +// $modcomment = date("Y-m-d") . " - Download enabled by " . $CURUSER['username'] . ".\n" . $modcomment; + $userModifyLogs[] = "Download enabled by " . $CURUSER['username']; $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_download_rights_restored']); $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_download_rights_restored']. $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_you_can_download']); $added = sqlesc(date("Y-m-d H:i:s")); @@ -354,7 +370,8 @@ if ($action == "edituser") } else { - $modcomment = date("Y-m-d") . " - Download disabled by " . $CURUSER['username'] . ".\n" . $modcomment; +// $modcomment = date("Y-m-d") . " - Download disabled by " . $CURUSER['username'] . ".\n" . $modcomment; + $userModifyLogs[] = "Download disabled by " . $CURUSER['username']; $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_download_rights_removed']); $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_your_download_rights_removed'] . $CURUSER['username'] . $lang_modtask_target[get_user_lang($userid)]['msg_probably_reason_three']); $added = sqlesc(date("Y-m-d H:i:s")); @@ -362,11 +379,23 @@ if ($action == "edituser") } } - $updateset[] = "modcomment = " . sqlesc($modcomment); +// $updateset[] = "modcomment = " . sqlesc($modcomment); sql_query("UPDATE users SET " . implode(", ", $updateset) . " WHERE id=$userid") or sqlerr(__FILE__, __LINE__); if (!empty($banLog)) { \App\Models\UserBanLog::query()->insert($banLog); } + if (!empty($userModifyLogs)) { + $userModifyLogsInsert = []; + foreach ($userModifyLogs as $userModifyLog) { + $userModifyLogsInsert[] = [ + "user_id" => $userid, + "content" => $userModifyLog, + "created_at" => date("Y-m-d H:i:s"), + "updated_at" => date("Y-m-d H:i:s"), + ]; + } + \App\Models\UserModifyLog::query()->insert($userModifyLogsInsert); + } clear_user_cache($userid, $userInfo->passkey); $returnto = htmlspecialchars($_POST["returnto"]); header("Location: " . get_protocol_prefix() . "$BASEURL/$returnto"); diff --git a/public/shoutbox.php b/public/shoutbox.php index 72262de0..a44da2fa 100644 --- a/public/shoutbox.php +++ b/public/shoutbox.php @@ -89,7 +89,12 @@ else } $date=sqlesc(time()); $text=trim($_GET["shbox_text"]); - + if ($userid > 0) { + $lockRes = \Nexus\Database\NexusDB::redis()->set($userid, 1, ['nx', 'ex'=>60]); + if ($lockRes !== true){ + die($lang_shoutbox['speaking_too_often']); + } + } sql_query("INSERT INTO shoutbox (userid, date, text, type) VALUES (" . sqlesc($userid) . ", $date, " . sqlesc($text) . ", ".sqlesc($type).")") or sqlerr(__FILE__, __LINE__); print ""; } diff --git a/public/userdetails.php b/public/userdetails.php index 1798f09f..d60d1cdf 100644 --- a/public/userdetails.php +++ b/public/userdetails.php @@ -501,6 +501,7 @@ if (user_can('prfmanage') && $user["class"] < get_user_class()) ->orderBy("id", "desc") ->limit(20) ->get() + ->map(fn ($item) => sprintf("%s - %s", $item->created_at->format("Y-m-d"), $item->content)) ->implode("content", "\n") ; tr($lang_userdetails['row_comment'], "", 1);