Skip to content

Commit

Permalink
Remove spaces at the beginning of the server name when doing a Battle…
Browse files Browse the repository at this point in the history
…log server search.

I don't know why, but some servers appear to have a bunch of spaces at the beginning of their name.  Is that for the purpose of moving them to the top of search results?  Is that to line them up with something on the server loading screen?  I have no idea.  But, anyway, it appears Battlelog automatically finds no results if you search for the server with all of the spaces at the beginning of its name.  So, now the extra spaces are removed before searching Battlelog for the server.
  • Loading branch information
tyger07 committed Jun 23, 2021
1 parent df60049 commit d22995f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions common/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
$Server_r = @mysqli_fetch_assoc($Server_q);
$ServerName = $Server_r['ServerName'];
// create battlelog link for this server
$battlelog = 'https://battlelog.battlefield.com/bf4/servers/pc/?filtered=1&expand=0&useAdvanced=1&q=' . urlencode($ServerName);
$battlelog = 'https://battlelog.battlefield.com/bf4/servers/pc/?filtered=1&expand=0&useAdvanced=1&q=' . urlencode(ltrim($ServerName));
$ServerName = textcleaner($ServerName);
}
// error? what? This will probably never happen.
// damage control...
else
{
$ServerName = 'Error';
$ServerName = 'Error - Unknown';
$battlelog = 'https://battlelog.battlefield.com/bf4/servers/pc/';
}
// lets see if a SoldierName or PlayerID was provided to us in the URL
Expand Down
2 changes: 1 addition & 1 deletion common/server-banner/html-banner-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
{
$CurrentMap_r = @mysqli_fetch_assoc($CurrentMap_q);
$map = $CurrentMap_r['mapName'];
$server = $CurrentMap_r['ServerName'];
$server = ltrim($CurrentMap_r['ServerName']);
$servername = textcleaner($CurrentMap_r['ServerName']);
$servername = ltrim($servername);
if(strlen($servername) > 24)
Expand Down
2 changes: 1 addition & 1 deletion common/server-banner/image-banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,4 +513,4 @@
header("Content-type: image/png");
echo file_get_contents('./images/error.png');
}
?>
?>
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
$xmlData = @file_get_contents('https://github.com/tyger07/BF4-Server-Stats/releases.atom');
$xml=@simplexml_load_string($xmlData);
$releaseVersion = $xml->entry[0]->id;
if((!empty($releaseVersion)) && (stripos($releaseVersion, '6-16-21') === false))
if((!empty($releaseVersion)) && (stripos($releaseVersion, '6-22-21') === false))
{
echo '
<div class="subsection">
Expand Down

0 comments on commit d22995f

Please sign in to comment.