Skip to content

Commit

Permalink
Merge pull request #6 from clynt707/deepsource-transform-6703097a
Browse files Browse the repository at this point in the history
Format code with php-cs-fixer
  • Loading branch information
NotClynt authored Feb 5, 2022
2 parents 4adc844 + 887fdd1 commit 7b4aad4
Show file tree
Hide file tree
Showing 35 changed files with 1,706 additions and 1,925 deletions.
233 changes: 115 additions & 118 deletions admin/cheat.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

include '../includes/db.php';

$user = new UserController;
$cheat = new CheatController;
$admin = new AdminController;
$user = new UserController();
$cheat = new CheatController();
$admin = new AdminController();

Session::init();

Expand All @@ -18,124 +18,121 @@
Util::head('Admin Panel');
Util::navbar();

// if post request
// if post request
if ($_SERVER['REQUEST_METHOD'] === 'POST') {


if (isset($_POST["cheatStatus"])) {
$admin->setCheatStatus();
$sql = "INSERT INTO `logs` (`log_user`, `log_action`, `log_time`) VALUES ('$username', 'Set cheat status to " . $_POST['cheatStatus'] . "', NOW())";

$webhook = ADMIN_WEBHOOK;
$embed = array(
"title" => "Cheat Status",
"description" => "$username has set the cheat status to " . $_POST['cheatStatus'],
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);

$result = $mysqli->query($sql);
}

if (isset($_POST["cheatMaint"])) {
$admin->setCheatMaint();
$sql = "INSERT INTO `logs` (`log_user`, `log_action`, `log_time`) VALUES ('$username', 'Set cheat maintenance to " . $_POST['cheatMaint'] . "', NOW())";

$webhook = ADMIN_WEBHOOK;
$embed = array(
"title" => "Cheat Maintenance",
"description" => "$username has set the cheat maintenance to " . $_POST['cheatMaint'],
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);
$result = $mysqli->query($sql);
}

if (isset($_POST["cheatVersion"])) {
$ver = floatval($_POST['version']);
$admin->setCheatVersion($ver);
$sql = "INSERT INTO `logs` (`log_user`, `log_action`, `log_time`) VALUES ('$username', 'Set cheat version to " . $_POST['version'] . "', NOW())";

$webhook = ADMIN_WEBHOOK;
$embed = array(
"title" => "Cheat Version",
"description" => "$username has set the cheat version to " . $_POST['version'],
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);

$result = $mysqli->query($sql);
}

header("location: cheat");

if (isset($_POST["cheatStatus"])) {
$admin->setCheatStatus();
$sql = "INSERT INTO `logs` (`log_user`, `log_action`, `log_time`) VALUES ('$username', 'Set cheat status to " . $_POST['cheatStatus'] . "', NOW())";

$webhook = ADMIN_WEBHOOK;
$embed = array(
"title" => "Cheat Status",
"description" => "$username has set the cheat status to " . $_POST['cheatStatus'],
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);

$result = $mysqli->query($sql);
}

if (isset($_POST["cheatMaint"])) {
$admin->setCheatMaint();
$sql = "INSERT INTO `logs` (`log_user`, `log_action`, `log_time`) VALUES ('$username', 'Set cheat maintenance to " . $_POST['cheatMaint'] . "', NOW())";

$webhook = ADMIN_WEBHOOK;
$embed = array(
"title" => "Cheat Maintenance",
"description" => "$username has set the cheat maintenance to " . $_POST['cheatMaint'],
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);
$result = $mysqli->query($sql);
}

if (isset($_POST["cheatVersion"])) {
$ver = floatval($_POST['version']);
$admin->setCheatVersion($ver);
$sql = "INSERT INTO `logs` (`log_user`, `log_action`, `log_time`) VALUES ('$username', 'Set cheat version to " . $_POST['version'] . "', NOW())";

$webhook = ADMIN_WEBHOOK;
$embed = array(
"title" => "Cheat Version",
"description" => "$username has set the cheat version to " . $_POST['version'],
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);

$result = $mysqli->query($sql);
}

header("location: cheat");
}

