Deltacms/core/module/config/view/setup/setup.php

295 lines
11 KiB
PHP

<script src="core/vendor/jspdf/jspdf.min.js"></script>
<?php
// Lexique
$text = [];
$val = $this->getData(['config', 'i18n', 'langAdmin']);
switch ($val) {
case 'fr' :
$text[0] = 'Paramètres';
$text[1] = 'Mise à jour automatisée';
$text[2] = 'Maintenance';
$text[3] = 'Pensez à supprimer le cache de votre navigateur si la favicon ne change pas.';
$text[4] = 'Favicon';
$text[5] = 'Sélectionnez une icône adaptée à un thème sombre.<br>Pensez à supprimer le cache de votre navigateur si la favicon ne change pas.';
$text[6] = 'Favicon thème sombre';
$text[7] = 'Fuseau horaire';
$text[8] = 'Le fuseau horaire est utile au bon référencement';
$text[9] = 'Message de consentement aux cookies';
$text[10] = 'Activation obligatoire selon les lois françaises sauf si vous utilisez votre propre système de consentement.';
$text[11] = 'URL intelligentes';
$text[12] = 'Vérifiez d\'abord que votre serveur autorise l\'URL rewriting (ce qui n\'est pas le cas chez Free).';
$text[13] = 'Rechercher une mise à jour en ligne';
$text[14] = 'La vérification est quotidienne. Option désactivée si la configuration du serveur ne le permet pas.';
$text[15] = 'Préserver le fichier htaccess racine';
$text[16] = 'Lors d\'une mise à jour automatique, conserve le fichier htaccess de la racine du site.';
$text[17] = 'Réinstaller';
$text[18] = 'Sauvegarde automatique quotidienne du site';
$text[19] = 'Une archive contenant le dossier /site/data est copiée dans le dossier \'site/backup\'. La sauvegarde est conservée pendant 30 jours.</p><p>Les fichiers du site ne sont pas sauvegardés automatiquement. Activation recommandée.';
$text[20] = 'Site en maintenance';
$text[21] = 'Sauvegarder';
$text[22] = 'Restaurer';
$text[23] = 'Copie sauvegardes auto';
$text[24] = 'Informations à transmettre au support en cas de dysfonctionnement';
$text[25] = 'Version de Deltacms: ';
$text[26] = 'Version de PHP: ';
$text[27] = 'Type de serveur: ';
$text[28] = 'URL intelligentes: ';
$text[29] = 'oui';
$text[30] = 'non';
$text[31] = 'Modules PHP installés: ';
$text[32] = 'Module(s) absent(s): ';
$text[33] = 'Les modules nécessaires sont installés.';
$text[34] = 'Modules Deltacms installés: ';
$text[35] = 'Générer un pdf';
break;
case 'en' :
$text[0] = 'Parameters';
$text[1] = 'Automated update';
$text[2] = 'Maintenance';
$text[3] = 'Remember to clear your browser\'s cache if the favicon does not change';
$text[4] = 'Favicon';
$text[5] = 'Select a suitable icon for a dark theme.<br>Remember to clear your browser\'s cache if the favicon does not change.';
$text[6] = 'Favicon dark theme';
$text[7] = 'Time zone';
$text[8] = 'The time zone is useful for good referencing';
$text[9] = 'Cookie consent message';
$text[10] = 'Mandatory activation under French law unless you use your own consent system';
$text[11] = 'Smart URLs';
$text[12] = 'First check that your server allows URL rewriting (which is not the case with Free)';
$text[13] = 'Search for an online update';
$text[14] = 'The check is daily. Option disabled if server configuration does not allow it.';
$text[15] = 'Preserve the root htaccess file';
$text[16] = 'On auto-update, keep the root htaccess file';
$text[17] = 'Reinstall';
$text[18] = 'Automatic daily site backup';
$text[19] = 'An archive containing the folder /site/data is copied to the folder \'site/backup\'. The backup is kept for 30 days.</p><p>Site files are not backed up automatically. Activation recommended.';
$text[20] = 'Site under maintenance';
$text[21] = 'Save';
$text[22] = 'Restore';
$text[23] = 'Auto backup copy';
$text[24] = 'Information to send to support in case of malfunction';
$text[25] = 'Deltacms version: ';
$text[26] = 'PHP version: ';
$text[27] = 'Server type: ';
$text[28] = 'Smart URL: ';
$text[29] = 'yes';
$text[30] = 'no';
$text[31] = 'PHP modules installed: ';
$text[32] = 'Module(s) missing: ';
$text[33] = 'The necessary modules are installed.';
$text[34] = 'Deltacms modules installed: ';
$text[35] = 'Generate a pdf';
break;
}
?>
<div id="setupContainer">
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo $text[0]; ?>
<span id="setupHelpButton" class="helpDisplayButton">
<a href="https://doc.deltacms.fr/configuration" target="_blank">
<?php echo template::ico('help', 'left');?>
</a>
</span>
</h4>
<div class="row">
<div class="col4">
<?php echo template::file('configFavicon', [
'type' => 1,
'help' => $text[3],
'label' => $text[4],
'value' => $this->getData(['config', 'favicon'])
]); ?>
</div>
<div class="col4">
<?php echo template::file('configFaviconDark', [
'type' => 1,
'help' => $text[5],
'label' => $text[6],
'value' => $this->getData(['config', 'faviconDark'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('configTimezone', $module::$timezones, [
'label' => $text[7],
'selected' => $this->getData(['config', 'timezone']),
'help' => $text[8]
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('configCookieConsent', true, $text[9], [
'checked' => $this->getData(['config', 'cookieConsent']),
'help' => $text[10]
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('configRewrite', true, $text[11], [
'checked' => helper::checkRewrite(),
'help' => $text[12]
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo $text[1]; ?>
<span id="updateHelpButton" class="helpDisplayButton">
<a href="https://doc.deltacms.fr/configuration#mise-a-jour" target="_blank">
<?php echo template::ico('help', 'left');?>
</a>
</span>
</h4>
<?php $updateError = helper::urlGetContents(common::DELTA_UPDATE_URL . common::DELTA_UPDATE_CHANNEL . '/version');?>
<div class="row">
<div class="col4">
<?php echo template::checkbox('configAutoUpdate', true, $text[13], [
'checked' => $this->getData(['config', 'autoUpdate']),
'help' => $text[14],
'disabled' => !$updateError
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('configAutoUpdateHtaccess', true, $text[15], [
'checked' => $this->getData(['config', 'autoUpdateHtaccess']),
'help' => $text[16],
'disabled' => !$updateError
]); ?>
</div>
<div class="col2 offset1">
<?php echo template::button('configUpdateForced', [
'ico' => 'download-cloud',
'href' => helper::baseUrl() . 'install/update',
'value' => $text[17],
'class' => 'buttonRed',
'disabled' => !$updateError
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo $text[2]; ?>
<span id="maintenanceHelpButton" class="helpDisplayButton">
<a href="https://doc.deltacms.fr/configuration#maintenance" target="_blank">
<?php echo template::ico('help', 'left');?>
</a>
</span>
</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('configAutoBackup', true, $text[18], [
'checked' => $this->getData(['config', 'autoBackup']),
'help' => $text[19]
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('configMaintenance', true, $text[20], [
'checked' => $this->getData(['config', 'maintenance'])
]); ?>
</div>
</div>
<div class="rows textAlignCenter">
<div class="col3">
<?php echo template::button('configBackupButton', [
'href' => helper::baseUrl() . 'config/backup',
'value' => $text[21],
'ico' => 'download-cloud'
]); ?>
</div>
<div class="col3">
<?php echo template::button('configRestoreButton', [
'href' => helper::baseUrl() . 'config/restore',
'value' => $text[22],
'ico' => 'upload-cloud'
]); ?>
</div>
<div class="col3">
<?php echo template::button('configBackupCopyButton', [
'href' => helper::baseUrl() . 'config/copyBackups',
'value' => $text[23],
'ico' => 'download-cloud'
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<div id="infotopdf">
<h4><?php echo $text[24]; ?></h4>
<div class="row">
<div class="col12">
<?php $textRewrite = $text[30];
if( helper::checkRewrite() === true ) $textRewrite = $text[29];
$listText = $text[25]. common::DELTA_VERSION."\n".$text[26]. phpversion()."\n".$text[27]. $_SERVER['SERVER_SOFTWARE']."\n".$text[28].$textRewrite;
echo template::textarea('modulesPhp',[
'value' => $listText
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php $listMod = get_loaded_extensions();
natcasesort($listMod);
$listModText = $text[31];
$listModSmall = [];
foreach( $listMod as $key=>$value){
$listModText .= $value.' - ';
$listModSmall[$key] = strtolower($value);
}
$listModText = substr( $listModText, 0, strlen($listModText) - 3);
$listModRequired = array('exif', 'gd', 'mbstring', 'xmlwriter', 'zip', 'date', 'fileinfo', 'phar');
$listDiff = array_diff( $listModRequired, $listModSmall );
if( count($listDiff) > 0) {
$listModText .= "\n\n".$text[32];
foreach( $listDiff as $key=>$value){
$listModText .= $value.' - ';
}
$listModText = substr( $listModText, 0, strlen($listModText) - 3);
} else{
$listModText .= "\n\n".$text[33];
}
echo template::textarea('modulesPhp',[
'value' => $listModText
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php // $infoModules[nom_module]['realName'], ['version'], ['update'], ['delete'], ['dataDirectory']
$infoModules = helper::getModules();
$listModDeltaText = $text[34];
foreach( $infoModules as $key=>$value){
$listModDeltaText .= $key.' '.$infoModules[$key]['version'].' - ';
}
$listModDeltaText = substr( $listModDeltaText, 0, strlen($listModDeltaText) - 3);
echo template::textarea('modulesDeltacms',[
'value' => $listModDeltaText
]); ?>
</div>
</div>
</div>
<div class="row">
<div class="col2 offset5">
<?php echo template::button('buttonHtmlToPdf', [
'class' => 'buttontopdf',
'value' => $text[35]
]); ?>
</div>
</div>
</div>
</div>
</div>
</div>