separate view and controller logic
This commit is contained in:
parent
58dda79c6a
commit
320a229d4f
|
@ -29,38 +29,23 @@ if (!isset($_SESSION['lestencrypt-domains']) || empty($_SESSION['letsencrypt-dom
|
||||||
$_SESSION['letsencrypt-domains'] = $domains;
|
$_SESSION['letsencrypt-domains'] = $domains;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($params[2]) && $params[2] == "check") {
|
include_once EVOADMIN_BASE . '../tpl/header.tpl.php';
|
||||||
include_once EVOADMIN_BASE . '../tpl/header.tpl.php';
|
include_once EVOADMIN_BASE . '../tpl/menu.tpl.php';
|
||||||
include_once EVOADMIN_BASE . '../tpl/menu.tpl.php';
|
|
||||||
|
|
||||||
|
if (isset($_POST['submit'])) {
|
||||||
$letsencrypt = new letsencryt();
|
$letsencrypt = new letsencryt();
|
||||||
|
|
||||||
// check HTTP
|
// check HTTP
|
||||||
$checked_domains = $letsencrypt->checkRemoteResourceAvailability($_SESSION['letsencrypt-domains']);
|
$checked_domains = $letsencrypt->checkRemoteResourceAvailability($_SESSION['letsencrypt-domains']);
|
||||||
$failed_domains_http = array_diff($_SESSION['letsencrypt-domains'], $checked_domains);
|
$failed_domains_http = array_diff($_SESSION['letsencrypt-domains'], $checked_domains);
|
||||||
|
|
||||||
# debug à améliorer
|
if (empty($failed_domains_http) && !empty($checked_domains)) {
|
||||||
echo '<h2>The following domain(s) failed the HTTP challenge</h2>';
|
// check DNS
|
||||||
foreach ($failed_domains_http as $failed_domain) {
|
|
||||||
echo $failed_domain . '<br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// check DNS
|
|
||||||
if (!empty($checked_domains)) {
|
|
||||||
$valid_domains = $letsencrypt->checkDNSValidity($checked_domains);
|
$valid_domains = $letsencrypt->checkDNSValidity($checked_domains);
|
||||||
$failed_domains_dns = array_diff($checked_domains, $valid_domains);
|
$failed_domains_dns = array_diff($checked_domains, $valid_domains);
|
||||||
|
|
||||||
# debug à améliorer
|
|
||||||
echo '<h2>The following domain(s) failed the DNS check</h2>';
|
|
||||||
foreach ($failed_domains_dns as $failed_domain) {
|
|
||||||
echo $failed_domain . '<br>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once EVOADMIN_BASE . '../tpl/footer.tpl.php';
|
|
||||||
} else {
|
} else {
|
||||||
include_once EVOADMIN_BASE . '../tpl/header.tpl.php';
|
// page de base
|
||||||
include_once EVOADMIN_BASE . '../tpl/menu.tpl.php';
|
|
||||||
include_once EVOADMIN_BASE . '../tpl/webadmin-letsencrypt.tpl.php';
|
|
||||||
include_once EVOADMIN_BASE . '../tpl/footer.tpl.php';
|
|
||||||
}
|
}
|
||||||
|
include_once EVOADMIN_BASE . '../tpl/webadmin-letsencrypt.tpl.php';
|
||||||
|
include_once EVOADMIN_BASE . '../tpl/footer.tpl.php';
|
||||||
|
|
|
@ -1,20 +1,46 @@
|
||||||
<h2>Gestion Let's Encrypt</h2>
|
<h2>Gestion Let's Encrypt</h2>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (count($_SESSION['letsencrypt-domains']) > 0) {
|
if (isset($_POST['submit'])) {
|
||||||
?>
|
if (count($failed_domains_http) > 0) {
|
||||||
|
echo '<h3 class="form-error">Erreur HTTP</h3>';
|
||||||
|
|
||||||
<p>Liste des domaines à intégrer dans le certificat : </p>
|
echo '<p>';
|
||||||
<ul>
|
echo 'Le challenge HTTP a échoué pour le(s) domaine(s) ci-dessous.
|
||||||
<?php
|
Merci de vérifier que le dossier <code>/.well-known/acme-challenge/</code> est accessible.';
|
||||||
foreach ($_SESSION['letsencrypt-domains'] as $domain) {
|
echo '</p>';
|
||||||
echo '<li>' . $domain . '</li>';
|
|
||||||
|
echo '<p>';
|
||||||
|
foreach ($failed_domains_http as $failed_domain) {
|
||||||
|
echo $failed_domain . "<br>";
|
||||||
|
}
|
||||||
|
echo '</p>';
|
||||||
|
} elseif (count($failed_domains_dns) > 0) {
|
||||||
|
echo '<h3 class="form-error">Erreur DNS</h3>';
|
||||||
|
|
||||||
|
echo '<p>';
|
||||||
|
echo 'La vérification DNS a échoué pour les domaines ci-dessous.
|
||||||
|
Merci de vérifier les enregistrements de type A et AAAA.';
|
||||||
|
echo '</p>';
|
||||||
|
|
||||||
|
foreach ($failed_domains_dns as $failed_domain) {
|
||||||
|
echo $failed_domain . "<br>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "all checks succeeded";
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
} else {
|
} else {
|
||||||
print "<p>Aucun domaine.</p>";
|
echo "<p>Les domaines suivants seront intégrés au certificat : </p>";
|
||||||
|
if (count($_SESSION['letsencrypt-domains']) > 0) {
|
||||||
|
echo '<p>';
|
||||||
|
foreach ($_SESSION['letsencrypt-domains'] as $domain) {
|
||||||
|
echo $domain . '<br>';
|
||||||
|
}
|
||||||
|
echo '</p>';
|
||||||
|
?>
|
||||||
|
<form name="form-confirm-delete-alias" id="form-confirm-delete-alias" action="" method="POST">
|
||||||
|
<p><input type="submit" name="submit" value="Poursuivre l'installation du certificat" style="margin-left:0px;"></p>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue