-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathlgsl_list.php
145 lines (119 loc) · 6.72 KB
/
lgsl_list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
/*----------------------------------------------------------------------------------------------------------\
| |
| [ LIVE GAME SERVER LIST ] [ © RICHARD PERRY FROM GREYCUBE.COM ] |
| |
| Released under the terms and conditions of the GNU General Public License Version 3 (http://gnu.org) |
| |
\-----------------------------------------------------------------------------------------------------------*/
//------------------------------------------------------------------------------------------------------------+
require "lgsl_class.php";
global $output;
$type = (isset($_GET['type']) ? $_GET['type'] : '');
$game = (isset($_GET['game']) ? $_GET['game'] : '');
$page = ($lgsl_config['pagination_mod'] && isset($_GET['page']) ? (int)$_GET['page'] : 1);
$uri = $_SERVER['REQUEST_URI'];
if ($lgsl_config['preloader']) {
$uri = htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, 'UTF-8');
}
$server_list = lgsl_query_group(array("type" => $type, "game" => $game, "page" => $page));
$server_list = lgsl_sort_servers($server_list);
//------------------------------------------------------------------------------------------------------------+
if (count($server_list) == 0 && $page < 2) {
$output .= "<div id='back_to_servers_list'><a href='./admin.php'>ADD YOUR FIRST SERVER</a></div>";
}
$output .= "
<table id='server_list_table'>
<tr id='server_list_table_top'>
<th class='status_cell'>{$lgsl_config['text']['sts']}:</th>
<th class='connectlink_cell'>{$lgsl_config['text']['adr']}:</th>
<th class='servername_cell'>{$lgsl_config['text']['tns']}:</th>
<th class='map_cell'>{$lgsl_config['text']['map']}:</th>
<th class='players_cell'>{$lgsl_config['text']['plr']}:</th>
<th class='details_cell'>{$lgsl_config['text']['dtl']}:</th>
</tr>";
foreach ($server_list as $server)
{
$misc = lgsl_server_misc($server);
$server = lgsl_server_html($server);
$percent = strval($server['s']['players'] == 0 || $server['s']['playersmax'] == 0 ? 0 : floor($server['s']['players']/$server['s']['playersmax']*100));
$lastupd = Date($lgsl_config['text']['tzn'], (int)$server['s']['cache_time']);
$gamelink= lgsl_build_link_params($uri, array("game" => $server['s']['game']));
$output .= "
<tr class='server_{$misc['text_status']}'>
<td class='status_cell'>
<span title='{$lgsl_config['text'][$misc['text_status']]} | {$lgsl_config['text']['lst']}: {$lastupd}' class='status_icon_{$misc['text_status']}'></span>
<a href='{$gamelink}'>
<img alt='{$misc['name_filtered']}' src='{$misc['icon_game']}' title='{$misc['text_type_game']}' class='game_icon'>
</a>
</td>
<td title='{$lgsl_config['text']['slk']}' class='connectlink_cell'>
<a href='{$misc['software_link']}'>
{$misc['connect_filtered']}
</a>
</td>
<td title='{$server['s']['name']}' class='servername_cell'>
<div class='servername_nolink'>
{$misc['name_filtered']}
</div>
<div class='servername_link'>
<a href='".lgsl_link($server['b']['ip'], $server['b']['c_port'])."'>
{$misc['name_filtered']}
</a>
</div>
</td>
<td class='map_cell' data-path='{$misc['image_map']}'>
{$server['s']['map']}
</td>
<td class='players_cell'>
<div class='outer_bar'>
<div class='inner_bar' style='width:{$percent}%;'>
<span class='players_numeric'>{$server['s']['players']}/{$server['s']['playersmax']}</span>
<span class='players_percent{$percent}'>{$percent}%</span>
</div>
</div>
</td>
<td class='details_cell'>";
if ($lgsl_config['locations']) {
$output .= "
<a href='".lgsl_location_link($server['o']['location'])."' target='_blank' class='contry_link'>
<img alt='{$misc['text_location']}' src='{$misc['icon_location']}' title='{$misc['text_location']}' class='contry_icon'>
</a>";
}
$output .= "
<a href='".lgsl_link($server['b']['ip'], $server['b']['c_port'])."' class='details_icon' title='{$lgsl_config['text']['vsd']}'></a>
</td>
</tr>";
}
$output .= "
</table>";
if ($lgsl_config['pagination_mod'] && ((int)(count($server_list) / $lgsl_config['pagination_lim']) > 0 || $page > 1)) {
$output .= "
<div id='pages'>
" . ($page > 1 ? "<a href='" . lgsl_build_link_params($uri, array("page" => $page - 1)) . "'> < </a>" : "") . "
<span>{$lgsl_config['text']['pag']} {$page}</span>
" . (count($server_list) < $lgsl_config['pagination_lim'] ?
"" :
(isset($_GET['page']) ?
"<a href='" . lgsl_build_link_params($uri, array("page" => $page + 1)) . "'> > </a>" :
"<a href='" . lgsl_build_link_params($uri, array("page" => 2)) ."'>></a>")) . "
</div>
";
}
//------------------------------------------------------------------------------------------------------------+
if ($lgsl_config['list']['totals']) {
$total = lgsl_group_totals($server_list);
$output .= "
<div id='totals'>
<div> {$lgsl_config['text']['tns']}: {$total['servers']} </div>
<div> {$lgsl_config['text']['tnp']}: {$total['players']} </div>
<div> {$lgsl_config['text']['tmp']}: {$total['playersmax']} </div>
</div>";
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
//------ PLEASE MAKE A DONATION OR SIGN THE GUESTBOOK AT GREYCUBE.COM IF YOU REMOVE THIS CREDIT ----------------------------------------------------------------------------------------------------+
//------ WANNA BE HERE? https://github.com/tltneon/lgsl/wiki/Who-uses-LGSL -> LET CREDITS STAY :P --------------------------------------------------------------------------------------------------+
$output .= "<div style='text-align:center; font-family:tahoma; font-size:9px; padding: 33px 0 11px 0;'><a href='https://github.com/tltneon/lgsl' style='text-decoration:none'>".lgsl_version()."</a></div>";
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
if ($lgsl_config['preloader'])
echo $output;