(refactor) Refactor index.php

This commit is contained in:
AGuyNamedJens 2023-03-30 01:10:55 +02:00 committed by IceToast
parent 4d97c1473b
commit 086f685780

View file

@ -52,8 +52,8 @@ $cardheader = '
</div>
<div class="card-body bg-light">';
if (! isset($_GET['step'])) {
if (! file_exists('../../.env')) {
if (!isset($_GET['step'])) {
if (!file_exists('../../.env')) {
echo run_console('cp .env.example .env');
}
echo $cardheader; ?>
@ -72,7 +72,7 @@ if (! isset($_GET['step'])) {
<p class="<?php echo count(checkExtensions()) == 0 ? 'ok' : 'notok'; ?>"> Missing
php-extentions: <?php echo count(checkExtensions()) == 0 ? 'none' : '';
foreach (checkExtensions() as $ext) {
echo $ext.', ';
echo $ext . ', ';
}
echo count(checkExtensions()) == 0 ? '' : '(Proceed anyway)'; ?></p>
@ -98,12 +98,12 @@ if (! isset($_GET['step'])) {
}
if (isset($_GET['step']) && $_GET['step'] == 2) {
echo $cardheader; ?>
<p class="login-box-msg">Lets start with your Database</p>
<?php if (isset($_GET['message'])) {
echo "<p class='notok'>".$_GET['message'].'</p>';
<p class="login-box-msg">Lets start with your Database</p>
<?php if (isset($_GET['message'])) {
echo "<p class='notok'>" . $_GET['message'] . '</p>';
} ?>
<form method="POST" enctype="multipart/form-data" class="mb-3"
<form method="POST" enctype="multipart/form-data" class="mb-3"
action="/install/forms.php" name="checkDB">
<div class="row">
@ -161,7 +161,7 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
<button class="btn btn-primary" name="checkDB">Submit</button>
</div>
</form>
</form>
</div>
@ -169,12 +169,12 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
<?php
}
if (isset($_GET['step']) && $_GET['step'] == 2.5) {
if (isset($_GET['step']) && $_GET['step'] == 2.5) {
echo $cardheader; ?>
<p class="login-box-msg">Lets feed your Database and generate some security keys!</p>
<p> This process might take a while. Please do not refresh or close this page!</p>
<?php if (isset($_GET['message'])) {
echo "<p class='notok'>".$_GET['message'].'</p>';
echo "<p class='notok'>" . $_GET['message'] . '</p>';
} ?>
<form method="POST" enctype="multipart/form-data" class="mb-3"
@ -182,21 +182,21 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
<button class="btn btn-primary" name="feedDB">Submit</button>
</div>
</form>
</div>
</div>
<?php
}
}
if (isset($_GET['step']) && $_GET['step'] == 3) {
if (isset($_GET['step']) && $_GET['step'] == 3) {
echo $cardheader; ?>
<p class="login-box-msg">Tell us something about your Host</p>
<?php if (isset($_GET['message'])) {
echo "<p class='notok'>".$_GET['message'].'</p>';
echo "<p class='notok'>" . $_GET['message'] . '</p>';
} ?>
<form method="POST" enctype="multipart/form-data" class="mb-3"
@ -210,7 +210,7 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
<label for="database">Your Dashboard URL</label>
<input id="url" name="url"
type="text" required
value="<?php echo 'https://'.$_SERVER['SERVER_NAME']; ?>" class="form-control">
value="<?php echo 'https://' . $_SERVER['SERVER_NAME']; ?>" class="form-control">
</div>
</div>
<div class="form-group">
@ -218,7 +218,7 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
<label for="name">Your Host-Name</label>
<input id="name" name="name" type="text"
required
value="Controlpanel.gg" class="form-control">
value="" class="form-control">
</div>
</div>
@ -233,14 +233,14 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
</div>
<?php
}
if (isset($_GET['step']) && $_GET['step'] == 4) {
}
if (isset($_GET['step']) && $_GET['step'] == 4) {
echo $cardheader; ?>
<p class="login-box-msg">Lets get your E-Mails going! </p>
<p class="login-box-msg">This might take a few seconds when submitted! </p>
<?php if (isset($_GET['message'])) {
echo "<p class='notok'>".$_GET['message'].'</p>';
echo "<p class='notok'>" . $_GET['message'] . '</p>';
} ?>
<form method="POST" enctype="multipart/form-data" class="mb-3"
@ -312,14 +312,16 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
</div>
<a href="?step=5"><button class="btn btn-warning">Skip this step for now</button></a>
<a href="?step=5">
<button class="btn btn-warning">Skip this step for now</button>
</a>
</div>
</div>
<?php
}
}
if (isset($_GET['step']) && $_GET['step'] == 5) {
if (isset($_GET['step']) && $_GET['step'] == 5) {
echo $cardheader; ?>
<p class="login-box-msg">Almost done! </p>
@ -327,7 +329,7 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
<?php if (isset($_GET['message'])) {
echo "<p class='notok'>".$_GET['message'].'</p>';
echo "<p class='notok'>" . $_GET['message'] . '</p>';
} ?>
<form method="POST" enctype="multipart/form-data" class="mb-3"
@ -357,7 +359,8 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="clientkey">Pterodactyl Admin-User API-Key (https://your.ptero.com/account/api)</label>
<label for="clientkey">Pterodactyl Admin-User API-Key
(https://your.ptero.com/account/api)</label>
<input id="clientkey" name="clientkey" type="text"
required
value="" class="form-control"
@ -377,14 +380,14 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
</div>
<?php
}
}
if (isset($_GET['step']) && $_GET['step'] == 6) {
if (isset($_GET['step']) && $_GET['step'] == 6) {
echo $cardheader; ?>
<p class="login-box-msg">Lets create yourself!</p>
<p class="login-box-msg">We're making the first Admin user</p>
<?php if (isset($_GET['message'])) {
echo "<p class='notok'>".$_GET['message'].'</p>';
echo "<p class='notok'>" . $_GET['message'] . '</p>';
} ?>
<form method="POST" enctype="multipart/form-data" class="mb-3"
@ -392,7 +395,8 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
<div class="form-group">
<div class="custom-control mb-3">
<label for="pteroID">Your Pterodactyl User-ID (found in the users-list on your pterodactyl dashboard)</label>
<label for="pteroID">Your Pterodactyl User-ID (found in the users-list on your pterodactyl
dashboard)</label>
<input id="pteroID" name="pteroID" type="text"
required
value="1" class="form-control">
@ -427,8 +431,8 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
</div>
<?php
}
if (isset($_GET['step']) && $_GET['step'] == 7) {
}
if (isset($_GET['step']) && $_GET['step'] == 7) {
$lockfile = fopen('../../install.lock', 'w') or exit('Unable to open file!');
fwrite($lockfile, 'locked');
fclose($lockfile);
@ -444,11 +448,11 @@ if (isset($_GET['step']) && $_GET['step'] == 2) {
</div>
<?php
}
?>
}
?>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"></script>
</body>