Skip to content

Commit

Permalink
Merge pull request #165 from leojonathanoh/enhancement/bf2sclone-add-…
Browse files Browse the repository at this point in the history
…environment-variable-to-hide-country-flags

Enhancement (bf2sclone): Add environment variable to hide country flags
  • Loading branch information
leojonathanoh authored Feb 23, 2024
2 parents f19938c + 9f1302a commit 3a4bcb0
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ services:
# - TITLE=BF2S Clone
- RANKING_REFRESH_TIME=0
# - RANKING_HIDE_BOTS=false
# - RANKING_HIDE_COUNTRY=false
# - RANKING_HIDE_HIDDEN_PLAYERS=false
# - RANKING_HIDE_PIDS_START=1
# - RANKING_HIDE_PIDS_END=999999999
Expand Down
5 changes: 4 additions & 1 deletion src/bf2sclone/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ function defineVar($name, $default) {
// Whether to hide bots from rankings
defineVar('RANKING_HIDE_BOTS', false);

// Whether to hide player country flag from rankings
defineVar('RANKING_HIDE_COUNTRY', false);

// Whether to hide hidden players from rankings
defineVar('RANKING_HIDE_HIDDEN_PLAYERS', false);

// Whether to hide a range of PIDs from rankings
defineVar('RANKING_HIDE_PIDS_START', 1);
defineVar('RANKING_HIDE_PIDS_END', 999999999);

// Whether to show PIDs instead of player names hidden players from rankings
// Whether to show PIDs instead of player names in rankings
defineVar('RANKING_PIDS_AS_NAMES', false);

// Number of players to show on the leaderboard frontpage
Expand Down
2 changes: 1 addition & 1 deletion src/bf2sclone/template/leaderboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</td>
<td>'.$value['score'].'</td>
<td>
<img src="'.$ROOT.'game-images/flags/'.strtoupper($value['country']).'.png" height="12" width="16">
<img src="'.$ROOT.'game-images/flags/' . esc_attr(RANKING_HIDE_COUNTRY ? 'xx' : strtoupper($value['country'])) . '.png" height="12" width="16">
</td>
<td>'.intToTime($value['time']).'</td>
<!--
Expand Down
2 changes: 1 addition & 1 deletion src/bf2sclone/template/my-leaderboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<tr>
<td>
<img src="'.$ROOT.'game-images/ranks/icon/rank_'.$value['rank'].'.gif" alt="" style="border: 0pt none ;">
<a href="'.$ROOT.'?pid='.$value['id'].'">&nbsp;' . esc_attr(RANKING_PIDS_AS_NAMES ? $value['id'] : $value['name']) . '&nbsp;<img src="'.$ROOT.'game-images/flags/'.strtoupper($value['country']).'.png" width="16" height="12"></a>
<a href="'.$ROOT.'?pid='.$value['id'].'">&nbsp;' . esc_attr(RANKING_PIDS_AS_NAMES ? $value['id'] : $value['name']) . '&nbsp;<img src="'.$ROOT.'game-images/flags/' . esc_attr(RANKING_HIDE_COUNTRY ? 'xx' : strtoupper($value['country'])) . '.png" width="16" height="12"></a>
</td>
<td>'.$value['score'].'</td>
<td>'.$value['spm'].'</td>
Expand Down
2 changes: 1 addition & 1 deletion src/bf2sclone/template/playerstats.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<img class="vehicle" src="' . $ROOT . 'game-images/vehicles/vehicles_' . $playerFavorite['vehicle'] . '.jpg" alt="' . getVehicleByID($playerFavorite['vehicle']) . '" />
<img class="kit" src="' . $ROOT . 'game-images/kits/kit_' . $playerFavorite['kit'] . '.jpg" alt="' . getKitByID($playerFavorite['kit']) . '" />
<img class="map" src="' . $ROOT . 'game-images/maps/map_' . $playerFavorite['map'] . '.jpg" alt="' . getMapByID( $playerFavorite['map'] ) . '" />
<img id="flag" src="' . $ROOT . 'game-images/flags/' . strtoupper($player['country']) . '.png" alt="' . getCountryByCode($player['country']) . '" width="32" height="24" />
<img id="flag" src="' . $ROOT . 'game-images/flags/' . esc_attr(RANKING_HIDE_COUNTRY ? 'xx' : strtoupper($player['country'])) . '.png" alt="' . getCountryByCode($player['country']) . '" width="32" height="24" />
</div>
<a id="add-to-mlb" href="'.$ROOT.'/?go=my-leaderboard&add=' . $PID . '"><img src="' . $ROOT . '/site-images/user_add.png" alt="Add to My Leader Board" /></a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/bf2sclone/template/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<td>
<img src="'.$ROOT.'game-images/ranks/icon/rank_'.$searchresults[$i]['rank'].'.gif" alt="" style="border: 0pt none ;">
<a href="'.$ROOT.'?pid='.$searchresults[$i]['id'].'"> ' . (RANKING_PIDS_AS_NAMES ? $searchresults[$i]['id'] : esc_attr($searchresults[$i]['name'])) . '</a>&nbsp;
<img src="'.$ROOT.'game-images/flags/'.strtoupper($searchresults[$i]['country']).'.png" height="12" width = "16">
<img src="'.$ROOT.'game-images/flags/' . esc_attr(RANKING_HIDE_COUNTRY ? 'xx' : strtoupper($searchresults[$i]['country'])) .'.png" height="12" width = "16">
</td>
<td>'.$searchresults[$i]['score'].'</td>
<td>'.$searchresults[$i]['spm'].'</td>
Expand Down

0 comments on commit 3a4bcb0

Please sign in to comment.