fixed aliases
fixed forum decoding of thread content fixed escaping html "special" characters in player names on webfront fixed findall not always informing if no matches found.
This commit is contained in:
parent
9a85b9c4c2
commit
2aa3aa5baf
@ -15,6 +15,8 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal;
|
||||||
|
|
||||||
Version = 1.6;
|
Version = 1.6;
|
||||||
handler = new ConsoleEventDelegate(OnProcessExit);
|
handler = new ConsoleEventDelegate(OnProcessExit);
|
||||||
SetConsoleCtrlHandler(handler, true);
|
SetConsoleCtrlHandler(handler, true);
|
||||||
|
@ -285,6 +285,7 @@ namespace IW4MAdmin
|
|||||||
GetAliases(allAliases, currentIdentityAliases);
|
GetAliases(allAliases, currentIdentityAliases);
|
||||||
if (Origin.Alias != null)
|
if (Origin.Alias != null)
|
||||||
allAliases.Add(Origin.Alias);
|
allAliases.Add(Origin.Alias);
|
||||||
|
allAliases.Add(currentIdentityAliases);
|
||||||
return allAliases;
|
return allAliases;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,8 +758,9 @@ namespace IW4MAdmin
|
|||||||
bool authed = ApplicationManager.GetInstance().GetClientDatabase().GetAdmins().FindAll(x => x.IP == querySet["IP"] && x.Level > Player.Permission.Trusted).Count > 0
|
bool authed = ApplicationManager.GetInstance().GetClientDatabase().GetAdmins().FindAll(x => x.IP == querySet["IP"] && x.Level > Player.Permission.Trusted).Count > 0
|
||||||
|| querySet["IP"] == "127.0.0.1";
|
|| querySet["IP"] == "127.0.0.1";
|
||||||
bool recent = false;
|
bool recent = false;
|
||||||
|
bool individual = querySet["id"] != null;
|
||||||
|
|
||||||
if (querySet["id"] != null)
|
if (individual)
|
||||||
{
|
{
|
||||||
matchedPlayers.Add(ApplicationManager.GetInstance().GetClientDatabase().GetPlayer(Convert.ToInt32(querySet["id"])));
|
matchedPlayers.Add(ApplicationManager.GetInstance().GetClientDatabase().GetPlayer(Convert.ToInt32(querySet["id"])));
|
||||||
}
|
}
|
||||||
@ -801,18 +802,24 @@ namespace IW4MAdmin
|
|||||||
playernpID = pp.NetworkID,
|
playernpID = pp.NetworkID,
|
||||||
forumID = -1,
|
forumID = -1,
|
||||||
authed = authed,
|
authed = authed,
|
||||||
showV2Features = false
|
showV2Features = false,
|
||||||
|
playerAliases = new List<string>(),
|
||||||
|
playerIPs = new List<string>()
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!recent)
|
if (!recent && individual)
|
||||||
{
|
{
|
||||||
foreach (var a in ApplicationManager.GetInstance().GetAliases(pp))
|
foreach (var a in ApplicationManager.GetInstance().GetAliases(pp))
|
||||||
{
|
{
|
||||||
eachPlayer.playerAliases = a.Names;
|
eachPlayer.playerAliases.AddRange(a.Names);
|
||||||
eachPlayer.playerIPs = a.IPS;
|
eachPlayer.playerIPs.AddRange(a.IPS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eachPlayer.playerAliases = eachPlayer.playerAliases.Distinct().ToList();
|
||||||
|
eachPlayer.playerIPs = eachPlayer.playerIPs.Distinct().ToList();
|
||||||
|
|
||||||
eachPlayer.playerConnections = pp.Connections;
|
eachPlayer.playerConnections = pp.Connections;
|
||||||
eachPlayer.lastSeen = Utilities.GetTimePassed(pp.LastConnection);
|
eachPlayer.lastSeen = Utilities.GetTimePassed(pp.LastConnection);
|
||||||
pInfo.Add(eachPlayer);
|
pInfo.Add(eachPlayer);
|
||||||
|
Binary file not shown.
@ -8,6 +8,7 @@ CHANGELOG:
|
|||||||
-prune command demotes inactive admins (defaults to 30 days if no days are specified)
|
-prune command demotes inactive admins (defaults to 30 days if no days are specified)
|
||||||
-confirmation message sent after kick
|
-confirmation message sent after kick
|
||||||
-paginated players page
|
-paginated players page
|
||||||
|
-fixed aliases
|
||||||
|
|
||||||
Version 1.5
|
Version 1.5
|
||||||
CHANGELOG:
|
CHANGELOG:
|
||||||
|
@ -1,34 +1,29 @@
|
|||||||
<script>
|
<script>
|
||||||
var curFrom = 0;
|
var curFrom = 0;
|
||||||
|
|
||||||
function getNextPage()
|
function getNextPage() {
|
||||||
{
|
curFrom += 15;
|
||||||
curFrom += 15;
|
return curFrom;
|
||||||
return curFrom;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function getPrevPage()
|
function getPrevPage() {
|
||||||
{
|
if ((curFrom - 15) >= 0) {
|
||||||
if ((curFrom - 15) >= 0)
|
curFrom -= 15;
|
||||||
{
|
return (curFrom);
|
||||||
curFrom -= 15;
|
}
|
||||||
return (curFrom );
|
else {
|
||||||
}
|
curFrom = 0;
|
||||||
else
|
return 0;
|
||||||
{
|
}
|
||||||
curFrom = 0;
|
}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPenalties(from)
|
function getPenalties(from) {
|
||||||
{
|
$("#penaltyList").html("");
|
||||||
$("#penaltyList").html("");
|
$(".loader").fadeIn();
|
||||||
$(".loader").fadeIn();
|
$.getJSON("/_penalties?from=" + from, function (result) {
|
||||||
$.getJSON("/_penalties?from=" + from, function(result) {
|
$.each(result, function (i, penalty) {
|
||||||
$.each(result, function(i, penalty) {
|
$("#penaltyList").append(
|
||||||
$("#penaltyList").append(
|
"<div class=\"playerPenalty table alternate_" + i % 2 + "\"> \
|
||||||
"<div class=\"playerPenalty table alternate_" + i % 2 + "\"> \
|
|
||||||
<div class=\"penaltyName tableCell\"><a href=\"/players?id="+ penalty['playerID'] + "\">" + penalty['playerName'] + "</a></div> \
|
<div class=\"penaltyName tableCell\"><a href=\"/players?id="+ penalty['playerID'] + "\">" + penalty['playerName'] + "</a></div> \
|
||||||
<div class=\"penaltyType tableCell\">"+ getColorForLevel(penalty['penaltyType'], penalty['penaltyType']) + "</div> \
|
<div class=\"penaltyType tableCell\">"+ getColorForLevel(penalty['penaltyType'], penalty['penaltyType']) + "</div> \
|
||||||
<div class=\"penaltyReason tableCell\">"+ penalty['penaltyReason'] + "</div> \
|
<div class=\"penaltyReason tableCell\">"+ penalty['penaltyReason'] + "</div> \
|
||||||
@ -36,28 +31,28 @@ function getPenalties(from)
|
|||||||
<div class=\"penaltyTime tableCell\">"+ penalty['penaltyTime'] + "</div> \
|
<div class=\"penaltyTime tableCell\">"+ penalty['penaltyTime'] + "</div> \
|
||||||
<div class=\" penaltyRemaining tableCell\">" + penalty['Expires'] + "</div> \
|
<div class=\" penaltyRemaining tableCell\">" + penalty['Expires'] + "</div> \
|
||||||
</div>"
|
</div>"
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
}).done(function (data) { $(".loader").fadeOut(); });
|
}).done(function (data) { $(".loader").fadeOut(); });
|
||||||
}
|
}
|
||||||
$( document ).ready(function() {
|
$(document).ready(function () {
|
||||||
getPenalties(0);
|
getPenalties(0);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="penaltyHeader table">
|
<div class="penaltyHeader table">
|
||||||
<div class="penaltyName tableCell">Name</div>
|
<div class="penaltyName tableCell">Name</div>
|
||||||
<div class="penaltyType tableCell">Type</div>
|
<div class="penaltyType tableCell">Type</div>
|
||||||
<div class="penaltyReason tableCell">Reason</div>
|
<div class="penaltyReason tableCell">Reason</div>
|
||||||
<div class="penaltyOrigin tableCell">Admin</div>
|
<div class="penaltyOrigin tableCell">Admin</div>
|
||||||
<div class="penaltyTime tableCell">Time</div>
|
<div class="penaltyTime tableCell">Time</div>
|
||||||
<div class="penaltyRemaining tableCell">Remaining</div>
|
<div class="penaltyRemaining tableCell">Remaining</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="penaltyList">
|
<div id="penaltyList">
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div id="paginationButtons" class="table">
|
<div id="paginationButtons" class="table">
|
||||||
<div id="previousPage" class="tableCell"><a href=# onclick="getPenalties(getPrevPage())"><<</a></div>
|
<div id="previousPage" class="tableCell"><a href=# onclick="getPenalties(getPrevPage())"><<</a></div>
|
||||||
<div id="nextPage" class="tableCell"><a href=# onclick="getPenalties(getNextPage())">>></a></div>
|
<div id="nextPage" class="tableCell"><a href=# onclick="getPenalties(getNextPage())">>></a></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function escapeHtml(unsafe) {
|
||||||
|
return unsafe
|
||||||
|
.replace(/&/g, "&")
|
||||||
|
.replace(/</g, "<")
|
||||||
|
.replace(/>/g, ">")
|
||||||
|
.replace(/"/g, """)
|
||||||
|
.replace(/'/g, "'");
|
||||||
|
}
|
||||||
|
|
||||||
var curFrom = 0;
|
var curFrom = 0;
|
||||||
|
|
||||||
function getNextPage() {
|
function getNextPage() {
|
||||||
@ -9,18 +19,22 @@
|
|||||||
function getPrevPage() {
|
function getPrevPage() {
|
||||||
if ((curFrom - 15) >= 0) {
|
if ((curFrom - 15) >= 0) {
|
||||||
curFrom -= 15;
|
curFrom -= 15;
|
||||||
return (curFrom - 15);
|
return (curFrom);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
|
curFrom = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatHidden(data, authed) {
|
function formatHidden(data, authed) {
|
||||||
var p = "<div class=\"hiddenWrapper\"><span>Expand</span><div class=\"hiddenElements\">";
|
var p = "<div class=\"hiddenWrapper\"><span>Expand</span><div class=\"hiddenElements\">";
|
||||||
|
|
||||||
if (authed) {
|
if (authed) {
|
||||||
|
if (data == undefined || data.length == 0)
|
||||||
|
p += "Not Loaded"
|
||||||
$.each(data, function (i, dat) {
|
$.each(data, function (i, dat) {
|
||||||
p += "<span>" + dat + "</span><br/>"
|
p += "<span>" + escapeHtml(dat) + "</span><br/>"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +50,7 @@
|
|||||||
var p = "";
|
var p = "";
|
||||||
p +=
|
p +=
|
||||||
"<div class=\"playerInfo table alternate_" + i % 2 + "\"> \
|
"<div class=\"playerInfo table alternate_" + i % 2 + "\"> \
|
||||||
<div class=\"tableCell\"><a href=\"/players?id=" + player['playerID'] + "\">" + player['playerName'] + "</a></div> \
|
<div class=\"tableCell\"><a href=\"/players?id=" + player['playerID'] + "\">" + escapeHtml(player['playerName']) + "</a></div> \
|
||||||
<div class=\"tableCell\">" + formatHidden(player['playerAliases'], player.authed) + "</div> \
|
<div class=\"tableCell\">" + formatHidden(player['playerAliases'], player.authed) + "</div> \
|
||||||
<div class=\"tableCell\">" + formatHidden(player['playerIPs'], player.authed) + "</div> \
|
<div class=\"tableCell\">" + formatHidden(player['playerIPs'], player.authed) + "</div> \
|
||||||
<div class=\"tableCell\">" + getColorForLevel(player['playerLevel'], player['playerLevel']) + "</div> \
|
<div class=\"tableCell\">" + getColorForLevel(player['playerLevel'], player['playerLevel']) + "</div> \
|
||||||
@ -73,7 +87,8 @@
|
|||||||
$.each(result, function (i, player) {
|
$.each(result, function (i, player) {
|
||||||
printPlayer(player, i);
|
printPlayer(player, i);
|
||||||
});
|
});
|
||||||
}).done(function (data) { $(".loader").fadeOut(); });
|
}).done(function (data) { $(".loader").fadeOut(); })
|
||||||
|
.error(function (data) { $(".loader").fadeOut(); })
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
@ -577,7 +577,7 @@ namespace SharedLibrary.Commands
|
|||||||
|
|
||||||
var db_aliases = E.Owner.Manager.GetAliasesDatabase().FindPlayerAliases(E.Data);
|
var db_aliases = E.Owner.Manager.GetAliasesDatabase().FindPlayerAliases(E.Data);
|
||||||
|
|
||||||
if (db_aliases == null)
|
if (db_aliases == null || db_aliases.Count() == 0)
|
||||||
{
|
{
|
||||||
await E.Origin.Tell("No players found");
|
await E.Origin.Tell("No players found");
|
||||||
return;
|
return;
|
||||||
@ -620,9 +620,9 @@ namespace SharedLibrary.Commands
|
|||||||
if (E.Owner.Rules.Count < 1)
|
if (E.Owner.Rules.Count < 1)
|
||||||
{
|
{
|
||||||
if (E.Message.IsBroadcastCommand())
|
if (E.Message.IsBroadcastCommand())
|
||||||
await E.Owner.Broadcast("The server owner has not set any rules.");
|
await E.Owner.Broadcast("The server owner has not set any rules");
|
||||||
else
|
else
|
||||||
await E.Origin.Tell("The server owner has not set any rules.");
|
await E.Origin.Tell("The server owner has not set any rules");
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -753,7 +753,7 @@ namespace SharedLibrary.Commands
|
|||||||
|
|
||||||
if (E.Target == E.Origin)
|
if (E.Target == E.Origin)
|
||||||
{
|
{
|
||||||
await E.Origin.Tell("You cannot report yourself.");
|
await E.Origin.Tell("You cannot report yourself");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -796,7 +796,7 @@ namespace SharedLibrary.Commands
|
|||||||
|
|
||||||
if (E.Owner.Reports.Count < 1)
|
if (E.Owner.Reports.Count < 1)
|
||||||
{
|
{
|
||||||
await E.Origin.Tell("No players reported yet.");
|
await E.Origin.Tell("No players reported yet");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -848,7 +848,7 @@ namespace SharedLibrary.Commands
|
|||||||
|
|
||||||
if (BannedPenalty == null)
|
if (BannedPenalty == null)
|
||||||
{
|
{
|
||||||
await E.Origin.Tell("No active ban was found for that player.");
|
await E.Origin.Tell("No active ban was found for that player");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +665,7 @@ namespace SharedLibrary
|
|||||||
{
|
{
|
||||||
CommandText = "SELECT * FROM ALIASES WHERE IPS LIKE @IP"
|
CommandText = "SELECT * FROM ALIASES WHERE IPS LIKE @IP"
|
||||||
};
|
};
|
||||||
cmd.Parameters.AddWithValue("@IP", IP);
|
cmd.Parameters.AddWithValue("@IP", $"%{IP}%");
|
||||||
|
|
||||||
var Result = GetDataTable(cmd);
|
var Result = GetDataTable(cmd);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user