Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate RCON connectivity from CServerRcon to SourceQuery #612

Merged
merged 29 commits into from
Oct 12, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
628ec74
Remove flight
Groruk Sep 28, 2019
435a9fe
Add new RCON functions
Groruk Sep 28, 2019
e5fb761
Remove old status regex
Groruk Sep 28, 2019
40a408c
Update RCON function calls
Groruk Sep 28, 2019
4674cfb
Rework admin.kickit.php KickPlayer() function
Groruk Sep 28, 2019
fc1b89b
Rework admin.blockit.php BlockPlayer() function
Groruk Sep 28, 2019
89df118
Rework checkMultiplePlayers() function
Groruk Sep 28, 2019
97ede8b
Rework PasteBlock() function
Groruk Sep 28, 2019
6526e17
Rework SendMessage() function
Groruk Sep 28, 2019
4e95f92
Rework ViewCommunityProfile() function
Groruk Sep 28, 2019
f842b59
Rework RehashAdmins() function
Groruk Sep 28, 2019
8f918aa
Rework SendRcon() function
Groruk Sep 28, 2019
2894b1f
Rework KickPlayer() function
Groruk Sep 28, 2019
1e01716
Remove old CServerRcon.php
Groruk Sep 28, 2019
502f30b
Filter both names before comparing
Groruk Oct 1, 2019
c1df08c
Fix misplaced compare
Groruk Oct 1, 2019
4136311
Fix parseRconStatus() function
Groruk Oct 9, 2019
3feec38
Fix PasteBlock() function
Groruk Oct 9, 2019
9a72efe
Make SendMessage() more reliable
Groruk Oct 9, 2019
0f0ad3b
Fix for loop in RehashAdmins()
Groruk Oct 9, 2019
a5f7a56
Fix SendRcon() encoding
Groruk Oct 9, 2019
c42635f
Fix encoding in pasteBlock() function
Groruk Oct 9, 2019
6d53eeb
Adjust kick message / Fix encoding
Groruk Oct 9, 2019
ed7c04f
Remove ping & time from srvadmins subpage
Groruk Oct 9, 2019
885f85c
Fix kick messages
Groruk Oct 9, 2019
fc7ae09
(Merge conflict)
Groruk Oct 9, 2019
fe447dc
Merge branch 'v1.x' into rcon-migration
Groruk Oct 9, 2019
56b0627
(merge conflict)
Groruk Oct 9, 2019
e477e2d
Merge remote-tracking branch 'origin/rcon-migration' into rcon-migration
Groruk Oct 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions web/includes/sb-callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ function KickPlayer(int $sid, $name)
}

foreach (parseRconStatus($ret) as $player) {
if (strcmp($player['name'], $name) === 0) {
if (compareSanitizedString($player['name'], $name)) {
//Todo: Rewrite query to ignore STEAM_[01] prefix
$GLOBALS['PDO']->query(
"SELECT a.immunity AS aimmune, g.immunity AS gimmune FROM `:prefix_admins` AS a
Expand Down Expand Up @@ -1587,7 +1587,7 @@ function PasteBan(int $sid, $name, int $type = 0)
}

foreach (parseRconStatus($ret) as $player) {
if (strcmp($player['name'], $name) == 0) {
if (compareSanitizedString($player['name'], $name)) {
$steam = \SteamID\SteamID::toSteam2($player['steamid']);
$objResponse->addScript("$('nickname').value = '".addslashes($name)."'");

Expand Down Expand Up @@ -2808,7 +2808,7 @@ function ViewCommunityProfile(int $sid, $name)
}

foreach (parseRconStatus($ret) as $player) {
if (strcmp($player['name'], $name) === 0) {
if (compareSanitizedString($player['name'], $name)) {
$objResponse->addScript("$('dialog-control').setStyle('display', 'block');$('dialog-content-text').innerHTML = 'Generating Community Profile link for ".addslashes(htmlspecialchars($name)).", please wait...<br /><font color=\"green\">Done.</font><br /><br /><b>Watch the profile <a href=\"https://www.steamcommunity.com/profiles/".\SteamID\SteamID::toSteam64($player['steamid'])."/\" title=\"".addslashes(htmlspecialchars($name))."\'s Profile\" target=\"_blank\">here</a>.</b>';");
$objResponse->addScript("window.open('https://www.steamcommunity.com/profiles/".\SteamID\SteamID::toSteam64($player['steamid'])."/');");
return $objResponse;
Expand Down Expand Up @@ -3019,7 +3019,7 @@ function PasteBlock(int $sid, $name)
}

foreach (parseRconStatus($ret) as $player) {
if (strcmp($player['name'], $name) === 0) {
if (compareSanitizedString($player['name'], $name)) {
$objResponse->addScript("$('nickname').value = '" . addslashes($name) . "'");
$objResponse->addScript("$('steam').value = '" . $player['steamid'] . "'");

Expand Down
5 changes: 5 additions & 0 deletions web/includes/system-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,8 @@ function parseRconStatus(string $status)

return $players;
}

function compareSanitizedString(string $str1, string $str2)
{
return (bool)strcmp(filter_var($str1, FILTER_SANITIZE_STRING), filter_var($str2, FILTER_SANITIZE_STRING) === 0);
Groruk marked this conversation as resolved.
Show resolved Hide resolved
}