Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement (bf2sclone): Add environment variable to show PIDs instead of player names #155

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/bf2sclone/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ function defineVar($name, $default) {
defineVar('RANKING_HIDE_PIDS_START', 1);
defineVar('RANKING_HIDE_PIDS_END', 999999999);

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

// Number of players to show on the leaderboard frontpage
defineVar('LEADERBOARD_COUNT', 25);
?>
4 changes: 2 additions & 2 deletions src/bf2sclone/template/current-ranking.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@
$desc = (isset($value['desc']) && !empty($value['desc'])) ? $value['desc'] : ' ';
$template .= '
<tr>
<td>'.$value['name'].'</td>';
<td>' . esc_attr($value['name']) . '</td>';

foreach($value['data'] as $v)
{
$template .= '
<td>
<img src="'.$ROOT.'game-images/ranks/icon/rank_'.$v['rank'].'.gif" alt="'.getRankByID($v['rank']).'">
<a href="'.$ROOT.'?pid='.$v['id'].'">'.$v['name'].'</a>
<a href="'.$ROOT.'?pid='.$v['id'].'">' . esc_attr(RANKING_PIDS_AS_NAMES ? $v['id'] : $v['name']) . '</a>
<br/>'. $v['value'] .'
</td>';
}
Expand Down
4 changes: 2 additions & 2 deletions src/bf2sclone/template/leaderboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<tbody>
<tr>
<th>#</th>
<th>Nick</th>
<th>' . (RANKING_PIDS_AS_NAMES ? 'PID' : 'Nick') . '</th>
<th>Global Score</th>
<th>Country</th>
<th>Time</th>
Expand All @@ -60,7 +60,7 @@
<td>'.($key+1).'</td>
<td>
<img src="'.$ROOT.'game-images/ranks/icon/rank_'.$value['rank'].'.gif">&nbsp;
<a href="'.$ROOT.'?pid='.$value['id'].'">'.$value['name'].'</a>
<a href="'.$ROOT.'?pid='.$value['id'].'">'. esc_attr(RANKING_PIDS_AS_NAMES ? $value['id'] : $value['name']) .'</a>
</td>
<td>'.$value['score'].'</td>
<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;'.$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/'.strtoupper($value['country']).'.png" width="16" height="12"></a>
</td>
<td>'.$value['score'].'</td>
<td>'.$value['spm'].'</td>
Expand Down
14 changes: 7 additions & 7 deletions src/bf2sclone/template/playerstats.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" class="inner">
<head>
<title>' . esc_attr($player['name'] . ' ' . getRankByID($player['rank']) . ' Stats, ' . TITLE) . '</title>
<title>' . esc_attr((RANKING_PIDS_AS_NAMES ? $player['id'] : $player['name']) . ' ' . getRankByID($player['rank']) . ' Stats, ' . TITLE) . '</title>
<link rel="icon" href="' . $ROOT . 'favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="' . $ROOT . 'favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" media="screen" href="'.$ROOT.'css/two-tiers.css">
Expand All @@ -21,7 +21,7 @@
<div id="page-2">

<h1 id="page-title">
<img src="' . $ROOT . 'game-images/ranks/header/rank_' . $player['rank'] . '.png" alt="" />' . $player['name'] . '<small> ' . getRankByID($player['rank']) . '</small>
<img src="' . $ROOT . 'game-images/ranks/header/rank_' . $player['rank'] . '.png" alt="" />' . esc_attr((RANKING_PIDS_AS_NAMES ? $player['id'] : $player['name'])) . '<small> ' . getRankByID($player['rank']) . '</small>
</h1>

<div id="page-3">
Expand All @@ -43,7 +43,7 @@
$template .= $ROOT . 'game-images/soldiers/' . $playerFavorite['army'] . '_' . $playerFavorite['kit'] . '_' . $playerFavorite['weapon'] . '.jpg';
else
$template .= $ROOT . 'game-images/soldiers/' . $playerFavorite['army'] . '_' . $playerFavorite['kit'] . '_5.jpg'; // show pistol...
$template .= '" alt="' . $player['name'] . ' - ' . getArmyByID($playerFavorite['army']) . '" />
$template .= '" alt="' . esc_attr((RANKING_PIDS_AS_NAMES ? $player['id'] : $player['name'])) . ' - ' . getArmyByID($playerFavorite['army']) . '" />
<img class="weapon" src="' . $ROOT . 'game-images/weapons/weapon_' . $playerFavorite['weapon'] . '.jpg" alt="' . $weapons[$playerFavorite['weapon']]['name'] . '" />
<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']) . '" />
Expand Down Expand Up @@ -719,7 +719,7 @@
<tr>
<td>Favorite Victim<br />(Kills to) </td>';
if ($victims && trim($victims[0]['victim']) != '')
$template .= '<td nowrap="nowrap"><acronym title="his rank is '.getRankByID(getRankFromPID($victims[0]['victim'])).'"><img src="'.$ROOT.'game-images/ranks/icon/rank_'.getRankFromPID($victims[0]['victim']).'.gif"> <a rel="nofollow" href="?pid=' . $victims[0]['victim'] . '">' . getNickFromPID($victims[0]['victim']) . '</a></acronym> (' . $victims[0]['count'] . ')</td>';
$template .= '<td nowrap="nowrap"><acronym title="his rank is '.getRankByID(getRankFromPID($victims[0]['victim'])).'"><img src="'.$ROOT.'game-images/ranks/icon/rank_'.getRankFromPID($victims[0]['victim']).'.gif"> <a rel="nofollow" href="?pid=' . $victims[0]['victim'] . '">' . esc_attr(RANKING_PIDS_AS_NAMES ? $victims[0]['victim'] : getNickFromPID($victims[0]['victim'])) . '</a></acronym> (' . $victims[0]['count'] . ')</td>';
else
$template .= '<td>You are no one\'s worst enemy. Go bully someone.</td>';
$template .= '
Expand All @@ -738,7 +738,7 @@
{
if ($written != 0) $template .= ', ';
$written++;
$template .= '<acronym title="his rank is '.getRankByID(getRankFromPID($victims[$i]['victim'])).'"><img src="'.$ROOT.'game-images/ranks/icon/rank_'.getRankFromPID($victims[$i]['victim']).'.gif"> <a rel="nofollow" href="?pid='.$victims[$i]['victim'].'">'.getNickFromPID($victims[$i]['victim']).'</a></acronym> ('.$victims[$i]['count'].')';
$template .= '<acronym title="his rank is '.getRankByID(getRankFromPID($victims[$i]['victim'])).'"><img src="'.$ROOT.'game-images/ranks/icon/rank_'.getRankFromPID($victims[$i]['victim']).'.gif"> <a rel="nofollow" href="?pid='.$victims[$i]['victim'].'">' . esc_attr(RANKING_PIDS_AS_NAMES ? $victims[$i]['victim'] : getNickFromPID($victims[$i]['victim'])) . '</a></acronym> ('.$victims[$i]['count'].')';
}
}
$template .= '
Expand All @@ -747,7 +747,7 @@
<tr>
<td nowrap="nowrap">Worst Enemy<br />(Deaths by)</td>';
if ($enemies)
$template .= '<td nowrap="nowrap"><acronym title="his rank is '.getRankByID(getRankFromPID($enemies[0]['attacker'])).'"><img src="'.$ROOT.'game-images/ranks/icon/rank_'.getRankFromPID($enemies[0]['attacker']).'.gif"> <a rel="nofollow" href="?pid=' . $enemies[0]['attacker'] . '">' . getNickFromPID($enemies[0]['attacker']) . '</a></acronym> (' . $enemies[0]['count'] . ')</td>';
$template .= '<td nowrap="nowrap"><acronym title="his rank is '.getRankByID(getRankFromPID($enemies[0]['attacker'])).'"><img src="'.$ROOT.'game-images/ranks/icon/rank_'.getRankFromPID($enemies[0]['attacker']).'.gif"> <a rel="nofollow" href="?pid=' . $enemies[0]['attacker'] . '">' . esc_attr(RANKING_PIDS_AS_NAMES ? $enemies[0]['attacker'] : getNickFromPID($enemies[0]['attacker'])) . '</a></acronym> (' . $enemies[0]['count'] . ')</td>';
else
$template .= '<td>It seems you are invincible!</td>';
$template .= '
Expand All @@ -767,7 +767,7 @@
{
if ($written != 0) $template .= ', ';
$written++;
$template .= '<acronym title="his rank is '.getRankByID(getRankFromPID($enemies[$i]['attacker'])).'"><img src="'.$ROOT.'game-images/ranks/icon/rank_'.getRankFromPID($enemies[$i]['attacker']).'.gif"> <a rel="nofollow" href="?pid='.$enemies[$i]['attacker'].'">'.getNickFromPID($enemies[$i]['attacker']).'</a></acronym> ('.$enemies[$i]['count'].')';
$template .= '<acronym title="his rank is '.getRankByID(getRankFromPID($enemies[$i]['attacker'])).'"><img src="'.$ROOT.'game-images/ranks/icon/rank_'.getRankFromPID($enemies[$i]['attacker']).'.gif"> <a rel="nofollow" href="?pid='.$enemies[$i]['attacker'].'">' . esc_attr(RANKING_PIDS_AS_NAMES ? $enemies[$i]['attacker'] : getNickFromPID($enemies[$i]['attacker'])) . '</a></acronym> ('.$enemies[$i]['count'].')';
}
}
$template .= '
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 @@ -78,7 +78,7 @@
$template .= '
<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'].'"> '.$searchresults[$i]['name'].'</a>&nbsp;
<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">
</td>
<td>'.$searchresults[$i]['score'].'</td>
Expand Down
2 changes: 1 addition & 1 deletion src/bf2sclone/template/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
<td>' . ($s['data'] ? esc_attr($k+1) : '-') . '</td>
<td>' . '
<img src="' . $ROOT . 'game-images/ranks/header/rank_' . esc_attr($p['rank']) . '.png" alt="' . esc_attr(getRankByID($p['rank'])) . '" style="vertical-align: middle;" />
<a href="' . "$ROOT?pid=" . esc_attr($p['pid']) . '" title="' . esc_attr($p['name']) . '" style="vertical-align: middle;">' . esc_attr($p['name']) . '</a>
<a href="' . "$ROOT?pid=" . esc_attr($p['pid']) . '" title="' . esc_attr(RANKING_PIDS_AS_NAMES ? $p['pid'] : $p['name']) . '" style="vertical-align: middle;">' . esc_attr(RANKING_PIDS_AS_NAMES ? $p['pid'] : $p['name']) . '</a>
</td>
<td>' . ($s['data'] ? esc_attr($p['score']) : '-') . '</td>
<td>' . ($s['data'] ? esc_attr($p['kills']) : '-') . '</td>
Expand Down
Loading