From bee79c498906708385e22f5e27789e085bf981a9 Mon Sep 17 00:00:00 2001 From: Jake Birchall Date: Wed, 21 Sep 2016 12:06:48 +0100 Subject: [PATCH] Extra Error handling, + permabans --- plugins/GlobalBan.php | 16 +++++++++------- plugins/GlobalBanList.php | 6 +++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/plugins/GlobalBan.php b/plugins/GlobalBan.php index ad13443..15d0929 100644 --- a/plugins/GlobalBan.php +++ b/plugins/GlobalBan.php @@ -45,13 +45,13 @@ public function isTriggered() $fields = [ 'key' => $this->CONFIG['key'], 'uid' => $client['client_unique_identifier']->toString(), - 'ip' => $client['connection_client_ip'], - 'banned_by' => $this->info['invokername'], - 'banned_by_uid' => $this->info['invokeruid'], - 'reason' => $reason, + 'ip' => $client['connection_client_ip']->toString(), + 'banned_by' => $this->info['invokername']->toString(), + 'banned_by_uid' => $this->info['invokeruid']->toString(), + 'reason' => $reason->toString(), 'server_name' => $this->server->toString(), - 'server_uid' => $this->server['virtualserver_unique_identifier'], - 'h' => hash_pbkdf2('sha1', sprintf("%s-%s-%s", $this->CONFIG['key'], $client['client_unique_identifier']->toString(),$this->info['invokeruid']),$this->server['virtualserver_unique_identifier'], 1, 8), + 'server_uid' => $this->server['virtualserver_unique_identifier']->toString(), + 'h' => hash_pbkdf2('sha1', sprintf("%s-%s-%s", $this->CONFIG['key'], $client['client_unique_identifier']->toString(),$this->info['invokeruid']),$this->server['virtualserver_unique_identifier']->toString(), 1, 8), ]; @@ -73,7 +73,7 @@ public function isTriggered() try { $client->poke("[b][color=red]You are global banned by Nimda ID: #{$response->ban_id}"); $client->poke("[b][color=red]Visit [url=#]Global Ban Support[/url]."); - $client->ban(1, "Global Ban ID #{$response->ban_id} ({$reason})"); + $client->ban(0, "Global Ban ID #{$response->ban_id} ({$reason})"); }catch(Ts3Exception $e){ return; } @@ -81,6 +81,8 @@ public function isTriggered() $this->sendOutput(sprintf("[b][color=green] Client %s successfully global banned ID #%s", $client, $response->ban_id)); } elseif ($response->success === false && $response->err === 0x02) { $this->sendOutput("[COLOR=red][b]This server is not authorized to global ban, email support@mxgaming.com"); + } else { + $this->sendOutput("[COLOR=orange][b]Unexpected error"); } } diff --git a/plugins/GlobalBanList.php b/plugins/GlobalBanList.php index 323d3cb..bf23c71 100644 --- a/plugins/GlobalBanList.php +++ b/plugins/GlobalBanList.php @@ -65,16 +65,16 @@ public function isTriggered() if($this->CONFIG['ban'] === true && $response->uid === $this->info['client_unique_identifier']->toString()) { try { - $client->poke("[b][color=red]You are globally banned by Nimda ID: #{$response->id}"); + $client->poke("[b][color=red]You are globally banned by Nimda ID: #{$response->ban_id}"); $client->poke("[b][color=red]Visit [url=#]Global Ban Support[/url]."); - $client->ban(1, "Global Ban ID #{$response->id} ({$response->reason})"); + $client->ban(0, "Global Ban ID #{$response->ban_id} ({$response->reason})"); }catch(Ts3Exception $e){ return; } } if($this->CONFIG['alert'] === true) { - $message = sprintf("[ALERT] Client %s is global banned ID #%s reason: %s\n", $client, $response->ban_id, $response->reason); + $message = sprintf("[ALERT] Client %s is global banned ID #%s reason: %s issued Global Ban from: %s\n", $client, $response->ban_id, $response->reason, $response->server_name); array_walk(array_map([$this->server, 'serverGroupGetById'], $this->CONFIG['alert_groups']), function($admin) use ($message) { $admin->message($message); });