mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
seedBox icon display with location no
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.19');
|
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.19');
|
||||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-07-23');
|
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-07-24');
|
||||||
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
||||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||||
|
|||||||
+34
-32
@@ -948,36 +948,37 @@ tr_small($lang_usercp['row_karma_points'], $CURUSER['seedbonus']." [<a href=\"my
|
|||||||
tr_small($lang_usercp['row_written_comments'], $commentcount." [<a href=\"userhistory.php?action=viewcomments&id=".$CURUSER['id']."\" title=\"".$lang_usercp['link_view_comments']."\">".$lang_usercp['text_view']."</a>]", 1);
|
tr_small($lang_usercp['row_written_comments'], $commentcount." [<a href=\"userhistory.php?action=viewcomments&id=".$CURUSER['id']."\" title=\"".$lang_usercp['link_view_comments']."\">".$lang_usercp['text_view']."</a>]", 1);
|
||||||
|
|
||||||
//start seed box
|
//start seed box
|
||||||
$seedBox = '';
|
if (get_setting('seed_box.enabled') == 'yes') {
|
||||||
$columnOperator = nexus_trans('label.seed_box_record.operator');
|
$seedBox = '';
|
||||||
$columnBandwidth = nexus_trans('label.seed_box_record.bandwidth');
|
$columnOperator = nexus_trans('label.seed_box_record.operator');
|
||||||
$columnIPBegin = nexus_trans('label.seed_box_record.ip_begin');
|
$columnBandwidth = nexus_trans('label.seed_box_record.bandwidth');
|
||||||
$columnIPEnd = nexus_trans('label.seed_box_record.ip_end');
|
$columnIPBegin = nexus_trans('label.seed_box_record.ip_begin');
|
||||||
$columnIP = nexus_trans('label.seed_box_record.ip');
|
$columnIPEnd = nexus_trans('label.seed_box_record.ip_end');
|
||||||
$columnIPHelp = nexus_trans('label.seed_box_record.ip_help');
|
$columnIP = nexus_trans('label.seed_box_record.ip');
|
||||||
$columnComment = nexus_trans('label.comment');
|
$columnIPHelp = nexus_trans('label.seed_box_record.ip_help');
|
||||||
$columnStatus = nexus_trans('label.seed_box_record.status');
|
$columnComment = nexus_trans('label.comment');
|
||||||
$res = \App\Models\SeedBoxRecord::query()->where('uid', $CURUSER['id'])->where('type', \App\Models\SeedBoxRecord::TYPE_USER)->get();
|
$columnStatus = nexus_trans('label.seed_box_record.status');
|
||||||
if ($res->count() > 0)
|
$res = \App\Models\SeedBoxRecord::query()->where('uid', $CURUSER['id'])->where('type', \App\Models\SeedBoxRecord::TYPE_USER)->get();
|
||||||
{
|
if ($res->count() > 0)
|
||||||
$seedBox .= "<table border='1' cellspacing='0' cellpadding='5' id='seed-box-table'><tr><td class='colhead'>ID</td><td class='colhead'>{$columnOperator}</td><td class='colhead'>{$columnBandwidth}</td><td class='colhead'>{$columnIP}</td><td class='colhead'>{$columnComment}</td><td class='colhead'>{$columnStatus}</td><td class='colhead'></td></tr>";
|
|
||||||
foreach ($res as $seedBoxRecord)
|
|
||||||
{
|
{
|
||||||
$seedBox .= "<tr>";
|
$seedBox .= "<table border='1' cellspacing='0' cellpadding='5' id='seed-box-table'><tr><td class='colhead'>ID</td><td class='colhead'>{$columnOperator}</td><td class='colhead'>{$columnBandwidth}</td><td class='colhead'>{$columnIP}</td><td class='colhead'>{$columnComment}</td><td class='colhead'>{$columnStatus}</td><td class='colhead'></td></tr>";
|
||||||
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->id);
|
foreach ($res as $seedBoxRecord)
|
||||||
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->operator);
|
{
|
||||||
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->bandwidth ?: '');
|
$seedBox .= "<tr>";
|
||||||
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->ip ?: sprintf('%s ~ %s', $seedBoxRecord->ip_begin, $seedBoxRecord->ip_end));
|
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->id);
|
||||||
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->comment);
|
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->operator);
|
||||||
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->statusText);
|
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->bandwidth ?: '');
|
||||||
$seedBox .= sprintf('<td><img style="cursor: pointer" class="staff_delete remove-seed-box-btn" src="pic/trans.gif" alt="D" title="%s" data-id="%s"></td>', $lang_functions['text_delete'], $seedBoxRecord->id);
|
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->ip ?: sprintf('%s ~ %s', $seedBoxRecord->ip_begin, $seedBoxRecord->ip_end));
|
||||||
$seedBox .= "</tr>";
|
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->comment);
|
||||||
|
$seedBox .= sprintf('<td>%s</td>', $seedBoxRecord->statusText);
|
||||||
|
$seedBox .= sprintf('<td><img style="cursor: pointer" class="staff_delete remove-seed-box-btn" src="pic/trans.gif" alt="D" title="%s" data-id="%s"></td>', $lang_functions['text_delete'], $seedBoxRecord->id);
|
||||||
|
$seedBox .= "</tr>";
|
||||||
|
}
|
||||||
|
$seedBox .= '</table>';
|
||||||
}
|
}
|
||||||
$seedBox .= '</table>';
|
$seedBox .= sprintf('<div><input type="button" id="add-seed-box-btn" value="%s"/></div>', $lang_usercp['add_seed_box_btn']);
|
||||||
}
|
tr_small($lang_usercp['row_seed_box'], $seedBox, 1);
|
||||||
$seedBox .= sprintf('<div><input type="button" id="add-seed-box-btn" value="%s"/></div>', $lang_usercp['add_seed_box_btn']);
|
$seedBoxCss = <<<CSS
|
||||||
tr_small($lang_usercp['row_seed_box'], $seedBox, 1);
|
|
||||||
$seedBoxCss = <<<CSS
|
|
||||||
.form-box {
|
.form-box {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
@@ -998,7 +999,7 @@ padding: 4px;
|
|||||||
}
|
}
|
||||||
CSS;
|
CSS;
|
||||||
|
|
||||||
$seedBoxForm = <<<FORM
|
$seedBoxForm = <<<FORM
|
||||||
<div class="form-box">
|
<div class="form-box">
|
||||||
<form id="seed-box-form">
|
<form id="seed-box-form">
|
||||||
<div class="form-control-row">
|
<div class="form-control-row">
|
||||||
@@ -1028,7 +1029,7 @@ $seedBoxForm = <<<FORM
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
FORM;
|
FORM;
|
||||||
$seedBoxJs = <<<JS
|
$seedBoxJs = <<<JS
|
||||||
jQuery('#add-seed-box-btn').on('click', function () {
|
jQuery('#add-seed-box-btn').on('click', function () {
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
@@ -1063,8 +1064,9 @@ jQuery('#seed-box-table').on('click', '.remove-seed-box-btn', function () {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
JS;
|
JS;
|
||||||
\Nexus\Nexus::js($seedBoxJs, 'footer', false);
|
\Nexus\Nexus::js($seedBoxJs, 'footer', false);
|
||||||
\Nexus\Nexus::css($seedBoxCss, 'footer', false);
|
\Nexus\Nexus::css($seedBoxCss, 'footer', false);
|
||||||
|
}
|
||||||
//end seed box
|
//end seed box
|
||||||
|
|
||||||
if ($forumposts)
|
if ($forumposts)
|
||||||
|
|||||||
+34
-8
@@ -15,8 +15,8 @@ $seedBoxRep = new \App\Repositories\SeedBoxRepository();
|
|||||||
function get_location_column($e, $isStrongPrivacy, $canView): string
|
function get_location_column($e, $isStrongPrivacy, $canView): string
|
||||||
{
|
{
|
||||||
global $enablelocation_tweak, $seedBoxRep, $lang_functions, $lang_viewpeerlist;
|
global $enablelocation_tweak, $seedBoxRep, $lang_functions, $lang_viewpeerlist;
|
||||||
|
$address = $ips = [];
|
||||||
if ($enablelocation_tweak == 'yes') {
|
if ($enablelocation_tweak == 'yes') {
|
||||||
$address = $ips = [];
|
|
||||||
if (!empty($e['ipv4'])) {
|
if (!empty($e['ipv4'])) {
|
||||||
list($loc_pub, $loc_mod) = get_ip_location($e['ipv4']);
|
list($loc_pub, $loc_mod) = get_ip_location($e['ipv4']);
|
||||||
$seedBoxIcon = $seedBoxRep->renderIcon($e['ipv4'], $e['userid']);
|
$seedBoxIcon = $seedBoxRep->renderIcon($e['ipv4'], $e['userid']);
|
||||||
@@ -33,7 +33,13 @@ function get_location_column($e, $isStrongPrivacy, $canView): string
|
|||||||
$addressStr = implode('<br/>', $address);
|
$addressStr = implode('<br/>', $address);
|
||||||
$location = "<div title='" . $title . "'>" . $addressStr . "</div>";
|
$location = "<div title='" . $title . "'>" . $addressStr . "</div>";
|
||||||
} else {
|
} else {
|
||||||
$location = implode(', ', array_filter([$e['ipv4'], $e['ipv6']]));
|
if (!empty($e['ipv4'])) {
|
||||||
|
$ips[] = $e['ipv4'] . $seedBoxRep->renderIcon($e['ipv4'], $e['userid']);
|
||||||
|
}
|
||||||
|
if (!empty($e['ipv6'])) {
|
||||||
|
$ips[] = $e['ipv6'] . $seedBoxRep->renderIcon($e['ipv6'], $e['userid']);
|
||||||
|
}
|
||||||
|
$location = '<div>'.implode('<br/>', $ips).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isStrongPrivacy) {
|
if ($isStrongPrivacy) {
|
||||||
@@ -48,6 +54,18 @@ function get_location_column($e, $isStrongPrivacy, $canView): string
|
|||||||
return "<td class=rowfollow align=left width=1%><div style='display: flex;white-space: nowrap;align-items: center'>" . $result . "</div></td>\n";
|
return "<td class=rowfollow align=left width=1%><div style='display: flex;white-space: nowrap;align-items: center'>" . $result . "</div></td>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_username_seed_box_icon($e): string
|
||||||
|
{
|
||||||
|
global $seedBoxRep;
|
||||||
|
foreach (array_filter([$e['ipv4'], $e['ipv6']]) as $ip) {
|
||||||
|
$icon = $seedBoxRep->renderIcon($ip, $e['userid']);
|
||||||
|
if (!empty($icon)) {
|
||||||
|
return $icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(isset($CURUSER))
|
if(isset($CURUSER))
|
||||||
{
|
{
|
||||||
@@ -85,24 +103,32 @@ function dltable($name, $arr, $torrent)
|
|||||||
$highlight = $CURUSER["id"] == $e['userid'] ? " bgcolor=#BBAF9B" : "";
|
$highlight = $CURUSER["id"] == $e['userid'] ? " bgcolor=#BBAF9B" : "";
|
||||||
$s .= "<tr$highlight>\n";
|
$s .= "<tr$highlight>\n";
|
||||||
$secs = max(1, ($e["la"] - $e["st"]));
|
$secs = max(1, ($e["la"] - $e["st"]));
|
||||||
|
$columnLocation = $usernameSeedBoxIcon = '';
|
||||||
if ($privacy == "strong" || ($torrent['anonymous'] == 'yes' && $e['userid'] == $torrent['owner'])) {
|
if ($privacy == "strong" || ($torrent['anonymous'] == 'yes' && $e['userid'] == $torrent['owner'])) {
|
||||||
if (get_user_class() >= $viewanonymous_class || $e['userid'] == $CURUSER['id']) {
|
if (get_user_class() >= $viewanonymous_class || $e['userid'] == $CURUSER['id']) {
|
||||||
$s .= "<td class=rowfollow align=left width=1%><i>".$lang_viewpeerlist['text_anonymous']."</i><br />(" . get_username($e['userid']) . ")";
|
|
||||||
if ($showLocationColumn) {
|
if ($showLocationColumn) {
|
||||||
$s .= get_location_column($e, true, true);
|
$columnLocation = get_location_column($e, true, true);
|
||||||
|
} else {
|
||||||
|
$usernameSeedBoxIcon = get_username_seed_box_icon($e);
|
||||||
}
|
}
|
||||||
|
$columnUsername = "<td class=rowfollow align=left width=1%><i>".$lang_viewpeerlist['text_anonymous']."</i>".$usernameSeedBoxIcon."<br />(" . get_username($e['userid']) . ")</td>\n";
|
||||||
} else {
|
} else {
|
||||||
$s .= "<td class=rowfollow align=left width=1%><i>".$lang_viewpeerlist['text_anonymous']."</i></a></td>\n";
|
|
||||||
if ($showLocationColumn) {
|
if ($showLocationColumn) {
|
||||||
$s .= get_location_column($e, true, false);
|
$columnLocation = get_location_column($e, true, false);
|
||||||
|
} else {
|
||||||
|
$usernameSeedBoxIcon = get_username_seed_box_icon($e);
|
||||||
}
|
}
|
||||||
|
$columnUsername = "<td class=rowfollow align=left width=1%><i>".$lang_viewpeerlist['text_anonymous']."</i>".$usernameSeedBoxIcon."</td>\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$s .= "<td class=rowfollow align=left width=1%>" . get_username($e['userid']);
|
|
||||||
if ($showLocationColumn) {
|
if ($showLocationColumn) {
|
||||||
$s .= get_location_column($e, false, false);
|
$columnLocation = get_location_column($e, false, false);
|
||||||
|
} else {
|
||||||
|
$usernameSeedBoxIcon = get_username_seed_box_icon($e);
|
||||||
}
|
}
|
||||||
|
$columnUsername = "<td class=rowfollow align=left width=1%>" . get_username($e['userid']).$usernameSeedBoxIcon."</td>\n";
|
||||||
}
|
}
|
||||||
|
$s .= $columnUsername . $columnLocation;
|
||||||
|
|
||||||
$s .= "<td class=rowfollow align=center width=1%><nobr>" . ($e['connectable'] == "yes" ? $lang_viewpeerlist['text_yes'] : "<font color=red>".$lang_viewpeerlist['text_no']."</font>") . "</nobr></td>\n";
|
$s .= "<td class=rowfollow align=center width=1%><nobr>" . ($e['connectable'] == "yes" ? $lang_viewpeerlist['text_yes'] : "<font color=red>".$lang_viewpeerlist['text_no']."</font>") . "</nobr></td>\n";
|
||||||
$s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize($e["uploaded"]) . "</nobr></td>\n";
|
$s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize($e["uploaded"]) . "</nobr></td>\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user