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

Format code with php-cs-fixer #6

Merged
merged 2 commits into from
Feb 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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