Skip to content

Commit

Permalink
Merge pull request #156 from leojonathanoh/enhancement/asp-add-enviro…
Browse files Browse the repository at this point in the history
…nment-variable-to-show-pids-instead-of-player-names-in-bfhq

Enhancement (ASP): Add environment variable to show PIDs instead of player names in BFHQ
  • Loading branch information
leojonathanoh authored Jan 28, 2024
2 parents 9c40a8a + 77b0648 commit 5612e47
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 17 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ services:
# - BFHQ_HIDE_HIDDEN_PLAYERS=false
# - BFHQ_HIDE_PIDS_START=1
# - BFHQ_HIDE_PIDS_END=999999999
# - BFHQ_PIDS_AS_NAMES=false
- DEBUG_LVL=2
volumes:
- ./src/ASP:/src/ASP
Expand Down
9 changes: 9 additions & 0 deletions src/ASP/frontend/views/editconfig.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@
/>
</div>
</div>
<div class="mws-form-row">
<label>Show PIDs instead of player names in BFHQ:</label>
<div class="mws-form-item small">
<select name="cfg__bfhq_pids_as_names" title="Show PIDs instead of player names in BFHQ.">
<option value="true" <?php if('{config.bfhq_pids_as_names}' == true) echo 'selected="selected"'; ?>>Yes</option>
<option value="false" <?php if('{config.bfhq_pids_as_names}' == false) echo 'selected="selected"'; ?>>No</option>
</select>
</div>
</div>

<!-- Global Config -->
<h3 style="margin-left: 50px; margin-top: 35px;">Global Game Server Configuration</h3>
Expand Down
32 changes: 16 additions & 16 deletions src/ASP/getleaderboard.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ else
while($row = $result->fetch())
{
$plpid = $row['id'];
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand All @@ -151,7 +151,7 @@ else
$plpid = $row['id'];
if($plpid == $pid)
{
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand Down Expand Up @@ -180,7 +180,7 @@ else
while($row = $result->fetch())
{
$plpid = $row['id'];
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$cmdtime = $row['cmdtime'];
Expand All @@ -200,7 +200,7 @@ else
$plpid = $row['id'];
if($plpid == $pid)
{
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$cmdtime = $row['cmdtime'];
Expand Down Expand Up @@ -229,7 +229,7 @@ else
while($row = $result->fetch())
{
$plpid = $row['id'];
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand All @@ -248,7 +248,7 @@ else
{
$plpid = $row['id'];
if ($plpid == $pid) {
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand Down Expand Up @@ -277,7 +277,7 @@ else
while($row = $result->fetch())
{
$plpid = $row['id'];
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand All @@ -298,7 +298,7 @@ else
$plpid = $row['id'];
if($plpid == $pid)
{
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand Down Expand Up @@ -336,7 +336,7 @@ else
while($row = $result->fetch())
{
$plpid = $row['id'];
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand All @@ -361,7 +361,7 @@ else
$plpid = $row['id'];
if($plpid == $pid)
{
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand Down Expand Up @@ -391,7 +391,7 @@ else
while($row = $result->fetch())
{
$plpid = $row['plid'];
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand All @@ -412,7 +412,7 @@ else
$plpid = $row['plid'];
if($plpid == $pid)
{
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand Down Expand Up @@ -442,7 +442,7 @@ else
while($row = $result->fetch())
{
$plpid = $row['plid'];
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand All @@ -463,7 +463,7 @@ else
$plpid = $row['plid'];
if($plpid == $pid)
{
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand Down Expand Up @@ -494,7 +494,7 @@ else
while($row = $result->fetch())
{
$plpid = $row['plid'];
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand All @@ -516,7 +516,7 @@ else
$plpid = $row['plid'];
if($plpid == $pid)
{
$name = trim($row['name']);
$name = Config::Get('bfhq_pids_as_names') ? $row['id'] : trim($row['name']);
$rank = $row['rank'];
$country = strtoupper($row['country']);
$time = $row['time'];
Expand Down
2 changes: 1 addition & 1 deletion src/ASP/searchforplayers.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ else
{
$num = 1;
while($row = $result->fetch())
$out .= "D\t" . $num++ . "\t" . $row['id'] . "\t" . $row['name'] . "\t" . $row['score'] . "\n";
$out .= "D\t" . $num++ . "\t" . $row['id'] . "\t" . (Config::Get('bfhq_pids_as_names') ? $row['id'] : $row['name']) . "\t" . $row['score'] . "\n";
}

$num = strlen(preg_replace('/[\t\n]/', '', $out));
Expand Down
1 change: 1 addition & 0 deletions src/ASP/system/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
$bfhq_hide_hidden_players = false;
$bfhq_hide_pids_start = 1;
$bfhq_hide_pids_end = 999999999;
$bfhq_pids_as_names = false;
$debug_lvl = 2;
$game_hosts = array('127.0.0.1','192.168.2.0/24','192.168.1.102','192.168.1.110','localhost','::1');
$game_custom_mapid = 700;
Expand Down
1 change: 1 addition & 0 deletions src/ASP/system/core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ private static function getDefault()
'bfhq_hide_hidden_players' => false,
'bfhq_hide_pids_start' => 1,
'bfhq_hide_pids_end' => 999999999,
'bfhq_pids_as_names' => false,
'debug_lvl' => 2,
'game_hosts' => array('127.0.0.1','192.168.2.0/24','192.168.1.102','192.168.1.110','localhost','::1'),
'game_custom_mapid' => 700,
Expand Down

0 comments on commit 5612e47

Please sign in to comment.