diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index b80b23ac..ecba4594 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -95,9 +95,8 @@ class Test extends Command */ public function handle() { - $uid = "2,3,4"; - $uidArr = preg_split('/[\s,]+/', $uid); - dd($uidArr); + $rep = new WorkRepository(); + $rep->settleRole(2, null, true); } } diff --git a/app/Filament/Resources/Torrent/TorrentOperationLogResource.php b/app/Filament/Resources/Torrent/TorrentOperationLogResource.php index 253786a3..75103ac3 100644 --- a/app/Filament/Resources/Torrent/TorrentOperationLogResource.php +++ b/app/Filament/Resources/Torrent/TorrentOperationLogResource.php @@ -67,6 +67,7 @@ class TorrentOperationLogResource extends Resource ->label(__('label.created_at')) , ]) + ->defaultSort('id', 'desc') ->filters([ Tables\Filters\Filter::make('uid') ->form([ diff --git a/app/Models/User.php b/app/Models/User.php index 86b314a2..a660d641 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -567,10 +567,7 @@ class User extends Authenticatable implements FilamentUser, HasName public function acceptNotification($name): bool { - if (!isset($this->original['notifs'])) { - throw new \RuntimeException("Not fetch field: notifs"); - } - return str_contains($this->notifs, "[{$name}]"); + return is_null($this->original['notifs']) || str_contains($this->notifs, "[{$name}]"); } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 059dd8c1..2f164263 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -39,6 +39,7 @@ class AppServiceProvider extends ServiceProvider Filament::registerNavigationGroups([ 'User', 'Torrent', + 'Role & Permission', 'Other', 'Section', 'System', diff --git a/include/constants.php b/include/constants.php index 36b4c666..c9a1183b 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ ', $label, $id, $name, $value); $lang = get_langfolder_cookie(true); if ($lang == 'zh_CN') { $lang = 'zh'; } $lang = str_replace('_', '-', $lang); - $js = <<', $label, $id, $name, $value, $options['style'] ?? ''); + $format = $options['format'] ?? 'Y-m-d H:i'; + $js .= << "音乐:", 'text_software' => "软件:", 'text_approval_status' => '审核状态:', + 'size_range' => '体积范围(GB):', + 'leechers_range' => '做种人数范围:', + 'seeders_range' => '下载人数范围:', + 'times_completed_range' => '完成次数范围:', + 'added_range' => '发布时间范围:', ); ?> diff --git a/lang/cht/lang_torrents.php b/lang/cht/lang_torrents.php index 0dc2ec2b..ed69214f 100644 --- a/lang/cht/lang_torrents.php +++ b/lang/cht/lang_torrents.php @@ -59,6 +59,11 @@ $lang_torrents = array 'text_music' => "音樂:", 'text_software' => "軟件:", 'text_approval_status' => '審核狀態:', + 'size_range' => '體積範圍(GB):', + 'leechers_range' => '做種人數範圍:', + 'seeders_range' => '下載人數範圍:', + 'times_completed_range' => '完成次數範圍:', + 'added_range' => '發布時間範圍:', ); ?> diff --git a/lang/en/lang_torrents.php b/lang/en/lang_torrents.php index 026c1b3e..2e0a44cd 100644 --- a/lang/en/lang_torrents.php +++ b/lang/en/lang_torrents.php @@ -59,6 +59,11 @@ $lang_torrents = array 'text_music' => "Music:", 'text_software' => "Software:", 'text_approval_status' => 'Approval status:', + 'size_range' => 'Size range(GB):', + 'leechers_range' => 'Leechers range:', + 'seeders_range' => 'Seeders range:', + 'times_completed_range' => 'Times completed range:', + 'added_range' => 'Added range:', ); ?> diff --git a/public/edit.php b/public/edit.php index 732ed8c9..d7b9dc23 100644 --- a/public/edit.php +++ b/public/edit.php @@ -198,7 +198,7 @@ else { $options[] = "".$value['text'].""; } $pickcontent .= "".$lang_edit['row_torrent_position'].": "."   "; - $pickcontent .= datetimepicker_input('pos_state_until', $row['pos_state_until'], nexus_trans('label.deadline') . ": "); + $pickcontent .= datetimepicker_input('pos_state_until', $row['pos_state_until'], nexus_trans('label.deadline') . ": ", ['require_files' => true]); } if(user_can('torrentmanage') && ($CURUSER["picker"] == 'yes' || get_user_class() >= \App\Models\User::CLASS_SYSOP)) { diff --git a/public/torrents.php b/public/torrents.php index bfceda8f..e73caf01 100644 --- a/public/torrents.php +++ b/public/torrents.php @@ -28,6 +28,7 @@ switch (nexus()->getScript()) { $tagRep = new \App\Repositories\TagRepository(); $allTags = $tagRep->listAll($sectiontype); $elasticsearchEnabled = nexus_env('ELASTICSEARCH_ENABLED'); +$filterInputWidth = 62; $showsubcat = get_searchbox_value($sectiontype, 'showsubcat');//whether show subcategory (i.e. sources, codecs) or not $showsource = get_searchbox_value($sectiontype, 'showsource'); //whether show sources or not @@ -821,6 +822,41 @@ if ($showApprovalStatusFilter && isset($_REQUEST['approval_status']) && is_numer $wherea[] = "torrents.approval_status = " . \App\Models\Torrent::APPROVAL_STATUS_ALLOW; } +if (isset($_GET['size_begin']) && ctype_digit($_GET['size_begin'])) { + $wherea[] = "torrents.size >= " . intval($_GET['size_begin']) * 1024 * 1024 * 1024; +} +if (isset($_GET['size_end']) && ctype_digit($_GET['size_end'])) { + $wherea[] = "torrents.size <= " . intval($_GET['size_end']) * 1024 * 1024 * 1024; +} + +if (isset($_GET['seeders_begin']) && ctype_digit($_GET['seeders_begin'])) { + $wherea[] = "torrents.seeders >= " . (int)$_GET['seeders_begin']; +} +if (isset($_GET['seeders_end']) && ctype_digit($_GET['seeders_end'])) { + $wherea[] = "torrents.seeders <= " . (int)$_GET['seeders_end']; +} + +if (isset($_GET['leechers_begin']) && ctype_digit($_GET['leechers_begin'])) { + $wherea[] = "torrents.leechers >= " . (int)$_GET['leechers_begin']; +} +if (isset($_GET['leechers_end']) && ctype_digit($_GET['leechers_end'])) { + $wherea[] = "torrents.leechers <= " . (int)$_GET['leechers_end']; +} + +if (isset($_GET['times_completed_begin']) && ctype_digit($_GET['times_completed_begin'])) { + $wherea[] = "torrents.times_completed >= " . (int)$_GET['times_completed_begin']; +} +if (isset($_GET['times_completed_end']) && ctype_digit($_GET['times_completed_end'])) { + $wherea[] = "torrents.times_completed <= " . (int)$_GET['times_completed_end']; +} + +if (isset($_GET['added_begin']) && !empty($_GET['added_begin'])) { + $wherea[] = "torrents.added >= " . sqlesc($_GET['added_begin']); +} +if (isset($_GET['added_end']) && !empty($_GET['added_end'])) { + $wherea[] = "torrents.added <= " . sqlesc(\Carbon\Carbon::parse($_GET['added_end'])->endOfDay()->toDateTimeString()); +} + $where = implode(" AND ", $wherea); if ($wherecatin) @@ -1002,11 +1038,6 @@ if ($allsec != 1 || $enablespecial != 'yes'){ //do not print searchbox if showin - - -
- - @@ -1020,11 +1051,6 @@ if ($allsec != 1 || $enablespecial != 'yes'){ //do not print searchbox if showin - - -
- - @@ -1040,11 +1066,6 @@ if ($allsec != 1 || $enablespecial != 'yes'){ //do not print searchbox if showin - - -
- - @@ -1063,6 +1084,65 @@ if ($allsec != 1 || $enablespecial != 'yes'){ //do not print searchbox if showin + + + + + + + + ~ + + + + + + + + + + + ~ + + + + + + + + + + + ~ + + + + + + + + + + + ~ + + + + + + + + + + + true, 'format' => 'Y-m-d', 'style' => 'width: '.$filterInputWidth.'px']), + datetimepicker_input('added_end', htmlspecialchars($_GET['added_end'] ?? ''), '', ['require_files' => false, 'format' => 'Y-m-d', 'style' => 'width: '.$filterInputWidth.'px']), + ) ?> + + + diff --git a/public/upload.php b/public/upload.php index 3a087c79..984b305a 100644 --- a/public/upload.php +++ b/public/upload.php @@ -205,7 +205,7 @@ JS; $options[] = "".$value['text'].""; } $pickcontent .= "".$lang_edit['row_torrent_position'].": "."   "; - $pickcontent .= datetimepicker_input('pos_state_until', '', nexus_trans('label.deadline') . ": "); + $pickcontent .= datetimepicker_input('pos_state_until', '', nexus_trans('label.deadline') . ": ", ['require_files' => true]); } if(user_can('torrentmanage') && ($CURUSER["picker"] == 'yes' || get_user_class() >= \App\Models\User::CLASS_SYSOP)) { diff --git a/public/usercp.php b/public/usercp.php index 872140c8..1c1e913e 100644 --- a/public/usercp.php +++ b/public/usercp.php @@ -188,7 +188,7 @@ if ($action){ ."
".$lang_usercp['checkbox_pm_on_comments'] ; foreach (\App\Models\User::$notificationOptions as $option) { - $pmY .= sprintf('
%s', $option, str_contains($CURUSER['notifs'], "[{$option}]") == "yes" ? " checked" : "", $lang_usercp["checkbox_pm_on_{$option}"]); + $pmY .= sprintf('
%s', $option, is_null($CURUSER['notifs']) || str_contains($CURUSER['notifs'], "[{$option}]") == "yes" ? " checked" : "", $lang_usercp["checkbox_pm_on_{$option}"]); } tr_small($lang_usercp['row_pms'], $pmY,1); diff --git a/resources/lang/en/nexus.php b/resources/lang/en/nexus.php index 7c553ea8..a0ada173 100644 --- a/resources/lang/en/nexus.php +++ b/resources/lang/en/nexus.php @@ -12,4 +12,5 @@ return [ 'unselect_all' => 'Unselect all', 'increment' => 'increment', 'decrement' => 'decrement', + 'action' => 'Action', ]; diff --git a/resources/lang/zh_TW/nexus.php b/resources/lang/zh_TW/nexus.php index 4151b129..0fdcada7 100644 --- a/resources/lang/zh_TW/nexus.php +++ b/resources/lang/zh_TW/nexus.php @@ -12,4 +12,5 @@ return [ 'unselect_all' => '全不選', 'increment' => '增加', 'decrement' => '減少', + 'action' => '操作', ];