From 796d9df1885d46d9a386f7105255799f0dfdc7e2 Mon Sep 17 00:00:00 2001
From: Neon
Date: Fri, 18 Jun 2021 19:12:44 +0400
Subject: [PATCH] LGSL 6.1.0 Added server tracking (history of past 24 hours);
Improved Discord querying; Added RedM support #44; FiveM now using http
querying (for #43); Added Flag-icon script (for #38); Fixed Source protocol
(added tags as extras and fixing Rust for 256 or more players)
---
README.md | 26 ++--
charts.php | 77 +++++++++
composer.json | 32 ++--
index.php | 2 +-
install.php | 53 +++++--
lgsl_files/icons/fivem/redm.png | Bin 0 -> 1366 bytes
lgsl_files/languages/arabic.php | 1 +
lgsl_files/languages/bulgarian.php | 1 +
lgsl_files/languages/czech.php | 1 +
lgsl_files/languages/english.php | 1 +
lgsl_files/languages/french.php | 1 +
lgsl_files/languages/german.php | 1 +
lgsl_files/languages/russian.php | 1 +
lgsl_files/languages/slovak.php | 1 +
lgsl_files/languages/spanish.php | 1 +
lgsl_files/lgsl_admin.php | 2 +-
lgsl_files/lgsl_class.php | 18 +++
lgsl_files/lgsl_config.php | 6 +-
lgsl_files/lgsl_details.php | 4 +
lgsl_files/lgsl_feed.php | 2 +-
lgsl_files/lgsl_list.php | 2 +-
lgsl_files/lgsl_protocol.php | 216 ++++++++++++++++----------
lgsl_files/scripts/flag-icon.js | 17 ++
lgsl_files/scripts/refresh.js | 4 +
lgsl_files/styles/breeze_style.css | 4 +-
lgsl_files/styles/cards_style.css | 4 +-
lgsl_files/styles/classic_style.css | 4 +-
lgsl_files/styles/darken_style.css | 6 +-
lgsl_files/styles/disc_ff_style.css | 4 +-
lgsl_files/styles/material_style.css | 4 +-
lgsl_files/styles/ogp_style.css | 4 +-
lgsl_files/styles/parallax_style.css | 4 +-
lgsl_files/styles/wallpaper_style.css | 4 +-
userbar.php | 18 +--
34 files changed, 376 insertions(+), 150 deletions(-)
create mode 100644 charts.php
create mode 100644 lgsl_files/icons/fivem/redm.png
create mode 100644 lgsl_files/scripts/flag-icon.js
diff --git a/README.md b/README.md
index ccf0efe..797bbbb 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,17 @@
[](https://github.com/tltneon/lgsl/releases)
-
+

-
+
[](https://github.com/tltneon?tab=followers)
[](https://github.com/tltneon/lgsl/stargazers)
[](https://github.com/tltneon/lgsl/fork)
[](https://github.com/tltneon/lgsl/archive/master.zip)
[](https://github.com/tltneon/lgsl/blob/master/LICENSE)
-# LGSL v6.0.1 (Live Game Server List) for PHP 7+
-Based-off LGSL v5.8 (stand-alone version) from www.greycube.com. This is almost original version of LGSL with [new features](https://github.com/tltneon/lgsl#changelog) and working on PHP 5.4-8.x and MySQL 5.5.27-8.0.x or MariaDB 5.5-10.5.x
+# LGSL v6.1.0 (Live Game Server List)
+Based-off LGSL v5.8 (stand-alone version) from www.greycube.com. This is almost original version of LGSL with [new features](https://github.com/tltneon/lgsl#changelog) and working on PHP 5.4-8.x and MySQL 5.5.27-8.0.x or MariaDB 5.5-10.6.x. May be upgraded from LGSL 5.8 and older.
-## [Live Demos](http://lgsl-demo.freesite.vip/) | [Wiki](https://github.com/tltneon/lgsl/wiki) | [How to install]( https://github.com/tltneon/lgsl/wiki/How-to-install-LGSL) | [Supported games](https://github.com/tltneon/lgsl/wiki/Supported-Games) | [Custom styles](https://github.com/tltneon/lgsl/wiki/Styles)
+## [Live Demos](http://lgsl-demo.freesite.vip/) | [Wiki](https://github.com/tltneon/lgsl/wiki) | [How to install]( https://github.com/tltneon/lgsl/wiki/How-to-install-LGSL) | [Supported games](https://github.com/tltneon/lgsl/wiki/Supported-Games,-Query-protocols,-Default-ports) | [Custom styles](https://github.com/tltneon/lgsl/wiki/Styles)
Feel free to make [pull request](https://github.com/tltneon/lgsl) with your custom styles or languages! Also you can suggest any [features](https://github.com/tltneon/lgsl/issues).
@@ -21,6 +21,14 @@ Feel free to make [pull request](https://github.com/tltneon/lgsl) with your cust

## [Changelog](https://github.com/tltneon/lgsl/wiki/Changelog)
+#### v6.1.0
+- **LGSL now has native history chart: records server status and players count at last 24 hours**
+- **Available Flag-icon script: replacing standard icons to svg from flag-icon-css**
+- **Available Refresh script: refresh server's data in details page without reloading**
+- **Added RedM support**
+- **New game icons**
+- **Minor fixes**
+- *Tested on PHP 8.1.0-dev
#### v6.0.1
- **New Style: Cards** [[Live Demo](http://lgsl-demo.freesite.vip/lgsl9/index.php)]
- **Selecting active scripts on install page**
@@ -33,7 +41,7 @@ Feel free to make [pull request](https://github.com/tltneon/lgsl) with your cust
- **Game icon now is a link to show all server of that game**
- **Admin panel: now you can add ip with port to ip input (LGSL split after ':' automatically)**
- **Now servers shows timestamps of last querying**
-- **Added Arabic languages**
+- **Added Arabic language**
- *Thanks to [@lamjed001](https://github.com/lamjed001)*
- **Updated all styles**
#### v5.10.3
@@ -63,12 +71,6 @@ Feel free to make [pull request](https://github.com/tltneon/lgsl) with your cust
- **Added installation script** [[How to install LGSL](https://github.com/tltneon/lgsl/wiki/How-to-install-LGSL)]
- **Styles now has better view on mobile devices**
- **Most popular game icons changed to 64x64 resolution**
-#### v5.9.6
-- **Added Parallax Style** [[Live Demo](http://lgsl-demo.freesite.vip/lgsl5/index.php)]
-- **Added German languages**
- - *Thanks to [@ctannurella](https://github.com/ctannurella)*
-- **Default style was changed to: Darken**
-- **Added support to including js files in _lgsl_config.php_**
##### [:: Older versions](https://github.com/tltneon/lgsl/wiki/Changelog)
diff --git a/charts.php b/charts.php
new file mode 100644
index 0000000..c557b35
--- /dev/null
+++ b/charts.php
@@ -0,0 +1,77 @@
+ 0 ? $server['s']['playersmax'] : 1;
+
+ // SETTINGS
+
+ $w = 400;
+ $h = 150;
+ $im = @imagecreate($w, $h);
+ $white = imagecolorallocate($im, 255, 255, 255);
+ $gray = imagecolorallocate($im, 225, 225, 225);
+ $black = imagecolorallocate($im, 0, 0, 0);
+ $green = imagecolorallocate($im, 20, 255, 0);
+ $red = imagecolorallocate($im, 255, 0, 0);
+ $x0 = 30;
+ $y0 = 20;
+ $xStep = 30;
+ $yStep = 30;
+ $period = 60 * 60 * 24; // 1 day
+
+ //
+
+ $s = array();
+ $x = array();
+ $y = array();
+ foreach($server['s']['history'] as $key){
+ array_push($s, $key['status']);
+ array_push($x, $key['time'] - time() + $period);
+ array_push($y, $key['players']);
+ }
+
+ $maxX = $w - $x0;
+ $maxY = $h - $y0;
+ $scaleX = ($maxX-$x0) / max($x);
+ $scaleY = ($maxY-$y0) / $server['s']['playersmax'];
+
+ // DRAW AXIS
+
+ imageline($im, $x0, $maxY, $maxX, $maxY, $black);
+ imageline($im, $x0, $y0, $x0, $maxY, $black);
+
+ // DRAW GRID
+
+ $xSteps = ($maxX-$x0) / $xStep-1;
+ $ySteps = ($maxY-$y0) / $yStep-1;
+ for($i=1; $i < $xSteps+1; $i++){
+ imageline($im, $x0+$xStep*$i, $y0, $x0+$xStep*$i, $maxY-1, $gray);
+ $str = Date("H:i", time() - $period + (int)($i * round($xStep/$scaleX, 1)));
+ imagestring($im, 1, (($x0+$xStep*$i) - 6), $maxY+2, $str, $black);
+ }
+
+ for($i=1; $i < $ySteps+1; $i++){
+ imageline($im, $x0+1, $maxY-$yStep*$i, $maxX, $maxY-$yStep*$i, $gray);
+ imagestring($im, 1, 3, ($maxY-$yStep*$i)-3, (int)($i * round($yStep/$scaleY, 1) ), $black);
+ }
+
+ // DRAW GRAPH
+
+ for($i=1; $i < count($x); $i++) {
+ if($s[$i-1]) {
+ imageline($im, (int) ($x0+$x[$i-1]*$scaleX), (int) ($maxY-$y[$i-1]*$scaleY), (int) ($x0+$x[$i]*$scaleX), (int) ($maxY-$y[$i]*$scaleY), $green);
+ }
+ else {
+ imagefilledellipse($im, (int) ($x0+$x[$i]*$scaleX), (int) ($maxY-$y[$i]*$scaleY), 4, 4, $red);
+ }
+ }
+
+ imagestring($im, 1, 10, 0, "Server: " . trim ($server['s']['name']), $black);
+ imagestring($im, 1, 9, 10, "IP: " . ($lookup['type'] == 'discord' ? $lookup['ip'] : $lookup['ip'].':'.$lookup['c_port']), $black);
+ imagestring($im, 1, $w - 80, 10, "Date: " . Date("d.m.y", time()), $black);
+
+ imagepng($im);
+ imagedestroy($im);
+?>
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 58068ec..727cda8 100644
--- a/composer.json
+++ b/composer.json
@@ -2,21 +2,21 @@
"name": "tltneon/lgsl",
"description": "PHP library retrieve game servers status from various types of games.",
"homepage": "https://github.com/tltneon/lgsl",
- "type": "project",
+ "type": "library",
"license": "GPL-3.0-only",
"keywords":
[
+ "gameserver",
+ "query",
"discord",
"fivem",
- "csgo",
- "counter-strike",
- "team fortress",
+ "minecraft",
+ "cs",
"gmod",
"rust",
"dayz",
"ark",
- "samp",
- "minecraft"
+ "samp"
],
"authors": [
{
@@ -32,19 +32,33 @@
],
"support": {
"wiki": "https://github.com/tltneon/lgsl/wiki",
- "games": "https://github.com/tltneon/lgsl/wiki/Supported-Games",
+ "forum": "https://github.com/tltneon/lgsl/discussions",
"source": "https://github.com/tltneon/lgsl",
"issues": "https://github.com/tltneon/lgsl/issues"
},
+ "funding": [
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/user?u=22162275&fan_landing=true"
+ }
+ ],
"require":
{
- "php": ">=5.4"
+ "php": ">=5.4",
+ "ext-mysqli": "*",
+ "ext-bz2": "*",
+ "ext-curl": "*"
+ },
+ "suggest":
+ {
+ "ext-gd": "*",
+ "ext-mbstring": "*"
},
"autoload":
{
"psr-4":
{
- "tltneon\\lgsl\\": "lgsl/"
+ "lgsl\\": "lgsl/lgsl_files/lgsl_class.php"
}
}
}
diff --git a/index.php b/index.php
index 8d69955..6e29f12 100644
--- a/index.php
+++ b/index.php
@@ -15,7 +15,7 @@
' type='text/css' />
- " : ""); ?>
+ " : ""); ?>
diff --git a/install.php b/install.php
index 930e44e..81a6c08 100644
--- a/install.php
+++ b/install.php
@@ -16,6 +16,7 @@
}
else {
try {
+ mysqli_report(MYSQLI_REPORT_ERROR);
$lgsl_database = mysqli_connect($mysql_server, $mysql_user, $mysql_password);
if (!$lgsl_database) {
@@ -56,17 +57,35 @@
}
}
}
- if(isset($_GET['test_udp'])){
- $fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr, 3);
- if (!$fp) {
- echo "ERROR: $errno - $errstr
\n";
- echo "\n";
- } else {
- fwrite($fp, "\n");
- echo fread($fp, 26);
- echo "";
- fclose($fp);
- }
+ if(isset($_GET['test'])){
+ if(function_exists("fsockopen")){
+ $fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr, 3);
+ if (!$fp) {
+ echo "ERROR: $errno - $errstr
\n";
+ echo "\n";
+ } else {
+ fwrite($fp, "\n");
+ echo "\n";
+ fclose($fp);
+ }
+ }
+ else {
+ echo("FSOCKOPEN: FAILED\n");
+ }
+
+ if(function_exists("curl_init") && function_exists("curl_setopt") && function_exists("curl_exec")){
+ echo("CURL: SUCCESS\n");
+ }
+ else{
+ echo("CURL: FAILED\n");
+ }
+
+ if(function_exists("bzdecompress")){
+ echo("BZ2: SUCCESS\n");
+ }
+ else{
+ echo("BZ2: FAILED\n");
+ }
}
?>
@@ -130,7 +149,7 @@
//------------------------------------------------------------------------------------------------------------+
$output = '
-
+
- :
+ ?:
parallax (for Parallax Style)
map preview (on server list)
+
refresh (manually refresh server status)
+
flag-icon (replacing with svg)
@@ -251,6 +272,10 @@
Time before a server needs updating:
+
+ Enable server tracking (history):
+
+
:
@@ -325,6 +350,7 @@ function reloadLocale(){
page_mod: false,
page_lim: 15,
autoreload: false,
+ history: false,
cache_time: 60,
hide_offline: false,
public_add: false,
@@ -446,6 +472,7 @@ function generateConfig()
"$lgsl_config['public_feed'] = 0; // 1=feed requests can add new servers to your list \n" +
"$lgsl_config['cache_time'] = "+ vars.cache_time +"; // seconds=time before a server needs updating \n" +
"$lgsl_config['autoreload'] = "+ vars.autoreload +"; // 1=reloads page when cache_time is passed \n" +
+ "$lgsl_config['history'] = "+ vars.history +"; // 1=reloads page when cache_time is passed \n" +
"$lgsl_config['live_time'] = 3; // seconds=time allowed for updating servers per page load \n" +
"$lgsl_config['timeout'] = 0; // 1=gives more time for servers to respond but adds loading delay \n" +
"$lgsl_config['retry_offline'] = 0; // 1=repeats query when there is no response but adds loading delay \n" +
diff --git a/lgsl_files/icons/fivem/redm.png b/lgsl_files/icons/fivem/redm.png
new file mode 100644
index 0000000000000000000000000000000000000000..404c17614b7e00cf92e7f6f0fd2875d3c5ae4699
GIT binary patch
literal 1366
zcmV-c1*!UpP)kba8T?b4N2OBN-MI>kzhqE6JpKY7Hd(v!o^=DQ_
z_MS8qr}ghC8ItD#qCh$91JbSlc(T-9F=F5O0Ei-x6@VE4M8K_{s`h|RN)ttm2oV63
zHp$k-o&~@U&&(cv#u&zxDh+@o&jaa0K-sH9Zaw4jGfq2vbcWEX8>mZkMG1gC7dm2h
z#qejBo${RFm3iuS$fy9`|YoP!t7v1B+HlTqqhS+UZ?CgBzfxU~U?S
z2@xp(pdOP9Vw^r^S<~x&TuZWlKq$RmL7Xnd
zA|h~??;H`c#HgP*F9sYbHkASi;9nV)TZZj(-~6y+ANTlcR|ueSukI)mNGaU*1K_Me
zTIqD9KT!gP{O1b-NEE*ricLH+pSf`ZQk#Yp1!`7hSafSI(7gJ9|bp0
z4k+?NevlXYDpj!rkSz6{34j>jS+YLY4M~v_0bGO801iq9{vu5a6jv+%7p`WWZCp#G
zDRpAC2snvkJ+={OmbjlDqISq_>=k{i4&H>Kofa*i)r!+HAd2X;ZkuX$=qIPR{=gqvDY3u4@$@lBQUE-(h#tD(bN-2~lO+Qf
zzv3+Qncx5*okSHo24U}6GZk3P{n&SDBip(0i2FY41)Co-`4zx!D^7XN1l3Rz@0r<6aQIuB6ABrJKO?D+A~6#uj@kW
zuYc>viU45j;DB_a!w7Nxlrt;Z07%IWH6YPtzhdq5%@r~V02yOv0PbtmS>1T8sbTWj
z9^m3`DBCy-x9wGiX$?jF$R2_vqJY=hyVZp07*qoM6N<$f|~SSrT_o{
literal 0
HcmV?d00001
diff --git a/lgsl_files/languages/arabic.php b/lgsl_files/languages/arabic.php
index 8d32b64..4ed1171 100644
--- a/lgsl_files/languages/arabic.php
+++ b/lgsl_files/languages/arabic.php
@@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
+ $lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "رجوع إلى قائمة الخوادم";
$lgsl_config['text']['mpg'] = "إلى الصفحة الرئيسية";
/* admin section */
diff --git a/lgsl_files/languages/bulgarian.php b/lgsl_files/languages/bulgarian.php
index 06e7a6a..1ddddf6 100644
--- a/lgsl_files/languages/bulgarian.php
+++ b/lgsl_files/languages/bulgarian.php
@@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
+ $lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "ОБРАТНО КЪМ СПИСЪКА НА СЪРВЪРИТЕ";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
diff --git a/lgsl_files/languages/czech.php b/lgsl_files/languages/czech.php
index 46c311e..3af5d63 100644
--- a/lgsl_files/languages/czech.php
+++ b/lgsl_files/languages/czech.php
@@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
+ $lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "ZPĚT NA SEZNAM SLUŽEB";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
diff --git a/lgsl_files/languages/english.php b/lgsl_files/languages/english.php
index bbcc6bc..a7b8ef0 100644
--- a/lgsl_files/languages/english.php
+++ b/lgsl_files/languages/english.php
@@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
+ $lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "BACK TO SERVERS LIST";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
diff --git a/lgsl_files/languages/french.php b/lgsl_files/languages/french.php
index f86fd14..ca1cf37 100644
--- a/lgsl_files/languages/french.php
+++ b/lgsl_files/languages/french.php
@@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
+ $lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "RETOUR À LA LISTE DES SERVEURS";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
diff --git a/lgsl_files/languages/german.php b/lgsl_files/languages/german.php
index 859bd0b..347864f 100644
--- a/lgsl_files/languages/german.php
+++ b/lgsl_files/languages/german.php
@@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
+ $lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "ZURÜCK ZUR SERVERLISTE";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
diff --git a/lgsl_files/languages/russian.php b/lgsl_files/languages/russian.php
index 360f500..5b2bc0d 100644
--- a/lgsl_files/languages/russian.php
+++ b/lgsl_files/languages/russian.php
@@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
+ $lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "Вернуться к списку серверов";
$lgsl_config['text']['mpg'] = "На главную";
/* admin section */
diff --git a/lgsl_files/languages/slovak.php b/lgsl_files/languages/slovak.php
index 4bde8e2..7dfe482 100644
--- a/lgsl_files/languages/slovak.php
+++ b/lgsl_files/languages/slovak.php
@@ -53,6 +53,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
+ $lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "Spať na zoznam Serverov";
$lgsl_config['text']['mpg'] = "NA HLAVNÚ STRÁNKU";
/* admin section */
diff --git a/lgsl_files/languages/spanish.php b/lgsl_files/languages/spanish.php
index 25cf92b..9bc695a 100644
--- a/lgsl_files/languages/spanish.php
+++ b/lgsl_files/languages/spanish.php
@@ -52,6 +52,7 @@
$lgsl_config['text']['tea'] = "Team";
$lgsl_config['text']['cou'] = "Country";
$lgsl_config['text']['pin'] = "Ping";
+ $lgsl_config['text']['pag'] = "Page";
$lgsl_config['text']['bak'] = "BACK TO SERVERS LIST";
$lgsl_config['text']['mpg'] = "TO MAIN PAGE";
/* admin section */
diff --git a/lgsl_files/lgsl_admin.php b/lgsl_files/lgsl_admin.php
index 629188a..5263c1d 100644
--- a/lgsl_files/lgsl_admin.php
+++ b/lgsl_files/lgsl_admin.php
@@ -394,7 +394,7 @@
$output .= "
- NEW? |
+ NEW? |
|