if(isset($_POST['set_motd'])) {
// update motd in cheat table
$motd = $_POST['motd'];
$sql = "UPDATE cheat SET motd = '$motd'";
$result = mysqli_query($mysqli, $sql);
$sql = "INSERT INTO `logs` (`log_user`, `log_action`, `log_time`) VALUES ('$username', 'Set MOTD to " . $_POST['motd'] . "', NOW())";

$webhook = ADMIN_WEBHOOK;
$embed = array(
"title" => "MOTD",
"description" => "$username has set the MOTD to " . $_POST['motd'],
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);

$result = $mysqli->query($sql);
Util::redirect('/admin/cheat');
if (isset($_POST['set_motd'])) {
// update motd in cheat table
$motd = $_POST['motd'];
$sql = "UPDATE cheat SET motd = '$motd'";
$result = mysqli_query($mysqli, $sql);
$sql = "INSERT INTO `logs` (`log_user`, `log_action`, `log_time`) VALUES ('$username', 'Set MOTD to " . $_POST['motd'] . "', NOW())";

$webhook = ADMIN_WEBHOOK;
$embed = array(
"title" => "MOTD",
"description" => "$username has set the MOTD to " . $_POST['motd'],
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);

$result = $mysqli->query($sql);
Util::redirect('/admin/cheat');
}

?>
Expand Down
4 changes: 2 additions & 2 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

include '../includes/db.php';

$user = new UserController;
$admin = new AdminController;
$user = new UserController();
$admin = new AdminController();

Session::init();

Expand Down
67 changes: 31 additions & 36 deletions admin/invites.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
require_once '../app/require.php';
require_once '../app/controllers/AdminController.php';

$user = new UserController;
$admin = new AdminController;
$user = new UserController();
$admin = new AdminController();

Session::init();

Expand All @@ -18,41 +18,36 @@
Util::head('Admin Panel');
Util::navbar();

// if post request
// if post request
if ($_SERVER['REQUEST_METHOD'] === 'POST') {


if (isset($_POST["genInv"])) {
$admin->getInvCodeGen($username);
$sql = "INSERT INTO `logs` (`log_user`, `log_action`, `log_time`) VALUES ('$username', 'Generated Invite Code', NOW())";
$result = $mysqli->query($sql);

//
$webhook = INVITE_WEBHOOK;
$embed = array(
"title" => "New Invite Code",
"description" => "A new invite code has been generated by $username",
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);

}

header("location: invites");


if (isset($_POST["genInv"])) {
$admin->getInvCodeGen($username);
$sql = "INSERT INTO `logs` (`log_user`, `log_action`, `log_time`) VALUES ('$username', 'Generated Invite Code', NOW())";
$result = $mysqli->query($sql);

//
$webhook = INVITE_WEBHOOK;
$embed = array(
"title" => "New Invite Code",
"description" => "A new invite code has been generated by $username",
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);
}

header("location: invites");
}
?>

Expand Down
42 changes: 21 additions & 21 deletions admin/logs.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
require_once '../app/require.php';
require_once '../app/controllers/AdminController.php';

$user = new UserController;
$admin = new AdminController;
$user = new UserController();
$admin = new AdminController();

Session::init();

Expand All @@ -24,25 +24,25 @@
if ($result) {
$sql = "INSERT INTO `logs` (`log_user`, `log_action`, `log_time`) VALUES ('$username', 'Deleted all logs', NOW())";

$webhook = ADMIN_WEBHOOK;
$embed = array(
"title" => "Logs Deleted",
"description" => "$username has deleted all logs",
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);
$webhook = ADMIN_WEBHOOK;
$embed = array(
"title" => "Logs Deleted",
"description" => "$username has deleted all logs",
"color" => 0x00ff00
);
$data = array(
"embeds" => array($embed)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
// send webhook
$context = stream_context_create($options);
$result = file_get_contents($webhook, false, $context);

$result = $mysqli->query($sql);
Util::redirect('/admin/logs');
Expand Down
Loading

0 comments on commit 7b4aad4

Please sign in to comment.