Skip to content

Commit f6d435e

Browse files
Fix (web): Fix bugs in some pages
Co-authored-by: Leonard Jonathan Oh <[email protected]>
1 parent c3594b9 commit f6d435e

File tree

8 files changed

+21
-20
lines changed

8 files changed

+21
-20
lines changed

web/autocomplete.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
error('Database class does not exist. Please check your config.php file for DB_TYPE');
1414
}
1515

16-
$game = valid_request($_GET['game']);
17-
$search = valid_request($_POST['value']);
16+
$game = valid_request($_GET['game'] ?? '');
17+
$search = valid_request($_POST['value'] ?? '');
1818

1919
$game_escaped = $db->escape($game);
2020
$search_escaped = $db->escape($search);

web/pages/actioninfo.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@
172172
hlstats_Events_PlayerPlayerActions.actionId = hlstats_Actions.id AND
173173
hlstats_Players.hideranking = '0'
174174
GROUP BY
175-
hlstats_Events_PlayerPlayerActions.playerId
175+
hlstats_Events_PlayerPlayerActions.playerId,
176+
hlstats_Actions.reward_player
176177
ORDER BY
177178
$table->sort $table->sortorder,
178179
$table->sort2 $table->sortorder
@@ -214,7 +215,8 @@
214215
hlstats_Events_TeamBonuses.actionId = hlstats_Actions.id AND
215216
hlstats_Players.hideranking = '0'
216217
GROUP BY
217-
hlstats_Events_TeamBonuses.playerId
218+
hlstats_Events_TeamBonuses.playerId,
219+
hlstats_Actions.reward_player
218220
ORDER BY
219221
$table->sort $table->sortorder,
220222
$table->sort2 $table->sortorder

web/pages/ingame/actioninfo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@
4444

4545
// Addon created by Rufus ([email protected])
4646

47-
$action = valid_request($_GET['action'], true) or error('No action ID specified.');
47+
$action = valid_request($_GET['action'], true) or error('No action code specified.');
4848

4949
$db->query("
5050
SELECT
5151
description
5252
FROM
5353
hlstats_Actions
5454
WHERE
55-
id='$action_id'
55+
code='$action'
5656
AND game='$game'
5757
");
5858

web/pages/teamspeak.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function show($tpl, $array)
2424

2525

2626

27-
if (function_exists(fopen))
27+
if (function_exists('fopen'))
2828
{
2929
$db->query("SELECT addr, queryPort, UDPPort FROM hlstats_Servers_VoiceComm WHERE serverId=$tsId");
3030
$s = $db->fetch_array();
@@ -252,4 +252,4 @@ function show($tpl, $array)
252252
echo "Error, function fopen not found";
253253
}
254254

255-
?>
255+
?>

web/pages/ventrilo.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ function show($tpl, $array)
137137
{
138138
$template = PAGE_PATH."/templates/ventrilo/".$tpl;
139139

140-
if($fp = @fopen($template.".".html, "r"))
140+
if($fp = @fopen("$template.html", "r"))
141141
{
142-
$tpl = @fread($fp, filesize($template.".".html));
142+
$tpl = @fread($fp, filesize("$template.html"));
143143
}
144144
else
145145
{
@@ -216,4 +216,4 @@ function show($tpl, $array)
216216

217217
echo $outp_str;
218218

219-
?>
219+
?>

web/pages/ventrilostatus.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ class CVentriloStatus
197197

198198
var $m_channelcount; // Number of channels as specified by the server.
199199
var $m_channelfields; // Channel field names.
200-
var $m_channellist; // Array of CVentriloChannel's.
200+
var $m_channellist = []; // Array of CVentriloChannel's.
201201

202202
var $m_clientcount; // Number of clients as specified by the server.
203203
var $m_clientfields; // Client field names.
204-
var $m_clientlist; // Array of CVentriloClient's.
204+
var $m_clientlist = []; // Array of CVentriloClient's.
205205

206206
function Parse( $str )
207207
{
@@ -898,4 +898,4 @@ function __construct( $packet )
898898
}
899899
}
900900
/* end of VentResponsePacket class */
901-
?>
901+
?>

web/status.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,17 @@
315315
if ($map_image == 1)
316316
{
317317
$mapimg = getImage("/games/{$game}/maps/{$server_data['act_map']}");
318-
if (!file_exists($mapimg['path'])) {
318+
if ($mapimg && !file_exists($mapimg['path'])) {
319319
$mapimg = getImage("/games/{$game}/maps/default");
320320
if (!file_exists($mapimg['path'])) {
321321
$mapimg = getImage("/nomap");
322322
}
323+
} else {
324+
$mapimg = getImage("/nomap");
323325
}
324326

325327
echo '<tr><td align="center" colspan="2">';
326-
echo '<a target="_blank" href="'.$g_options['scriptbase'].'/hlstats.php?mode=mapinfo&amp;map='.$server_data['act_map'].'&amp;game='.$game.'"><img src="'.$mapimg['url'].'" style="width:'.$width.'px;border:0px" alt="'.$server_data['act_map'].'" title="'.$server_data['act_map'].'" /></a>';
328+
echo '<a target="_blank" href="'.$g_options['scriptbase'].'/hlstats.php?mode=mapinfo&amp;map='.$server_data['act_map'].'&amp;game='.$game.'"><img src="' . ($mapimg['url'] ?? '') . '" style="width:'.$width.'px;border:0px" alt="'.$server_data['act_map'].'" title="'.$server_data['act_map'].'" /></a>';
327329
echo '</td></tr>';
328330
}
329331

web/trend_graph.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@
6464
$color = hex2rgb(valid_request($_GET['color'], false));
6565
}
6666

67-
if (isset($_GET['player'])) {
68-
$player = (int)$_GET['player'];
69-
}
70-
67+
$player = valid_request(intval($_GET['player'] ?? ''), true);
7168
if (!$player) {
7269
exit();
7370
}

0 commit comments

Comments
 (0)