Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle95wm committed Mar 5, 2018
1 parent cbbf428 commit 492b6e8
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 140 deletions.
44 changes: 0 additions & 44 deletions Web/_admin/Fc Bans.php

This file was deleted.

28 changes: 28 additions & 0 deletions Web/_admin/Registered Consoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ final class RegisteredConsoles extends AdminPage {
private $reg_consoles = array();
private $pen_consoles = array();
private $banned_consoles = array();
private $abused_consoles = array();
private $identifierActions = array(
"add" => "regAndActivateConsole",
"act" => "activateConsole",
Expand All @@ -28,6 +29,7 @@ private function handleReq(): void {
$this->reg_consoles = $this->site->database->getRegisteredConsoles();
$this->pen_consoles = $this->site->database->getPendingConsoles();
$this->banned_consoles = $this->site->database->getBannedConsoles();
$this->abused_consoles = $this->site->database->getAbusedConsoles();
}

private function buildRegisteredTable(): void {
Expand Down Expand Up @@ -70,6 +72,21 @@ private function buildPendingTable(): void {
}
echo "</table>";
}

private function buildAbusedTable(): void {
echo '<table class="table table-striped table-bordered table-hover dataTable no-footer dtr-inline" style="width: 100%;">';
echo '<thead><tr>';
echo "<th class='sorting-asc'>MAC Address</th>";
echo '</tr></thead>';
foreach($this->abused_consoles as $row){
echo "<tr>";
echo "<td>";
echo $row[0];
echo "</td>";
echo "</tr>";

}
}

private function buildBannedTable(): void {
echo '<table class="table table-striped table-bordered table-hover dataTable no-footer dtr-inline" style="width: 100%;">';
Expand Down Expand Up @@ -147,6 +164,17 @@ protected function buildAdminPage(): void {
</div>
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-table"></i>
Abused Consoles
</div>
<div class="card-body">
<div class="table-responsive">
<?php $this->buildAbusedTable(); ?>
</div>
</div>
</div>

</div>
<!-- /.container-fluid -->
Expand Down
44 changes: 0 additions & 44 deletions Web/_admin/Sn Bans.php

This file was deleted.

6 changes: 3 additions & 3 deletions Web/_admin/User List.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private function buildBlacklistTable(): void {
echo "<input type='hidden' name='sn' id='sn' value='{$ingamesn}'>";
echo "<input type='hidden' name='fc' id='fc' value='".substr(chunk_split($this->calcFC((int)$row[0], $row[3]),4,'-'),0,-1)."'>";
echo "<input type='hidden' name='pid' id='pid' value='{$row[0]}'>";
if(in_array($nasdata['macadr'], array_column($this->banned_consoles, 'macadr'))){
if(in_array($nasdata['macadr'], array_column($this->banned_consoles, 'banned_id'))){
echo "<input type='hidden' name='action' id='action' value='macunban'><input type='hidden' name='identifier' id='identifier' value='{$nasdata['macadr']}'><input type='submit' class='btn btn-primary' value='Unban MAC'>";
} else {
echo "<input type='hidden' name='action' id='action' value='macban'><input type='hidden' name='identifier' id='identifier' value='{$nasdata['macadr']}'><input type='text' class='form-control' placeholder='Reason' name='reason' id='reason' style='width: 100px;'><input type='text' class='form-control' placeholder='# minutes' name='time' id='time' style='width: 100px;' value='0' maxlength='11'><input type='submit' class='btn btn-primary' value='Ban MAC'>";
Expand All @@ -88,7 +88,7 @@ private function buildBlacklistTable(): void {
echo "<input type='hidden' name='sn' id='sn' value='{$ingamesn}'>";
echo "<input type='hidden' name='fc' id='fc' value='".substr(chunk_split($this->calcFC((int)$row[0], $row[3]),4,'-'),0,-1)."'>";
echo "<input type='hidden' name='pid' id='pid' value='{$row[0]}'>";
if(in_array($nasdata['gsbrcd'], array_column($this->banned_profiles, 'gsbrcd'))){
if(in_array($nasdata['gsbrcd'], array_column($this->banned_profiles, 'banned_id'))){
echo "<input type='hidden' name='action' id='action' value='profileunban'><input type='hidden' name='identifier' id='identifier' value='{$nasdata['gsbrcd']}'><input type='submit' class='btn btn-primary' value='Unban Profile'>";
} else {
echo "<input type='hidden' name='action' id='action' value='profileban'><input type='hidden' name='identifier' id='identifier' value='{$nasdata['gsbrcd']}'><input type='text' class='form-control' placeholder='Reason' name='reason' id='reason' style='width: 100px;'><input type='text' class='form-control' placeholder='# minutes' name='time' id='time' style='width: 100px;' value='0' maxlength='11'><input type='submit' class='btn btn-primary' value='Ban Profile'>";
Expand All @@ -104,7 +104,7 @@ private function buildBlacklistTable(): void {
echo "<input type='hidden' name='sn' id='sn' value='{$ingamesn}'>";
echo "<input type='hidden' name='fc' id='fc' value='".substr(chunk_split($this->calcFC((int)$row[0], $row[3]),4,'-'),0,-1)."'>";
echo "<input type='hidden' name='pid' id='pid' value='{$row[0]}'>";
if(in_array($nasdata['bssid'], array_column($this->banned_aps, 'bssid'))){
if(in_array($nasdata['bssid'], array_column($this->banned_aps, 'banned_id'))){
echo "<input type='hidden' name='action' id='action' value='apunban'><input type='hidden' name='identifier' id='identifier' value='{$nasdata['bssid']}'><input type='submit' class='btn btn-primary' value='Unban W. AP'>";
} else {
echo "<input type='hidden' name='action' id='action' value='apban'><input type='hidden' name='identifier' id='identifier' value='{$nasdata['bssid']}'><input type='text' class='form-control' placeholder='Reason' name='reason' id='reason' style='width: 100px;'><input type='text' class='form-control' placeholder='# minutes' name='time' id='time' style='width: 100px;' value='0' maxlength='11'><input type='submit' class='btn btn-primary' value='Ban W. AP'>";
Expand Down
Loading

0 comments on commit 492b6e8

Please sign in to comment.