seedBox icon display with location no

This commit is contained in:
xiaomlove
2022-07-24 03:22:06 +08:00
parent fefb6ff8f3
commit c010a01910
3 changed files with 69 additions and 41 deletions
+1 -1
View File
@@ -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");
+2
View File
@@ -948,6 +948,7 @@ 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
if (get_setting('seed_box.enabled') == 'yes') {
$seedBox = ''; $seedBox = '';
$columnOperator = nexus_trans('label.seed_box_record.operator'); $columnOperator = nexus_trans('label.seed_box_record.operator');
$columnBandwidth = nexus_trans('label.seed_box_record.bandwidth'); $columnBandwidth = nexus_trans('label.seed_box_record.bandwidth');
@@ -1065,6 +1066,7 @@ 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)
+37 -11
View File
@@ -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;
if ($enablelocation_tweak == 'yes') {
$address = $ips = []; $address = $ips = [];
if ($enablelocation_tweak == 'yes') {
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 {
if ($showLocationColumn) {
$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%><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, false, false);
}
}
} else { } else {
$s .= "<td class=rowfollow align=left width=1%>" . get_username($e['userid']); $usernameSeedBoxIcon = get_username_seed_box_icon($e);
if ($showLocationColumn) {
$s .= get_location_column($e, false, false);
} }
$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";