-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
248 lines (202 loc) · 8.61 KB
/
index.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<?php
// PHP RCon 2.35
// Created by Ashus, 2008-2010
require ('init.inc.php');
$header .= '
<script type="text/javascript" src="jquery.hotkeys.js"></script>
<script type="text/javascript" src="scripts.js.php?server='.$server_id.'"></script>
';
include 'header.inc.php';
echo '<div id="phprcon">
<div id="working"></div>
<h1>'.(($home_admin_link)?'<a href="'.$home_admin_link.'">Admin</a> / ':'').'PHP RCon';
if (count($servers)>1)
{
echo ' / <select name="server" class="dropdown" onchange="window.location=\'index.php?server=\'+this.value;">';
foreach ($servers as $i=>$n)
{
$n = explode(' ',$n,3);
echo '<option value="'.htmlspecialchars($i).'"'.(($i == $server_id)?' selected':'').'>'.htmlspecialchars($n[2]).'</option>';
}
echo '</select>';
}
echo '</h1>';
$s = explode('/',$lang['page_refresh_remain'],2);
echo '<div id="refreshcontainer"><a href="#" class="rconbtn rb_refresh" onclick="RefreshNow(); return false" title="Hotkey: R">'.(($disable_icons)?$s[0].'</a> '.$s[1]:$s[0].' '.$s[1].'</a>').' <span id="refreshinfo"></span> <a href="#" class="rconbtn rb_pause" onclick="StartOrStopTimer(); return false" title="Hotkey: S">' . $lang['page_refresh_start_stop'] . '</a></div><br />';
$tmp = false;
if (is_array($custom_links)) {
echo '<div id="custom_links">';
foreach ($custom_links as $clnk)
{
if ($clnk!='')
{
$clnk = explode('/',$clnk,2);
if ($tmp)
echo ' | '."\n";
if ($clnk[1] != '')
{echo '<a href="'.$clnk[1].'" target="_blank">'.htmlspecialchars($clnk[0]).'</a>';}
else {echo htmlspecialchars($clnk[0]);}
$tmp = true;
} else
{
echo '<br />';
$tmp = false;
}
}
echo '<br /><br />';
echo '</div>';
}
if (is_array($custom_cmd)) {
echo '<div id="custom_commands">';
foreach ($custom_cmd as $ccmd)
{
if ($ccmd!='')
{
$i = 0;
$ccmd = explode('/',$ccmd);
$c = count($ccmd);
if (($c % 2) != 0)
{
echo htmlspecialchars($ccmd[0]).(($c>1)?': ':'');
$i++;
}
for(;$i<$c;$i+=2)
{
// detecting custom icon
$cmd_img_background = '';
preg_match('`^[a-z0-9\_]+`i',$ccmd[$i+1],$cmd_img_classname);
$funcname = strtolower($cmd_img_classname[0]);
$cmd_img_classname = 'rconbtn rbc_'.$funcname;
$as_icon = in_array($funcname, $icons_only_default, true);
$x = explode('|',$ccmd[$i],3);
if (strlen($x[1])>0)
{
switch ($x[1])
{
case '0':
$as_icon = false;
break;
case '1':
$as_icon = true;
break;
case '2':
$as_icon = true;
$cmd_img_classname .= ' ro_text';
break;
}
}
if ($as_icon)
{
$cmd_img_classname = ' class="'.$cmd_img_classname.'"';
if (strlen($x[2])>0)
{
$tmp = 'graphics/icons-custom/'.$x[2];
if (is_file($tmp))
{$cmd_img_background = ' style="background-image: url(\''.$tmp.'\');"';}
}
} else {
$cmd_img_classname = '';
}
$ccmd[$i] = $x[0];
echo '<a href="#"'.$cmd_img_classname.$cmd_img_background.' onclick="'.((strpos($ccmd[$i+1], '%m') !== false)?'CmdMsg(\''.addslashes($ccmd[$i]).'\',\''.addslashes($ccmd[$i+1]).'\',\'\',null)':'CustomCmd(\''.addslashes($ccmd[$i+1]).'\')').'; return false" title="'.htmlspecialchars(html_entity_decode($ccmd[$i+1])).'">'.htmlspecialchars($ccmd[$i]).'</a>';
if ($i+2 < $c)
echo ' | ';
}
echo '<br />'."\n";
} else
{
echo '<br />';
}
}
echo '<br />';
echo '</div>';
}
echo '<div id="plist"></div>';
echo '<div id="res"></div>
<form method="POST" action="#" onsubmit="return HandleEnter();">
';
echo '<div id="input_controls">';
if ($suggest_enable)
{$suggest_enable = (is_file('commands/'.$game.'.txt'));}
echo '
<table width="100%"><tr>
<td width="100" style="white-space: nowrap;">'.$lang['command'].':
</td><td width="*">
<input class="query" id="cmdbox" type="text" name="cmd" size="80" value="'.htmlspecialchars($lastcmd).'" style="width: 100%" autocomplete="off" onfocus="selected_obj = \'submitcmd\'; return true;" onkeydown="selected_obj = \'submitcmd\'; return true;"'.(($suggest_enable)?' onkeyup="SuggestInit();"':'').' />
'.(($suggest_enable)?'<div id="suggest" class="suggest_inv"></div>':'').'
</td><td width="1" style="white-space: nowrap;">
<input class="button" type="button" id="submitcmd" onclick="SubmitCustomCmd(); return false;" value="'.$lang['confirm'].'" style="margin-left: 10px;" />
<input type="checkbox" id="colors" name="colors" value="1"'.(((! isset($_GET['colors']))||((int) $_GET['colors'] != 0))?' checked':'').'><label for="colors" class="rconbtn rb_colors"> '.$lang['colorized_output'].'</label>
</td></tr>';
echo '<tr><td nowrap>'.$lang['game_type'].':</td><td colspan="2">
<select name="gtype" class="dropdown" onkeydown="selected_obj = \'gtype_apply_after_map\'; return true;">
<option value="" selected> </option>';
foreach ($list_of_gtypes as $gtype)
{
$t = explode(' ',$gtype,2);
echo '<option value="'.htmlspecialchars($t[0]).'">'.htmlspecialchars($t[1]).'</option>';
}
echo '</select>
<a href="#" onclick="SubmitChangeMapOrGametype(0); return false" class="rconbtn rb_get" title="Hotkey: G">'.$lang['get'].'</a> |
<a href="#" onclick="SubmitChangeMapOrGametype(1); return false" id="gtype_apply_after_map">'.$lang['apply_after_map'].'</a> |
<a href="#" onclick="SubmitChangeMapOrGametype(2); return false" id="gtype_apply_now">'.$lang['apply_now'].'</a>'.$customhtml_gametype.'
</td></tr>
<tr><td nowrap>'.$lang['map'].':</td><td colspan="2">
<select name="map" class="dropdown" onkeydown="selected_obj = \'map_apply_now\'; return true;">
<option value="restart" selected>[restart]</option>';
foreach ($list_of_maps as $map)
{
$t = explode(' ',$map,2);
echo '<option value="'.htmlspecialchars($t[0]).'">'.htmlspecialchars($t[1]).'</option>';
}
echo '</select>
<a href="#" onclick="SubmitChangeMapOrGametype(3); return false" id="map_apply_now">'.$lang['apply_now'].'</a>'.$customhtml_map.'
</td></tr></table>
</div>
<div id="settings_frame">
<a href="#" class="rconbtn ro_text rb_settings" onclick="SwitchDiv(\'settings\'); return false">'.$lang['settings'].'</a><br />';
echo '
<div id="settings">
<table><tr><td nowrap>'.$lang['public_password'].':</td><td>
<input class="query" type="password" size="30" name="pass" id="public_password" value="" onfocus="selected_obj = \'pass_confirm\'; return true;" onkeydown="selected_obj = \'pass_confirm\'; return true;" autocomplete="off" />
<a href="#" class="rconbtn rb_ok" onclick="SubmitChangePass(); return false" id="pass_confirm">'.$lang['confirm'].'</a>
';
if (count($list_of_weapons)>0)
{
echo '</td></tr>
<tr><td valign="top" nowrap>'.$lang['weapons'].':</td><td>';
function AddSetting($name)
{
global $lang, $disable_icons;
echo '<a href="#" class="rconbtn rb_get" onclick="SubmitChangeWeapon(\''.$name.'\',-1); return false">'.$lang['get'].'</a>'.(($disable_icons)?' | ':' ').'
<a href="#" class="rconbtn rb_disable" onclick="SubmitChangeWeapon(\''.$name.'\',0); return false">'.$lang['turn_off'].'</a>'.(($disable_icons)?' | ':' ').'
<a href="#" class="rconbtn rb_enable" onclick="SubmitChangeWeapon(\''.$name.'\',1); return false">'.$lang['turn_on'].'</a> '
.htmlspecialchars((($lang[$name]=='')?$name:$lang[$name])).'<br />';
}
foreach ($list_of_weapons as $weapon)
{
AddSetting($weapon);
}
}
echo '</td></tr></table></div></div>
</form>
';
if (($screenshots_enable) && (isset($screenshots_path)) && (($_SESSION['sess_rcon_rights'] == 1) || (($_SESSION['sess_rcon_rights'] == 2) && (in_array('pb_sv_getss', $commands_enabled, true)))))
{
echo '<div id="screenshots_frame">
<a href="#" class="rconbtn ro_text rb_screenshots" onclick="ShowHideScreenshots(); return false">'.$lang['screenshots'].'</a><br />
<div id="screenshot_img"></div>
<div id="screenshots"></div>
';
}
if (($log_enable) && ($_SESSION['sess_rcon_rights'] == 1))
{
echo '<div id="log_frame">
<a href="#" class="rconbtn ro_text rb_log" onclick="ShowHideLog(); return false">'.$lang['log'].'</a><br />
<div id="log">
</div>';
}
echo '<br /><br /><small>PHP RCon 2.34 created by <a href="http://ashus.ashus.net/" target="_blank">Ashus</a>, 2008-2010</small>
</div>';
include 'footer.inc.php';
?>