diff --git a/images/order_asc.gif b/images/order_asc.gif
new file mode 100644
index 00000000..c9698a5a
Binary files /dev/null and b/images/order_asc.gif differ
diff --git a/images/order_desc.gif b/images/order_desc.gif
new file mode 100644
index 00000000..4a764bd5
Binary files /dev/null and b/images/order_desc.gif differ
diff --git a/system/pages/online.php b/system/pages/online.php
index f292a4b1..e1bc25d4 100644
--- a/system/pages/online.php
+++ b/system/pages/online.php
@@ -22,13 +22,16 @@ $promotion = '';
if($db->hasColumn('players', 'promotion'))
$promotion = '`promotion`,';
-$order = $_GET['order'] ?? 'name';
-if(!in_array($order, array('country', 'name', 'level', 'vocation')))
- $order = $db->fieldName('name');
-else if($order == 'country')
- $order = $db->tableName('accounts') . '.' . $db->fieldName('country');
-else if($order == 'vocation')
- $order = $promotion . 'vocation ASC';
+$order = $_GET['order'] ?? 'name_asc';
+if(!in_array($order, ['country_asc', 'country_desc', 'name_asc', 'name_desc', 'level_asc', 'level_desc', 'vocation_asc', 'vocation_desc'])) {
+ $order = 'name_asc';
+}
+else if($order == 'vocation_asc' || $order == 'vocation_desc') {
+ $order = $promotion . 'vocation_' . (str_contains($order, 'asc') ? 'asc' : 'desc');
+}
+
+$orderExplode = explode('_', $order);
+$orderSql = $orderExplode[0] . ' ' . $orderExplode[1];
$skull_type = 'skull';
if($db->hasColumn('players', 'skull_type')) {
@@ -58,11 +61,11 @@ if (setting('core.online_vocations')) {
}
if($db->hasTable('players_online')) // tfs 1.0
- $playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
+ $playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $orderSql);
else
- $playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', ' . $promotion . ' `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
+ $playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', ' . $promotion . ' `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $orderSql);
-$players_data = array();
+$players_data = [];
$players = 0;
$data = '';
foreach($playersOnline as $player) {
@@ -115,7 +118,7 @@ if(count($players_data) > 0) {
}
if($result) {
- $record = 'The maximum on this game world was ' . $result['record'] . ' players' . ($timestamp ? ' on ' . date("M d Y, H:i:s", $result['timestamp']) . '.' : '.');
+ $record = $result['record'] . ' player' . ($result['record'] > 1 ? 's' : '') . ($timestamp ? ' (on ' . date("M d Y, H:i:s", $result['timestamp']) . ')' : '');
}
}
}
@@ -124,6 +127,7 @@ $twig->display('online.html.twig', array(
'players' => $players_data,
'record' => $record,
'vocs' => $vocs,
+ 'order' => $order,
));
//search bar
diff --git a/system/settings.php b/system/settings.php
index 4cfe5c9f..40c8be03 100644
--- a/system/settings.php
+++ b/system/settings.php
@@ -1264,6 +1264,12 @@ Sent by MyAAC,
'desc' => '',
'default' => false,
],
+ 'online_datacenter' => [
+ 'name' => 'Data Center',
+ 'type' => 'text',
+ 'desc' => 'Server Location, will be shown on online page',
+ 'default' => 'Frankfurt - Germany',
+ ],
[
'type' => 'section',
'title' => 'Team Page'
diff --git a/system/templates/online.html.twig b/system/templates/online.html.twig
index 0210d80f..2555873e 100644
--- a/system/templates/online.html.twig
+++ b/system/templates/online.html.twig
@@ -1,39 +1,7 @@
-
-
- Server Status |
-
-{% if players|length == 0 %}
- Currently no one is playing on {{ config.lua.serverName }}. |
-{% else %}
-
-
- {% if not status.online %}
- Server is offline.
- {% else %}
- {% if setting('core.online_afk') %}
- {% set players_count = players|length %}
- {% set afk = players_count - status.players %}
- {% if afk < 0 %}
- {% set players_count = players_count + afk|abs %}
- {% set afk = 0 %}
- {% endif %}
- Currently there are {{ status.players }} active and {{ afk }} AFK players.
- Total number of players: {{ players_count }}.
- {% else %}
- Currently {{ players|length }} players are online.
- {% endif %}
- {% endif %}
- {% if setting('core.online_record') %}
- {{ record }}
- {% endif %}
- |
-
-
+{# vocation statistics #}
+{% if setting('core.online_vocations') %}
- {# vocation statistics #}
- {% if setting('core.online_vocations') %}
-
- {% if setting('core.online_vocations_images') %}
+ {% if setting('core.online_vocations_images') %}
 |
@@ -69,11 +37,13 @@
{% endfor %}
- {% endif %}
{% endif %}
+{% endif %}
- {# show skulls #}
- {% if setting('core.online_skulls') %}
+
+
+{# show skulls #}
+{% if setting('core.online_skulls') %}
+{% endif %}
+
+
+
+{% set title = 'World Information' %}
+{% set tableClass = 'Table3' %}
+{% set background = config('darkborder') %}
+{% set content %}
+
+
+ Status: |
+ {% if not status.online %}Offline{% else %}Online{% endif %} |
+
+
+ Players Online: |
+
+ {% if setting('core.online_afk') %}
+ {% set players_count = players|length %}
+ {% set afk = players_count - status.players %}
+ {% if afk < 0 %}
+ {% set players_count = players_count + afk|abs %}
+ {% set afk = 0 %}
+ {% endif %}
+ Currently there are {{ status.players }} active and {{ afk }} AFK players.
+ Total number of players: {{ players_count }}.
+ {% else %}
+ {{ players|length }} Players Online.
+ {% endif %}
+ |
+
+
+ {% if setting('core.online_record') %}
+
+ Online Record: |
+
+ {{ record }}
+ |
+
{% endif %}
-
-
+
+ Location Datacenter: |
+ {{ setting('core.online_datacenter') }} (Server date & time: - {{ "now"|date("d/m/Y H:i:s") }}) |
+
+
+ PvP Type: |
+
+ {% set worldType = config('lua')['worldType']|lower %}
+ {% if worldType in ['pvp','2','normal','open','openpvp'] %}
+ Open PvP
+ {% elseif worldType in ['no-pvp','nopvp','non-pvp','nonpvp','1','safe','optional','optionalpvp'] %}
+ Optional PvP
+ {% elseif worldType in ['pvp-enforced','pvpenforced','pvp-enfo','pvpenfo','pvpe','enforced','enfo','3','war','hardcore','hardcorepvp'] %}
+ Hardcore PvP
+ {% endif %}
+ |
+
+
+{% endset %}
+{% include 'tables.headline.html.twig' %}
+
+
+
+{% set title = 'Players Online' %}
+{% set tableClass = 'Table2' %}
+{% set content %}
+
+
{% if setting('core.account_country') %}
- # |
+ #
+ |
{% endif %}
{% if setting('core.online_outfit') %}
- Outfit |
+ Outfit |
{% endif %}
- Name |
- Level |
- Vocation |
+ Name
+ [sort]
+  }}.gif) |
+ Level
+ [sort]
+
+ |
+ Vocation
+ [sort]
+
+ |
+
{% set i = 0 %}
{% for player in players %}
{% set i = i + 1 %}
-
- {% if setting('core.account_country') %}
- {{ player.country_image|raw }} |
- {% endif %}
- {% if setting('core.online_outfit') %}
-  |
- {% endif %}
- {{ player.name|raw }}{{ player.skull }} |
- {{ player.level }} |
- {{ player.vocation }} |
+
+
+ {% if setting('core.account_country') %}
+ {{ player.country_image|raw }} |
+ {% endif %}
+
+ {% if setting('core.online_outfit') %}
+  |
+ {% endif %}
+
+
+ {{ player.name|raw }}{{ player.skull }}
+ |
+ {{ player.level }} |
+ {{ player.vocation }} |
{% endfor %}
-{% endif %}
+{% endset %}
+{{ include('tables.headline.html.twig') }}