improve userdetails page claim btn display

This commit is contained in:
xiaomlove
2022-09-06 20:56:08 +08:00
parent fb329f72cc
commit 0e7b5adf76
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<?php <?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.24'); 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('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP"); defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org"); defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
+5 -3
View File
@@ -11,6 +11,7 @@ header("Pragma: no-cache" );
$torrentRep = new \App\Repositories\TorrentRepository(); $torrentRep = new \App\Repositories\TorrentRepository();
$claimRep = new \App\Repositories\ClaimRepository(); $claimRep = new \App\Repositories\ClaimRepository();
$claimTorrentTTL = \App\Models\Claim::getConfigTorrentTTL();
$id = intval($_GET['userid'] ?? 0); $id = intval($_GET['userid'] ?? 0);
$type = $_GET['type']; $type = $_GET['type'];
if (!in_array($type,array('uploaded','seeding','leeching','completed','incomplete'))) 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') function maketable($res, $mode = 'seeding')
{ {
global $lang_getusertorrentlistajax,$CURUSER,$smalldescription_main, $lang_functions, $id; global $lang_getusertorrentlistajax,$CURUSER,$smalldescription_main, $lang_functions, $id;
global $torrentRep, $claimRep; global $torrentRep, $claimRep, $claimTorrentTTL;
$showActionClaim = false; $showActionClaim = false;
switch ($mode) 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>"; $ret .= "<td class=\"rowfollow\" align=\"center\">"."". str_replace("&nbsp;", "<br />", gettime($arr['completedat'],false)). "</td>";
if ($showanonymous) if ($showanonymous)
$ret .= "<td class=\"rowfollow\" align=\"center\">".$arr['anonymous']."</td>"; $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']); $claim = $claimData->get($arr['torrent']);
$claimButton = $claimRep->buildActionButtons($arr['torrent'], $claim); $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"; $ret .="</tr>\n";
} }