Formatage du message d'erreur d'erreur de démarrage
This commit is contained in:
parent
511752405b
commit
cbdbc29224
@ -3,26 +3,23 @@
|
||||
/**
|
||||
* Vérification de la version de PHP
|
||||
*/
|
||||
|
||||
if(version_compare(PHP_VERSION, '7.2.0', '<') ) {
|
||||
exit('PHP 7.2+ mini requis - PHP 7.2+ mini required');
|
||||
|
||||
if (version_compare(PHP_VERSION, '7.2.0', '<')) {
|
||||
displayErrorPage('PHP 7.2+ mini requis - PHP 7.2+ mini required');
|
||||
}
|
||||
|
||||
if ( version_compare(PHP_VERSION, '8.4.999', '>') ) {
|
||||
exit('PHP 8.3 pas encore supporté, installez PHP 7.n ou PHP 8.1.n - PHP 8.3 not yet supported, install PHP 7.n or PHP 8.1.n');
|
||||
if (version_compare(PHP_VERSION, '8.3.999', '>')) {
|
||||
displayErrorPage('PHP 8.3 pas encore supporté, installez PHP 7.n ou PHP 8.1.n - PHP 8.3 not yet supported, install PHP 7.n or PHP 8.1.n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check les modules installés
|
||||
*/
|
||||
|
||||
$e = [
|
||||
'gd',
|
||||
'json',
|
||||
'date',
|
||||
'mbstring',
|
||||
'zip',
|
||||
'zip',
|
||||
'intl',
|
||||
'exif',
|
||||
'Phar',
|
||||
@ -31,26 +28,57 @@ $e = [
|
||||
];
|
||||
$m = get_loaded_extensions();
|
||||
$b = false;
|
||||
$missingModules = [];
|
||||
foreach ($e as $k => $v) {
|
||||
if (array_search($v,$m) === false) {
|
||||
if (array_search($v, $m) === false) {
|
||||
$b = true;
|
||||
echo '<pre><p>Module PHP : ' . $v . ' manquant - Module PHP ' . $v . ' missing.</p></pre>';
|
||||
$missingModules[] = $v;
|
||||
}
|
||||
}
|
||||
if ($b)
|
||||
exit('<pre><p>ZwiiCMS ne peut pas démarrer ; activez les extensions requises dans PHP.ini- ZwiiCMS cannot start, enabled PHP missing extensions into PHP.ini</p></pre>');
|
||||
/**
|
||||
* Contrôle les htacess
|
||||
*/
|
||||
if ($b) {
|
||||
$errorMessage = 'ZwiiCMS ne peut pas démarrer ; les modules PHP suivants sont manquants : ' . implode(', ', $missingModules) . '<br />';
|
||||
$errorMessage .= 'ZwiiCMS cannot start, the following PHP modules are missing: ' . implode(', ', $missingModules);
|
||||
displayErrorPage($errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Contrôle les htaccess
|
||||
*/
|
||||
$d = [
|
||||
'',
|
||||
'site/data/',
|
||||
'site/backup/',
|
||||
'site/tmp/',
|
||||
// 'site/i18n/', pas contrôler pour éviter les pbs de mise à jour
|
||||
// 'site/i18n/', pas contrôler pour éviter les pbs de mise à jour
|
||||
];
|
||||
foreach ($d as $key) {
|
||||
if (file_exists($key . '.htaccess') === false)
|
||||
exit('<pre>ZwiiCMS ne peut pas démarrer, le fichier ' .$key . '.htaccess est manquant.<br />ZwiiCMS cannot start, file ' . $key . '.htaccess is missing.</pre>' );
|
||||
if (file_exists($key . '.htaccess') === false) {
|
||||
$errorMessage = 'ZwiiCMS ne peut pas démarrer, le fichier ' . $key . '.htaccess est manquant.<br />';
|
||||
$errorMessage .= 'ZwiiCMS cannot start, file ' . $key . '.htaccess is missing.';
|
||||
displayErrorPage($errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fonction pour afficher une page d'erreur stylisée
|
||||
*/
|
||||
function displayErrorPage($message)
|
||||
{
|
||||
echo '<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Erreur - ZwiiCMS</title>
|
||||
<link rel="stylesheet" href="core\layout\error.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="error-container">
|
||||
<h1>Erreur</h1>
|
||||
<p>' . $message . '</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
exit;
|
||||
}
|
||||
|
22
core/layout/error.css
Normal file
22
core/layout/error.css
Normal file
@ -0,0 +1,22 @@
|
||||
body {
|
||||
color: #000;
|
||||
font: 75%/1.7em "Helvetica Neue", Helvetica, arial, sans-serif;
|
||||
margin: 0;
|
||||
padding: 80px;
|
||||
background: url('../vendor/zwiico/png/error.png') 30px 30px no-repeat #fff;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
font-size: 300%;
|
||||
margin: 20px 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 10px 0;
|
||||
color: #777;
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
}
|
BIN
core/vendor/zwiico/png/error.png
vendored
Normal file
BIN
core/vendor/zwiico/png/error.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.6 KiB |
Loading…
x
Reference in New Issue
Block a user