diff --git a/app/Filament/Resources/User/UserResource/Pages/UserProfile.php b/app/Filament/Resources/User/UserResource/Pages/UserProfile.php
index 7071dbc8..c447e847 100644
--- a/app/Filament/Resources/User/UserResource/Pages/UserProfile.php
+++ b/app/Filament/Resources/User/UserResource/Pages/UserProfile.php
@@ -287,8 +287,10 @@ class UserProfile extends Page
try {
if (!empty($data['duration'])) {
$data['deadline'] = now()->addDays($data['duration']);
+ } else {
+ $data['deadline'] = null;
}
- $rep->addMeta($this->record, $data);
+ $rep->addMeta($this->record, $data, $data);
$this->notify('success', 'Success!');
$this->emitSelf(self::EVENT_RECORD_UPDATED, $this->record->id);
} catch (\Exception $exception) {
diff --git a/include/constants.php b/include/constants.php
index 230be357..f6b978e2 100644
--- a/include/constants.php
+++ b/include/constants.php
@@ -1,6 +1,6 @@
".$arr['anonymous']."";
$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);
+ if (
+ $showActionClaim
+ && \App\Models\Claim::getConfigIsEnabled()
+ && \Carbon\Carbon::parse($arr['added'])->addDays($claimTorrentTTL)->lte(\Carbon\Carbon::now())
+ ) {
+ $claim = $claimData->get($arr['torrent']);
+ if ($CURUSER['id'] == $arr['userid']) {
+ $claimButton = $claimRep->buildActionButtons($arr['torrent'], $claim);
+ } else {
+ if ($claim) {
+ $claimText = nexus_trans('claim.already_claimed');
+ } else {
+ $claimText = nexus_trans('claim.not_claim_yet');
+ }
+ $claimButton = sprintf('', $claimText);
+ }
}
$ret .= sprintf('
%s | ', $claimButton);
$ret .="\n";
@@ -234,7 +247,7 @@ switch ($type)
{
// $res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__);
// $res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added FROM torrents LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id " . (($CURUSER["id"] != $id)?((!user_can('viewanonymous')) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.id DESC") or sqlerr(__FILE__, __LINE__);
- $fields = "torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added";
+ $fields = "torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added,torrents.owner as userid";
$tableWhere = "torrents LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id";
if ($CURUSER['id'] != $id && !user_can('viewanonymous')) {
$tableWhere .= " AND anonymous = 'no'";
@@ -247,7 +260,7 @@ switch ($type)
case 'seeding':
{
// $res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.id DESC") or sqlerr();
- $fields = "torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers,snatched.seedtime,snatched.uploaded";
+ $fields = "torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers,snatched.seedtime,snatched.uploaded,snatched.userid";
$tableWhere = "peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes'";
$order = "torrents.id DESC";
break;
@@ -257,7 +270,7 @@ switch ($type)
case 'leeching':
{
// $res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.id DESC") or sqlerr();
- $fields = "torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added,snatched.seedtime,snatched.uploaded";
+ $fields = "torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added,snatched.seedtime,snatched.uploaded,snatched.userid";
$tableWhere = "peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no'";
$order = "torrents.id DESC";
break;
@@ -267,7 +280,7 @@ switch ($type)
case 'completed':
{
// $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, torrents.approval_status, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.id DESC") or sqlerr();
- $fields = "torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, torrents.approval_status, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.seedtime,snatched.uploaded, snatched.leechtime, snatched.completedat";
+ $fields = "torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, torrents.approval_status, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.seedtime,snatched.uploaded, snatched.leechtime, snatched.completedat,snatched.userid";
$tableWhere = "torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND userid=$id AND torrents.owner != $id";
$order = "snatched.id DESC";
break;
@@ -277,7 +290,7 @@ switch ($type)
case 'incomplete':
{
// $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.id DESC") or sqlerr();
- $fields = "torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.downloaded, snatched.leechtime,snatched.seedtime,snatched.uploaded";
+ $fields = "torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.downloaded, snatched.leechtime,snatched.seedtime,snatched.uploaded,snatched.userid";
$tableWhere = "torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id";
$order = "snatched.id DESC";
break;
diff --git a/resources/lang/en/claim.php b/resources/lang/en/claim.php
index 9a465baa..a0f3d0e9 100644
--- a/resources/lang/en/claim.php
+++ b/resources/lang/en/claim.php
@@ -29,4 +29,6 @@ return [
'add_claim_confirm' => 'Confirm to claim?',
'remove_claim' => 'Give up',
'remove_claim_confirm' => 'Confirm to give up the claim?',
+ 'already_claimed' => 'Claimed',
+ 'not_claim_yet' => 'Unclaimed',
];
diff --git a/resources/lang/zh_CN/claim.php b/resources/lang/zh_CN/claim.php
index 925b306e..1f510b5a 100644
--- a/resources/lang/zh_CN/claim.php
+++ b/resources/lang/zh_CN/claim.php
@@ -29,4 +29,6 @@ return [
'add_claim_confirm' => '确认要认领?',
'remove_claim' => '放弃',
'remove_claim_confirm' => '确认要放弃认领?',
+ 'already_claimed' => '已认领',
+ 'not_claim_yet' => '未认领',
];
diff --git a/resources/lang/zh_TW/claim.php b/resources/lang/zh_TW/claim.php
index bfc9d19b..473e4650 100644
--- a/resources/lang/zh_TW/claim.php
+++ b/resources/lang/zh_TW/claim.php
@@ -28,4 +28,6 @@ return [
'add_claim_confirm' => '確認要認領?',
'remove_claim' => '放棄',
'remove_claim_confirm' => '確認要放棄認領?',
+ 'already_claimed' => '已認領',
+ 'not_claim_yet' => '未認領',
];