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

Migrate server flags from images to emoji #210

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Binary file removed images/flags/DE.png
Binary file not shown.
Binary file removed images/flags/DK.png
Binary file not shown.
Binary file removed images/flags/GB.png
Binary file not shown.
Binary file removed images/flags/RU.png
Binary file not shown.
Binary file removed images/flags/US.png
Binary file not shown.
4 changes: 2 additions & 2 deletions includes/functions_unicode.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
function country_code_to_unicode( $country ) {

if ( ( $country === false ) or ( strlen( $country ) != 2 ) )
return '';
return '🌍';

$country = strtoupper( $country );

Expand All @@ -20,7 +20,7 @@ function country_code_to_unicode( $country ) {

if (( $char1 > 25 ) or ( $char2 > 25 ) or
( $char1 < 0 ) or ( $char2 < 0 ) )
return '';
return '🌍';

$start = 0x1F1E6;
$char1 += $start; $char2 += $start;
Expand Down
9 changes: 6 additions & 3 deletions servers.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
include_once( 'includes/header.php' );
include_once( 'includes/GameQ.php' );
include_once( 'includes/paths.php' );
include_once( 'includes/functions_unicode.php' );
$Servers = file( $serversRepo . '/serverlist' );
?>
<h1 class="text-center">Game Servers</h1>
Expand Down Expand Up @@ -64,7 +65,7 @@
$data['gq_address'] = preg_replace( '/.steamlug.org/', '​.steamlug.org', $data['gq_address'], 1 );
echo <<<SERVERSTRING
<tr class="unresponsive">
<td></td>
<td><abbr title="Hosted on Earth">🌍</abbr></td>
<td></td>
<td></td>
<td><em>Server Unresponsive</em></td>
Expand All @@ -77,18 +78,20 @@
} else {
/* this block of code should be better… TODO it please */
$serverLoc = geoip_country_code_by_name( $data['gq_address'] );
$serverFlag = country_code_to_unicode( $serverLoc );
$serverLoc = $serverLoc ? $serverLoc : 'Unknown';
$serverSec = ! empty( $data['secure'] ) ? '<i class="fa-shield"></i>' : '';
$serverPass = ! empty( $data['gq_password'] ) ? '<i class="fa-lock"></i>' : '';
$serverDesc = ! empty( $data['gq_name'] ) ? $data['gq_name'] : '';
// TODO commented out until our new DB stuff is done
// $serverDesc = ! empty( $data['gq_steamappid'] ) ? '<a href="/app/' . $data['gq_steamappid'] . '">' . $data['gq_name'] . '</a>' : $data['gq_name'];
$serverNum = ( ! empty( $data['gq_numplayers'] ) ? $data['gq_numplayers'] : '0') . ' ⁄ ' . $data['gq_maxplayers'];
$serverMap = substr( $data['gq_mapname'], 0, 18 );
$connectPort = ( ! empty( $data['port'] ) ? $data['port'] : ( isset( $data['gameport'] ) ? $data['gameport'] : $data['gq_port'] ) );
$connectPort= ( ! empty( $data['port'] ) ? $data['port'] : ( isset( $data['gameport'] ) ? $data['gameport'] : $data['gq_port'] ) );
$serverHost = $data['gq_address'] . ":" . $connectPort;
echo <<<SERVERSTRING
<tr>
<td><img src="/images/flags/{$serverLoc}.png" title="Hosted in {$serverLoc}" alt="{$serverLoc}" /></td>
<td><abbr title="Hosted in {$serverLoc}">{$serverFlag}</abbr></td>
<td>{$serverSec}</td>
<td>{$serverPass}</td>
<td>{$serverDesc}</td>
Expand Down