mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
searchbox add size+seeders+leechers+times_completed+added
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ class TorrentOperationLogResource extends Resource
|
||||
->label(__('label.created_at'))
|
||||
,
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
->filters([
|
||||
Tables\Filters\Filter::make('uid')
|
||||
->form([
|
||||
|
||||
@@ -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}]");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
Filament::registerNavigationGroups([
|
||||
'User',
|
||||
'Torrent',
|
||||
'Role & Permission',
|
||||
'Other',
|
||||
'Section',
|
||||
'System',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.0');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-12-19');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-12-20');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -6200,21 +6200,25 @@ TD;
|
||||
return $html;
|
||||
}
|
||||
|
||||
function datetimepicker_input($name, $value = '', $label = '')
|
||||
function datetimepicker_input($name, $value = '', $label = '', array $options = [])
|
||||
{
|
||||
\Nexus\Nexus::css('vendor/jquery-datetimepicker/jquery.datetimepicker.min.css', 'footer', true);
|
||||
\Nexus\Nexus::js('vendor/jquery-datetimepicker/jquery.datetimepicker.full.min.js', 'footer', true);
|
||||
$id = "datetime-picker-$name";
|
||||
$input = sprintf('%s<input type="text" id="%s" name="%s" value="%s" autocomplete="off" >', $label, $id, $name, $value);
|
||||
$lang = get_langfolder_cookie(true);
|
||||
if ($lang == 'zh_CN') {
|
||||
$lang = 'zh';
|
||||
}
|
||||
$lang = str_replace('_', '-', $lang);
|
||||
$js = <<<JS
|
||||
jQuery.datetimepicker.setLocale('{$lang}');
|
||||
$js = '';
|
||||
if (!empty($options['require_files'])) {
|
||||
\Nexus\Nexus::css('vendor/jquery-datetimepicker/jquery.datetimepicker.min.css', 'footer', true);
|
||||
\Nexus\Nexus::js('vendor/jquery-datetimepicker/jquery.datetimepicker.full.min.js', 'footer', true);
|
||||
$js = "jQuery.datetimepicker.setLocale('{$lang}');";
|
||||
}
|
||||
$id = "datetime-picker-$name";
|
||||
$input = sprintf('%s<input type="text" id="%s" name="%s" value="%s" autocomplete="off" style="%s">', $label, $id, $name, $value, $options['style'] ?? '');
|
||||
$format = $options['format'] ?? 'Y-m-d H:i';
|
||||
$js .= <<<JS
|
||||
jQuery("#{$id}").datetimepicker({
|
||||
format: 'Y-m-d H:i'
|
||||
format: '{$format}'
|
||||
})
|
||||
JS;
|
||||
\Nexus\Nexus::js($js, 'footer', false);
|
||||
|
||||
@@ -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' => '发布时间范围:',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -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' => '發布時間範圍:',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -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:',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -198,7 +198,7 @@ else {
|
||||
$options[] = "<option" . (($row["pos_state"] == $key) ? " selected=\"selected\"" : "" ) . " value=\"" . $key . "\">".$value['text']."</option>";
|
||||
}
|
||||
$pickcontent .= "<b>".$lang_edit['row_torrent_position'].": </b>"."<select name=\"pos_state\" style=\"width: 100px;\">" . implode('', $options) . "</select> ";
|
||||
$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))
|
||||
{
|
||||
|
||||
@@ -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
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<font class="medium"><?php echo $lang_torrents['text_show_special_torrents'] ?></font>
|
||||
@@ -1020,11 +1051,6 @@ if ($allsec != 1 || $enablespecial != 'yes'){ //do not print searchbox if showin
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<font class="medium"><?php echo $lang_torrents['text_show_bookmarked'] ?></font>
|
||||
@@ -1040,11 +1066,6 @@ if ($allsec != 1 || $enablespecial != 'yes'){ //do not print searchbox if showin
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($showApprovalStatusFilter) {?>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<font class="medium"><?php echo $lang_torrents['text_approval_status'] ?></font>
|
||||
@@ -1063,6 +1084,65 @@ if ($allsec != 1 || $enablespecial != 'yes'){ //do not print searchbox if showin
|
||||
</td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<font class="medium"><?php echo $lang_torrents['size_range'] ?></font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<input type="number" min="1" name="size_begin" style="width: <?php echo $filterInputWidth?>px" value="<?php echo htmlspecialchars($_GET['size_begin'] ?? '') ?>"/> ~ <input type="number" min="1" name="size_end" style="width: <?php echo $filterInputWidth?>px" value="<?php echo htmlspecialchars($_GET['size_end'] ?? '') ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<font class="medium"><?php echo $lang_torrents['leechers_range'] ?></font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<input type="number" min="1" name="leechers_begin" style="width: <?php echo $filterInputWidth?>px" value="<?php echo htmlspecialchars($_GET['leechers_begin'] ?? '') ?>"/> ~ <input type="number" min="1" name="leechers_end" style="width: <?php echo $filterInputWidth?>px" value="<?php echo htmlspecialchars($_GET['leechers_end'] ?? '') ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<font class="medium"><?php echo $lang_torrents['seeders_range'] ?></font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<input type="number" min="1" name="seeders_begin" style="width: <?php echo $filterInputWidth?>px" value="<?php echo htmlspecialchars($_GET['seeders_begin'] ?? '') ?>"/> ~ <input type="number" min="1" name="seeders_end" style="width: <?php echo $filterInputWidth?>px" value="<?php echo htmlspecialchars($_GET['seeders_end'] ?? '') ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<font class="medium"><?php echo $lang_torrents['times_completed_range'] ?></font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<input type="number" min="1" name="times_completed_begin" style="width: <?php echo $filterInputWidth?>px" value="<?php echo htmlspecialchars($_GET['times_completed_begin'] ?? '') ?>"/> ~ <input type="number" min="1" name="times_completed_end" style="width: <?php echo $filterInputWidth?>px" value="<?php echo htmlspecialchars($_GET['times_completed_end'] ?? '') ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<font class="medium"><?php echo $lang_torrents['added_range'] ?></font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bottom" style="padding: 1px;padding-left: 10px">
|
||||
<?php echo sprintf(
|
||||
'%s ~ %s',
|
||||
datetimepicker_input('added_begin', htmlspecialchars($_GET['added_begin'] ?? ''), '', ['require_files' => 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']),
|
||||
) ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -205,7 +205,7 @@ JS;
|
||||
$options[] = "<option" . (($row["pos_state"] == $key) ? " selected=\"selected\"" : "" ) . " value=\"" . $key . "\">".$value['text']."</option>";
|
||||
}
|
||||
$pickcontent .= "<b>".$lang_edit['row_torrent_position'].": </b>"."<select name=\"pos_state\" style=\"width: 100px;\">" . implode('', $options) . "</select> ";
|
||||
$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))
|
||||
{
|
||||
|
||||
@@ -188,7 +188,7 @@ if ($action){
|
||||
."<br /><input type=checkbox name=commentpm" . ($CURUSER["commentpm"] == "yes" ? " checked" : "") . " value=yes> ".$lang_usercp['checkbox_pm_on_comments']
|
||||
;
|
||||
foreach (\App\Models\User::$notificationOptions as $option) {
|
||||
$pmY .= sprintf('<br /><input type="checkbox" name="notifs[%s]"%s value="yes" /> %s', $option, str_contains($CURUSER['notifs'], "[{$option}]") == "yes" ? " checked" : "", $lang_usercp["checkbox_pm_on_{$option}"]);
|
||||
$pmY .= sprintf('<br /><input type="checkbox" name="notifs[%s]"%s value="yes" /> %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);
|
||||
|
||||
|
||||
@@ -12,4 +12,5 @@ return [
|
||||
'unselect_all' => 'Unselect all',
|
||||
'increment' => 'increment',
|
||||
'decrement' => 'decrement',
|
||||
'action' => 'Action',
|
||||
];
|
||||
|
||||
@@ -12,4 +12,5 @@ return [
|
||||
'unselect_all' => '全不選',
|
||||
'increment' => '增加',
|
||||
'decrement' => '減少',
|
||||
'action' => '操作',
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user