h?"-":"",g=parseFloat(h);if(isNaN(g))return $a(h);g=g.toFixed(c);h=Math.abs(g);g=parseInt(h,10);h=c?b+(h-g).toFixed(c).substring(2):"";0===g&&0===parseFloat(h)&&(f="");return f+(d||"")+g.toString().replace(/\B(?=(\d{3})+(?!\d))/g,a)+h+(e||"")}}},text:function(){return{display:$a,filter:$a}}};
+l.extend(u.ext.internal,{_fnExternApiFunc:lc,_fnBuildAjax:Qa,_fnAjaxUpdate:Kb,_fnAjaxParameters:Tb,_fnAjaxUpdateDraw:Ub,_fnAjaxDataSrc:za,_fnAddColumn:cb,_fnColumnOptions:Ia,_fnAdjustColumnSizing:sa,_fnVisibleToColumnIndex:ta,_fnColumnIndexToVisible:ua,_fnVisbleColumns:na,_fnGetColumns:Ka,_fnColumnTypes:eb,_fnApplyColumnDefs:Hb,_fnHungarianMap:E,_fnCamelToHungarian:P,_fnLanguageCompat:la,_fnBrowserDetect:Fb,_fnAddData:ia,_fnAddTr:La,_fnNodeToDataIndex:function(a,b){return b._DT_RowIndex!==q?b._DT_RowIndex:
+null},_fnNodeToColumnIndex:function(a,b,c){return l.inArray(c,a.aoData[b].anCells)},_fnGetCellData:T,_fnSetCellData:Ib,_fnSplitObjNotation:hb,_fnGetObjectDataFn:ma,_fnSetObjectDataFn:ha,_fnGetDataMaster:ib,_fnClearTable:Ma,_fnDeleteIndex:Na,_fnInvalidate:va,_fnGetRowElements:gb,_fnCreateTr:fb,_fnBuildHead:Jb,_fnDrawHead:xa,_fnDraw:ja,_fnReDraw:ka,_fnAddOptionsHtml:Mb,_fnDetectHeader:wa,_fnGetUniqueThs:Pa,_fnFeatureHtmlFilter:Ob,_fnFilterComplete:ya,_fnFilterCustom:Xb,_fnFilterColumn:Wb,_fnFilter:Vb,
+_fnFilterCreateSearch:nb,_fnEscapeRegex:ob,_fnFilterData:Yb,_fnFeatureHtmlInfo:Rb,_fnUpdateInfo:ac,_fnInfoMacros:bc,_fnInitialise:Aa,_fnInitComplete:Ra,_fnLengthChange:pb,_fnFeatureHtmlLength:Nb,_fnFeatureHtmlPaginate:Sb,_fnPageChange:Ta,_fnFeatureHtmlProcessing:Pb,_fnProcessingDisplay:V,_fnFeatureHtmlTable:Qb,_fnScrollDraw:Ja,_fnApplyToChildren:da,_fnCalculateColumnWidths:db,_fnThrottle:mb,_fnConvertToWidth:cc,_fnGetWidestNode:dc,_fnGetMaxLenString:ec,_fnStringToCss:K,_fnSortFlatten:oa,_fnSort:Lb,
+_fnSortAria:gc,_fnSortListener:rb,_fnSortAttachListener:kb,_fnSortingClasses:Va,_fnSortData:fc,_fnSaveState:Da,_fnLoadState:hc,_fnImplementState:tb,_fnSettingsFromNode:Wa,_fnLog:ea,_fnMap:Y,_fnBindAction:sb,_fnCallbackReg:R,_fnCallbackFire:F,_fnLengthOverflow:qb,_fnRenderer:lb,_fnDataSource:Q,_fnRowAttributes:jb,_fnExtend:ub,_fnCalculateEnd:function(){}});l.fn.dataTable=u;u.$=l;l.fn.dataTableSettings=u.settings;l.fn.dataTableExt=u.ext;l.fn.DataTable=function(a){return l(this).dataTable(a).api()};
+l.each(u,function(a,b){l.fn.DataTable[a]=b});return u});
+
+
+/*!
+ DataTables styling integration
+ ©2018 SpryMedia Ltd - datatables.net/license
+*/
+(function(c){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return c(a,window,document)}):"object"===typeof exports?module.exports=function(a,b){a||(a=window);b&&b.fn.dataTable||(b=require("datatables.net")(a,b).$);return c(b,a,a.document)}:c(jQuery,window,document)})(function(c,a,b,d){return c.fn.dataTable});
+
+
diff --git a/public/viewpeerlist.php b/public/viewpeerlist.php
index 585a438f..813902d2 100644
--- a/public/viewpeerlist.php
+++ b/public/viewpeerlist.php
@@ -11,11 +11,11 @@ header("Content-Type: text/xml; charset=utf-8");
$id = intval($_GET['id'] ?? 0);
$seedBoxRep = new \App\Repositories\SeedBoxRepository();
-
-function get_location_column($e, $isStrongPrivacy, $canView): string
+function get_location_column($e, $isStrongPrivacy, $canView): array
{
global $enablelocation_tweak, $seedBoxRep, $lang_functions, $lang_viewpeerlist;
$address = $ips = [];
+ $isSeedBox = false;
//First, build the location
if ($enablelocation_tweak == 'yes') {
if (!empty($e['ipv4'])) {
@@ -39,10 +39,12 @@ function get_location_column($e, $isStrongPrivacy, $canView): string
$location = ''.$addressStr.'
';
} else {
if (!empty($e['ipv4'])) {
- $ips[] = $e['ipv4'] . $seedBoxRep->renderIcon($e['ipv4'], $e['userid']);
+ $seedBoxIcon = $seedBoxRep->renderIcon($e['ipv4'], $e['userid']);
+ $ips[] = $e['ipv4'] . $seedBoxIcon;
}
if (!empty($e['ipv6'])) {
- $ips[] = $e['ipv6'] . $seedBoxRep->renderIcon($e['ipv6'], $e['userid']);
+ $seedBoxIcon = $seedBoxRep->renderIcon($e['ipv6'], $e['userid']);
+ $ips[] = $e['ipv6'] . $seedBoxIcon;
}
$location = ''.implode(' ', $ips).'
';
}
@@ -55,8 +57,13 @@ function get_location_column($e, $isStrongPrivacy, $canView): string
} else {
$result = $location;
}
-
- return "" . $result . "
\n";
+ if (isset($seedBoxIcon) && !empty($seedBoxIcon)) {
+ $isSeedBox = true;
+ }
+ return [
+ "td" => "" . $result . "
",
+ "is_seed_box" => $isSeedBox,
+ ];
}
function get_username_seed_box_icon($e): string
@@ -74,7 +81,7 @@ function get_username_seed_box_icon($e): string
if(isset($CURUSER))
{
-function dltable($name, $arr, $torrent)
+function dltable($name, $arr, $torrent, &$isSeedBoxCaseWhens)
{
global $lang_viewpeerlist,$viewanonymous_class,$userprofile_class,$enablelocation_tweak;
global $CURUSER;
@@ -101,7 +108,8 @@ function dltable($name, $arr, $torrent)
$now = time();
$num = 0;
$privacyData = \App\Models\User::query()->whereIn('id', array_column($arr, 'userid'))->get(['id', 'privacy'])->keyBy('id');
- foreach ($arr as $e) {
+
+ foreach ($arr as $e) {
$privacy = $privacyData->get($e['userid'])->privacy ?? '';
++$num;
@@ -112,10 +120,14 @@ function dltable($name, $arr, $torrent)
$isStrongPrivacy = $privacy == "strong" || ($torrent['anonymous'] == 'yes' && $e['userid'] == $torrent['owner']);
$canView = user_can('viewanonymous') || $e['userid'] == $CURUSER['id'];
if ($showLocationColumn) {
- $columnLocation = get_location_column($e, $isStrongPrivacy, $canView);
+ $columnLocationResult = get_location_column($e, $isStrongPrivacy, $canView);
+ $columnLocation = $columnLocationResult['td'];
+ $isSeedBox = $columnLocationResult['is_seed_box'];
} else {
$usernameSeedBoxIcon = get_username_seed_box_icon($e);
+ $isSeedBox = !empty($usernameSeedBoxIcon);
}
+ $isSeedBoxCaseWhens[$e['id']] = sprintf("when %s then %s", $e['id'], intval($isSeedBox));
if ($isStrongPrivacy) {
$columnUsername = "".$lang_viewpeerlist['text_anonymous']." ".$usernameSeedBoxIcon;
if ($canView) {
@@ -159,7 +171,7 @@ function dltable($name, $arr, $torrent)
$downloaders = array();
$seeders = array();
$torrent = \App\Models\Torrent::query()->findOrFail($id, ['id', 'seeders', 'leechers']);
- $subres = sql_query("SELECT seeder, finishedat, downloadoffset, uploadoffset, ip, ipv4, ipv6, port, uploaded, downloaded, to_go, UNIX_TIMESTAMP(started) AS st, connectable, agent, peer_id, UNIX_TIMESTAMP(last_action) AS la, userid FROM peers WHERE torrent = $id") or sqlerr();
+ $subres = sql_query("SELECT id, seeder, finishedat, downloadoffset, uploadoffset, ip, ipv4, ipv6, port, uploaded, downloaded, to_go, UNIX_TIMESTAMP(started) AS st, connectable, agent, peer_id, UNIX_TIMESTAMP(last_action) AS la, userid FROM peers WHERE torrent = $id") or sqlerr();
while ($subrow = mysql_fetch_array($subres)) {
if ($subrow["seeder"] == "yes")
$seeders[] = $subrow;
@@ -176,6 +188,7 @@ function dltable($name, $arr, $torrent)
$torrent->update($update);
do_log("[UPDATE_TORRENT_SEEDERS_LEECHERS], torrent: $id, original: " . $torrent->toJson() . ", update: " . json_encode($update));
}
+
function leech_sort($a,$b) {
$x = $a["to_go"];
$y = $b["to_go"];
@@ -199,7 +212,18 @@ function dltable($name, $arr, $torrent)
usort($seeders, "seed_sort");
usort($downloaders, "leech_sort");
- print(dltable($lang_viewpeerlist['text_seeders'], $seeders, $row));
- print(dltable($lang_viewpeerlist['text_leechers'], $downloaders, $row));
+ $isSeedBoxCaseWhens = [];
+ $seederTable = dltable($lang_viewpeerlist['text_seeders'], $seeders, $row, $isSeedBoxCaseWhens);
+ $leecherTable = dltable($lang_viewpeerlist['text_leechers'], $downloaders, $row, $isSeedBoxCaseWhens);
+ //update peer is_seed_box
+ if (!empty($isSeedBoxCaseWhens) && get_setting('seed_box.enabled') == 'yes') {
+ $sql = sprintf(
+ "update peers set is_seed_box = case id %s end where id in (%s)",
+ implode(' ', array_values($isSeedBoxCaseWhens)), implode(',', array_keys($isSeedBoxCaseWhens))
+ );
+ do_log("[IS_SEED_BOX], $sql");
+ sql_query($sql);
+ }
+ print $seederTable . $leecherTable;
}
?>
diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php
index 4dc01823..82480c32 100644
--- a/resources/lang/en/admin.php
+++ b/resources/lang/en/admin.php
@@ -67,6 +67,7 @@ return [
'grant_prop_form_prop' => 'Select prop',
'grant_prop_form_duration' => 'Duration',
'grant_prop_form_duration_help' => 'Unit: days. If left blank, the user has it permanently. Note: There is no time limit for Name Change Card, ignore this value.' ,
+ 'confirm_bulk' => 'Bulk confirm',
]
],
'exam_user' => [
@@ -87,6 +88,7 @@ return [
'bulk_action_remove_tag' => 'Remove tag',
'bulk_action_attach_tag' => 'Attach tag',
'action_approval' => 'Approval',
+ 'bulk_action_attach_tag_remove_old' => 'Also delete old tags',
],
'seed_box_record' => [
'toggle_status' => 'Change status',
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/en/pagination.php b/resources/lang/en/pagination.php
index a4c4df70..5ec3e8fb 100644
--- a/resources/lang/en/pagination.php
+++ b/resources/lang/en/pagination.php
@@ -3,4 +3,26 @@
return [
'next' => 'Next »',
'previous' => '« Previous',
+ "decimal" => "",
+ "emptyTable" => "No data available in table",
+ "info" => "Showing _START_ to _END_ of _TOTAL_ entries",
+ "infoEmpty" => "Showing 0 to 0 of 0 entries",
+ "infoFiltered" => "(filtered from _MAX_ total entries)",
+ "infoPostFix" => "",
+ "thousands" => ",",
+ "lengthMenu" => "Show _MENU_ entries",
+ "loadingRecords" => "Loading...",
+ "processing" => "",
+ "search" => "Search:",
+ "zeroRecords" => "No matching records found",
+ "paginate" => [
+ "first" => "First",
+ "last" => "Last",
+ "next" => "Next",
+ "previous" => "Previous"
+ ],
+ "aria" => [
+ "sortAscending" => ": activate to sort column ascending",
+ "sortDescending"=> ": activate to sort column descending"
+ ]
];
diff --git a/resources/lang/en/permission.php b/resources/lang/en/permission.php
index f345c7c8..45bed5b5 100644
--- a/resources/lang/en/permission.php
+++ b/resources/lang/en/permission.php
@@ -59,7 +59,11 @@ return [
],
'torrentmanage' => [
'text' => 'Torrent Management',
- 'desc' => 'Edit, delete torrents, excluding setting torrent sticky or on promotion',
+ 'desc' => 'Edit torrents, excluding setting torrent sticky or on promotion or delete',
+ ],
+ 'torrent-delete' => [
+ 'text' => 'Delete torrent',
+ 'desc' => 'Delete torrent',
],
'torrentsticky' => [
'text' => 'Torrent Sticky',
diff --git a/resources/lang/zh_CN/admin.php b/resources/lang/zh_CN/admin.php
index 1afc82db..bfb4fe9b 100644
--- a/resources/lang/zh_CN/admin.php
+++ b/resources/lang/zh_CN/admin.php
@@ -68,6 +68,7 @@ return [
'grant_prop_form_prop' => '选择道具',
'grant_prop_form_duration' => '有效时长',
'grant_prop_form_duration_help' => '单位:天。如果留空,用户永久拥有。注:改名卡没有时间限制,忽略该值。',
+ 'confirm_bulk' => '批量确认',
]
],
'exam_user' => [
@@ -88,6 +89,7 @@ return [
'bulk_action_remove_tag' => '清除标签',
'bulk_action_attach_tag' => '设置标签',
'action_approval' => '审核',
+ 'bulk_action_attach_tag_remove_old' => '同时删除旧标签',
],
'seed_box_record' => [
'toggle_status' => '更改状态',
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_CN/pagination.php b/resources/lang/zh_CN/pagination.php
index e13e0403..5a0a85a5 100644
--- a/resources/lang/zh_CN/pagination.php
+++ b/resources/lang/zh_CN/pagination.php
@@ -3,4 +3,26 @@
return [
'next' => '下一页 »',
'previous' => '« 上一页',
+ "decimal" => "",
+ "emptyTable" => "无数据",
+ "info" => "当前展示第 _START_ 至第 _END_ 条,共 _TOTAL_ 条记录",
+ "infoEmpty" => "当前展示第 0 条至第 0 条,共 0 条记录",
+ "infoFiltered" => "(筛选自 _MAX_ 条记录)",
+ "infoPostFix" => "",
+ "thousands" => ",",
+ "lengthMenu" => "每页展示 _MENU_ 条记录",
+ "loadingRecords" => "加载中...",
+ "processing" => "",
+ "search" => "搜索:",
+ "zeroRecords" => "没有发现任何匹配的记录",
+ "paginate" => [
+ "first" => "首页",
+ "last" => "尾页",
+ "next" => "下一页",
+ "previous" => "上一页"
+ ],
+ "aria" => [
+ "sortAscending" => ": 升序排序",
+ "sortDescending"=> ": 降序排序"
+ ]
];
diff --git a/resources/lang/zh_CN/permission.php b/resources/lang/zh_CN/permission.php
index c6e4645c..5987a378 100644
--- a/resources/lang/zh_CN/permission.php
+++ b/resources/lang/zh_CN/permission.php
@@ -61,6 +61,10 @@ return [
'text' => '管理种子',
'desc' => '编辑、删除种子,但不能将种子设为置顶或促销',
],
+ 'torrent-delete' => [
+ 'text' => '删除种子',
+ 'desc' => '删除种子',
+ ],
'torrentsticky' => [
'text' => '设定种子置顶',
'desc' => '将种子设为置顶',
diff --git a/resources/lang/zh_TW/admin.php b/resources/lang/zh_TW/admin.php
index 5ad4a52c..c46b91fd 100644
--- a/resources/lang/zh_TW/admin.php
+++ b/resources/lang/zh_TW/admin.php
@@ -67,6 +67,7 @@ return [
'grant_prop_form_prop' => '選擇道具',
'grant_prop_form_duration' => '有效時長',
'grant_prop_form_duration_help' => '單位:天。如果留空,用戶永久擁有。註:改名卡沒有時間限製,忽略該值。',
+ 'confirm_bulk' => '批量確認',
]
],
'exam_user' => [
@@ -87,6 +88,7 @@ return [
'bulk_action_remove_tag' => '清除標簽',
'bulk_action_attach_tag' => '設置標簽',
'action_approval' => '審核',
+ 'bulk_action_attach_tag_remove_old' => '同時刪除舊標簽',
],
'seed_box_record' => [
'toggle_status' => '更改狀態',
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' => '未認領',
];
diff --git a/resources/lang/zh_TW/pagination.php b/resources/lang/zh_TW/pagination.php
index c55a1e03..68990b58 100644
--- a/resources/lang/zh_TW/pagination.php
+++ b/resources/lang/zh_TW/pagination.php
@@ -3,4 +3,26 @@
return [
'next' => '下一頁 »',
'previous' => '« 上一頁',
+ "decimal" => "",
+ "emptyTable" => "無數據",
+ "info" => "當前展示第 _START_ 至第 _END_ 條,共 _TOTAL_ 條記錄",
+ "infoEmpty" => "當前展示第 0 條至第 0 條,共 0 條記錄",
+ "infoFiltered" => "(篩選自 _MAX_ 條記錄)",
+ "infoPostFix" => "",
+ "thousands" => ",",
+ "lengthMenu" => "每頁展示 _MENU_ 條記錄",
+ "loadingRecords" => "加載中...",
+ "processing" => "",
+ "search" => "搜索:",
+ "zeroRecords" => "沒有發現任何匹配的記錄",
+ "paginate" => [
+ "first" => "首頁",
+ "last" => "尾頁",
+ "next" => "下一頁",
+ "previous" => "上一頁"
+ ],
+ "aria" => [
+ "sortAscending" => ": 升序排序",
+ "sortDescending"=> ": 降序排序"
+ ]
];
diff --git a/resources/lang/zh_TW/permission.php b/resources/lang/zh_TW/permission.php
index 7c7f5935..642c8097 100644
--- a/resources/lang/zh_TW/permission.php
+++ b/resources/lang/zh_TW/permission.php
@@ -61,6 +61,10 @@ return [
'text' => '管理種子',
'desc' => '編輯、移除種子,但無法將種子設為置頂或促銷',
],
+ 'torrent-delete' => [
+ 'text' => '移除种子',
+ 'desc' => '移除种子',
+ ],
'torrentsticky' => [
'text' => '設定種子置頂',
'desc' => '將種子設為置頂',
diff --git a/resources/views/data-table.blade.php b/resources/views/data-table.blade.php
new file mode 100644
index 00000000..272ce939
--- /dev/null
+++ b/resources/views/data-table.blade.php
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ @stack('css')
+
+
+
+ @stack('scripts')
+
+
+
+@yield('content')
+
+