where('id', $torrentId)->first(\App\Models\Torrent::$commentFields); if (!$torrent) { stderr("Error", "Invalid torrent_id: $torrentId"); } stdhead(nexus_trans('claim.title_for_torrent')); $query = \App\Models\Claim::query()->where('torrent_id', $torrentId); $pagerParam = "?torrent_id=$torrentId"; print("

".nexus_trans('claim.title_for_torrent') . " ".htmlspecialchars($torrent['name'])."

"); } elseif (!empty($_GET['uid'])) { $uid = $_GET['uid']; int_check($uid,true); $user = \App\Models\User::query()->where('id', $uid)->first(\App\Models\User::$commonFields); if (!$user) { stderr("Error", "Invalid uid: $uid"); } stdhead(nexus_trans('claim.title_for_user')); $query = \App\Models\Claim::query()->where('uid', $uid); $pagerParam = "?uid=$uid"; print("

".nexus_trans('claim.title_for_user') . " ".htmlspecialchars($user->username)."

"); if ($uid == $CURUSER['id']) { $actionTh = sprintf("%s", nexus_trans("claim.th_action")); $actionTd = ""; $confirmMsg = nexus_trans('claim.confirm_give_up'); $removeJs = <<count(); list($pagertop, $pagerbottom, $limit, $offset, $pageSize) = pager(50, $total, "$pagerParam&"); $list = (clone $query)->with(['user', 'torrent', 'snatch'])->offset($offset)->limit($pageSize)->orderBy('id', 'desc')->get(); print(""); print(" ".$actionTh." "); $now = \Carbon\Carbon::now(); $seedTimeRequiredHours = \App\Models\Claim::getConfigStandardSeedTimeHours(); $uploadedRequiredTimes = \App\Models\Claim::getConfigStandardUploadedTimes(); foreach ($list as $row) { if ( bcsub($row->snatch->seedtime, $row->seed_time_begin) >= $seedTimeRequiredHours * 3600 || bcsub($row->snatch->uploaded, $row->uploaded_begin) >= $uploadedRequiredTimes * $row->torrent->size ) { $reached = 'Yes'; } else { $reached = 'No'; } print(" ".sprintf($actionTd, $row->id)." "); } print("
".nexus_trans('claim.th_id')." ".nexus_trans('claim.th_username')." ".nexus_trans('claim.th_torrent_name')." ".nexus_trans('claim.th_torrent_size')." ".nexus_trans('claim.th_torrent_ttl')." ".nexus_trans('claim.th_claim_at')." ".nexus_trans('claim.th_last_settle')." ".nexus_trans('claim.th_seed_time_this_month')." ".nexus_trans('claim.th_uploaded_this_month')." ".nexus_trans('claim.th_reached_or_not')."
" . $row->id . " " . $row->user->username . " " . $row->torrent->name . " " . mksize($row->torrent->size) . " " . mkprettytime($row->torrent->added->diffInSeconds($now)) . " " . format_datetime($row->created_at) . " " . format_datetime($row->last_settle_at) . " " . mkprettytime($row->snatch->seedtime - $row->seed_time_begin) . " " . mksize($row->snatch->uploaded - $row->uploaded_begin) . " " . $reached . "
"); print($pagerbottom); end_main_frame(); stdfoot();