Merge branch 'php8' into section

This commit is contained in:
xiaomlove
2022-09-07 03:28:18 +08:00
9 changed files with 17 additions and 6 deletions

View File

@@ -25,6 +25,7 @@ class SearchBox extends NexusModel
const EXTRA_TAXONOMY_LABELS = 'taxonomy_labels';
const EXTRA_DISPLAY_COVER_ON_TORRENT_LIST = 'display_cover_on_torrent_list';
const EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST = 'display_seed_box_icon_on_torrent_list';
public static array $subCatFields = [
'source', 'medium', 'codec', 'audiocodec', 'team', 'standard', 'processing'
@@ -32,6 +33,7 @@ class SearchBox extends NexusModel
public static array $extras = [
self::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => ['text' => 'Display cover on torrent list'],
self::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => ['text' => 'Display seed box icon on torrent list'],
];
public static function listExtraText(): array

View File

@@ -617,7 +617,7 @@ class TorrentRepository extends BaseRepository
$input = <<<HTML
<div class="nexus-input-box" style="display: flex">
<div style="display: flex;flex-direction: column;flex-grow: 1">
<input type="text" name="$name" value="{$value}">
<input type="text" id="$name" name="$name" value="{$value}">
$note
</div>
$btn

View File

@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.24');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-09-05');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-09-06');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

View File

@@ -3320,14 +3320,17 @@ function torrenttable($rows, $variant = "torrent", $searchBoxId = 0) {
$tagKeyById = $tagCollection->keyBy('id');
$torrentTagResult = $torrentTagCollection->groupBy('torrent_id');
$showCover = false;
$showSeedBoxIcon = get_setting('seed_box.enabled') == 'yes';
if ($searchBoxId) {
$searchBoxExtra = get_searchbox_value($searchBoxId, "extra");
if (!empty($searchBoxExtra[\App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST])) {
$showCover = true;
}
if (empty($searchBoxExtra[\App\Models\SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST])) {
$showSeedBoxIcon = false;
}
}
//seedBoxIcon
$showSeedBoxIcon = get_setting('seed_box.enabled') == 'yes';
if ($showSeedBoxIcon) {
$seedBoxRep = new \App\Repositories\SeedBoxRepository();
$ownerPeerInfo = \App\Models\Peer::query()

View File

@@ -250,6 +250,7 @@ class Update extends Install
$this->runMigrate('database/migrations/2022_09_02_031539_add_extra_to_searchbox_table.php');
SearchBox::query()->update(['extra' => [
SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => 1,
SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => 1,
]]);
}

View File

@@ -11,6 +11,7 @@ header("Pragma: no-cache" );
$torrentRep = new \App\Repositories\TorrentRepository();
$claimRep = new \App\Repositories\ClaimRepository();
$claimTorrentTTL = \App\Models\Claim::getConfigTorrentTTL();
$id = intval($_GET['userid'] ?? 0);
$type = $_GET['type'];
if (!in_array($type,array('uploaded','seeding','leeching','completed','incomplete')))
@@ -21,7 +22,7 @@ if(!user_can('torrenthistory') && $id != $CURUSER["id"])
function maketable($res, $mode = 'seeding')
{
global $lang_getusertorrentlistajax,$CURUSER,$smalldescription_main, $lang_functions, $id;
global $torrentRep, $claimRep;
global $torrentRep, $claimRep, $claimTorrentTTL;
$showActionClaim = false;
switch ($mode)
{
@@ -213,11 +214,12 @@ function maketable($res, $mode = 'seeding')
$ret .= "<td class=\"rowfollow\" align=\"center\">"."". str_replace("&nbsp;", "<br />", gettime($arr['completedat'],false)). "</td>";
if ($showanonymous)
$ret .= "<td class=\"rowfollow\" align=\"center\">".$arr['anonymous']."</td>";
if ($showActionClaim) {
$claimButton = '';
if ($showActionClaim && \App\Models\Claim::getConfigIsEnabled() && \Carbon\Carbon::parse($arr['added'])->addDays($claimTorrentTTL)->lte(\Carbon\Carbon::now())) {
$claim = $claimData->get($arr['torrent']);
$claimButton = $claimRep->buildActionButtons($arr['torrent'], $claim);
$ret .= sprintf('<td class="rowfollow" align="center">%s</td>', $claimButton);
}
$ret .= sprintf('<td class="rowfollow" align="center">%s</td>', $claimButton);
$ret .="</tr>\n";
}

View File

@@ -11,5 +11,6 @@ return [
'sub_category_audio_codec_label' => 'AudioCodec',
'extras' => [
\App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => 'Display cover on torrent list',
\App\Models\SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => 'Display seed box icon on torrent list',
],
];

View File

@@ -11,5 +11,6 @@ return [
'sub_category_audio_codec_label' => '音频编码',
'extras' => [
\App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => '种子列表页展示封面',
\App\Models\SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => '种子列表页展示 SeedBox 图标',
],
];

View File

@@ -11,5 +11,6 @@ return [
'sub_category_audio_codec_label' => '音頻編碼',
'extras' => [
\App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => '種子列表頁展示封面',
\App\Models\SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => '種子列表頁展示 SeedBox 圖標',
],
];