mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-03-12 01:00:13 +01:00
Miglioramento requisiti
This commit is contained in:
parent
0aa197a5db
commit
e9a0764a03
@ -293,7 +293,6 @@ if (empty($creation) && (!file_exists('config.inc.php') || !$valid_config)) {
|
|||||||
|
|
||||||
<div class="box-body" id="smartwizard">';
|
<div class="box-body" id="smartwizard">';
|
||||||
|
|
||||||
// REQUISITI PER IL CORRETTO FUNZIONAMENTO
|
|
||||||
echo '
|
echo '
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#step-1">
|
<li><a href="#step-1">
|
||||||
@ -311,158 +310,12 @@ if (empty($creation) && (!file_exists('config.inc.php') || !$valid_config)) {
|
|||||||
|
|
||||||
<div id="steps">
|
<div id="steps">
|
||||||
|
|
||||||
<div id="step-1">
|
<div id="step-1">';
|
||||||
<p>'.tr('Benvenuto in _NAME_!', [
|
|
||||||
'_NAME_' => '<strong>OpenSTAManager</strong>',
|
// REQUISITI PER IL CORRETTO FUNZIONAMENTO
|
||||||
]).'</p>
|
include __DIR__.'/requirements.php';
|
||||||
<p>'.tr("Prima di procedere alla configurazione e all'installazione del software, sono necessari alcuni accorgimenti per garantire il corretto funzionamento del gestionale").'. '.tr('Stai utilizzando la versione PHP _PHP_', [
|
|
||||||
'_PHP_' => phpversion(),
|
|
||||||
]).'.</p>
|
|
||||||
<hr>';
|
|
||||||
|
|
||||||
// Estensioni di PHP
|
|
||||||
echo '
|
echo '
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<p>'.tr('Le seguenti estensioni PHP devono essere abilitate dal file di configurazione _FILE_', [
|
|
||||||
'_FILE_' => '<b>php.ini</b>',
|
|
||||||
]).':</p>
|
|
||||||
<div class="list-group">';
|
|
||||||
$extensions = [
|
|
||||||
'zip' => tr("Necessario per l'utilizzo delle funzioni di aggiornamento automatico e backup, oltre che per eventuali moduli aggiuntivi"),
|
|
||||||
'pdo_mysql' => tr('Necessario per la connessione al database'),
|
|
||||||
'openssl' => tr('Utile per la generazione di chiavi complesse (facoltativo)'),
|
|
||||||
'intl' => tr('Utile per la gestione automatizzata della conversione numerica (facoltativo)'),
|
|
||||||
'soap' => tr('Utile per i controlli sulla validità della Partita IVA (facoltativo)'),
|
|
||||||
'curl' => tr('Utile per i controlli sulla validità di diversi attributi (facoltativo)'),
|
|
||||||
];
|
|
||||||
foreach ($extensions as $key => $value) {
|
|
||||||
$check = extension_loaded($key);
|
|
||||||
echo '
|
|
||||||
<div class="list-group-item">
|
|
||||||
<h4 class="list-group-item-heading">
|
|
||||||
'.$key;
|
|
||||||
if ($check) {
|
|
||||||
echo '
|
|
||||||
<span class="label label-success pull-right">
|
|
||||||
<i class="fa fa-check"></i>
|
|
||||||
</span>';
|
|
||||||
} else {
|
|
||||||
echo '
|
|
||||||
<span class="label label-danger pull-right">
|
|
||||||
<i class="fa fa-times"></i>
|
|
||||||
</span>';
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</h4>
|
|
||||||
<p class="list-group-item-text">'.$value.'</p>
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
</div>';
|
|
||||||
|
|
||||||
// Impostazione di valore per PHP
|
|
||||||
echo '
|
|
||||||
|
|
||||||
<div class="col-md-6">
|
|
||||||
<p>'.tr('Le seguenti impostazioni PHP devono essere modificate nel file di configurazione _FILE_', [
|
|
||||||
'_FILE_' => '<b>php.ini</b>',
|
|
||||||
]).':</p>
|
|
||||||
<div class="list-group">';
|
|
||||||
$values = [
|
|
||||||
'display_errors' => true,
|
|
||||||
'upload_max_filesize' => '>16M',
|
|
||||||
'post_max_size' => '>16M',
|
|
||||||
];
|
|
||||||
foreach ($values as $key => $value) {
|
|
||||||
$ini = str_replace(['k', 'M'], ['000', '000000'], ini_get($key));
|
|
||||||
$real = str_replace(['k', 'M'], ['000', '000000'], $value);
|
|
||||||
|
|
||||||
if (starts_with($real, '>')) {
|
|
||||||
$check = $ini >= substr($real, 1);
|
|
||||||
} elseif (starts_with($real, '<')) {
|
|
||||||
$check = $ini <= substr($real, 1);
|
|
||||||
} else {
|
|
||||||
$check = ($real == $ini);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_bool($value)) {
|
|
||||||
$value = !empty($value) ? 'On' : 'Off';
|
|
||||||
} else {
|
|
||||||
$value = str_replace(['>', '<'], '', $value);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<div class="list-group-item">
|
|
||||||
<h4 class="list-group-item-heading">
|
|
||||||
'.$key;
|
|
||||||
if ($check) {
|
|
||||||
echo '
|
|
||||||
<span class="label label-success pull-right">
|
|
||||||
<i class="fa fa-check"></i>
|
|
||||||
</span>';
|
|
||||||
} else {
|
|
||||||
echo '
|
|
||||||
<span class="label label-danger pull-right">
|
|
||||||
<i class="fa fa-times"></i>
|
|
||||||
</span>';
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</h4>
|
|
||||||
<p class="list-group-item-text">'.tr('Valore consigliato').': '.$value.'</p>
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
</div>
|
|
||||||
</div>';
|
|
||||||
|
|
||||||
// Percorsi necessari
|
|
||||||
echo '
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<p>'.tr('Le seguenti cartelle devono risultare scrivibili da parte del gestionale').':</p>
|
|
||||||
<div class="list-group">';
|
|
||||||
$dirs = [
|
|
||||||
'backup' => tr('Necessario per il salvataggio dei backup'),
|
|
||||||
'files' => tr('Necessario per il salvataggio di file inseriti dagli utenti'),
|
|
||||||
'logs' => tr('Necessario per la gestione dei file di log'),
|
|
||||||
];
|
|
||||||
foreach ($dirs as $key => $value) {
|
|
||||||
$check = is_writable($docroot.DIRECTORY_SEPARATOR.$key);
|
|
||||||
echo '
|
|
||||||
<div class="list-group-item">
|
|
||||||
<h4 class="list-group-item-heading">
|
|
||||||
'.$key;
|
|
||||||
if ($check) {
|
|
||||||
echo '
|
|
||||||
<span class="label label-success pull-right">
|
|
||||||
<i class="fa fa-check"></i>
|
|
||||||
</span>';
|
|
||||||
} else {
|
|
||||||
echo '
|
|
||||||
<span class="label label-danger pull-right">
|
|
||||||
<i class="fa fa-times"></i>
|
|
||||||
</span>';
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</h4>
|
|
||||||
<p class="list-group-item-text">'.$value.'</p>
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
// LICENZA
|
// LICENZA
|
||||||
@ -553,9 +406,6 @@ if (empty($creation) && (!file_exists('config.inc.php') || !$valid_config)) {
|
|||||||
</div>
|
</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
echo '
|
|
||||||
';
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<!-- PULSANTI -->
|
<!-- PULSANTI -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -574,7 +424,6 @@ if (empty($creation) && (!file_exists('config.inc.php') || !$valid_config)) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
183
include/requirements.php
Normal file
183
include/requirements.php
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Apache
|
||||||
|
$modules = [
|
||||||
|
'mod_rewrite' => tr('Fornisce un sistema di riscrittura URL basato su regole predefinite'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$available_modules = apache_get_modules();
|
||||||
|
|
||||||
|
$apache = [];
|
||||||
|
foreach ($modules as $name => $description) {
|
||||||
|
$status = in_array($name, $available_modules);
|
||||||
|
|
||||||
|
$apache[] = [
|
||||||
|
'name' => $name,
|
||||||
|
'description' => $description,
|
||||||
|
'status' => $status,
|
||||||
|
'type' => tr('Modulo'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// PHP
|
||||||
|
$settings = [
|
||||||
|
'zip' => [
|
||||||
|
'type' => 'ext',
|
||||||
|
'description' => tr('Permette di leggere e scrivere gli archivi compressi ZIP e i file al loro interno'),
|
||||||
|
],
|
||||||
|
'pdo_mysql' => [
|
||||||
|
'type' => 'ext',
|
||||||
|
'description' => tr('Permette di effettuare la connessione al database MySQL'),
|
||||||
|
],
|
||||||
|
'openssl' => [
|
||||||
|
'type' => 'ext',
|
||||||
|
'description' => tr("Permette l'utilizzo di funzioni crittografiche simmetriche e asimmetriche (facoltativo)"),
|
||||||
|
],
|
||||||
|
'intl' => [
|
||||||
|
'type' => 'ext',
|
||||||
|
'description' => tr("Permette l'automazione della conversione dei numeri (facoltativo)"),
|
||||||
|
],
|
||||||
|
'soap' => [
|
||||||
|
'type' => 'ext',
|
||||||
|
'description' => tr('Permette la comunicazione con servizi esterni, quali il database europeo delle Partite IVA (facoltativo)'),
|
||||||
|
],
|
||||||
|
'curl' => [
|
||||||
|
'type' => 'ext',
|
||||||
|
'description' => tr('Permette la comunicazione con servizi esterni, quali APILayer (facoltativo)'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'display_errors' => [
|
||||||
|
'type' => 'value',
|
||||||
|
'description' => true,
|
||||||
|
],
|
||||||
|
'upload_max_filesize' => [
|
||||||
|
'type' => 'value',
|
||||||
|
'description' => '>16M',
|
||||||
|
],
|
||||||
|
'post_max_size' => [
|
||||||
|
'type' => 'value',
|
||||||
|
'description' => '>16M',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$php = [];
|
||||||
|
foreach ($settings as $name => $values) {
|
||||||
|
$description = $values['description'];
|
||||||
|
|
||||||
|
if ($values['type'] == 'ext') {
|
||||||
|
$status = extension_loaded($name);
|
||||||
|
} else {
|
||||||
|
$ini = str_replace(['k', 'M'], ['000', '000000'], ini_get($name));
|
||||||
|
$real = str_replace(['k', 'M'], ['000', '000000'], $description);
|
||||||
|
|
||||||
|
if (starts_with($real, '>')) {
|
||||||
|
$status = $ini >= substr($real, 1);
|
||||||
|
} elseif (starts_with($real, '<')) {
|
||||||
|
$status = $ini <= substr($real, 1);
|
||||||
|
} else {
|
||||||
|
$status = ($real == $ini);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_bool($description)) {
|
||||||
|
$description = !empty($description) ? 'On' : 'Off';
|
||||||
|
} else {
|
||||||
|
$description = str_replace(['>', '<'], '', $description);
|
||||||
|
}
|
||||||
|
|
||||||
|
$description = tr('Valore consigliato: _VALUE_', [
|
||||||
|
'_VALUE_' => $description,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = ($values['type'] == 'ext') ? tr('Estensione') : tr('Impostazione');
|
||||||
|
|
||||||
|
$php[] = [
|
||||||
|
'name' => $name,
|
||||||
|
'description' => $description,
|
||||||
|
'status' => $status,
|
||||||
|
'type' => $type,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Percorsi di servizio
|
||||||
|
$dirs = [
|
||||||
|
'backup' => tr('Necessario per il salvataggio dei backup'),
|
||||||
|
'files' => tr('Necessario per il salvataggio di file inseriti dagli utenti'),
|
||||||
|
'logs' => tr('Necessario per la gestione dei file di log'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$directories = [];
|
||||||
|
foreach ($dirs as $name => $description) {
|
||||||
|
$status = is_writable($docroot.DIRECTORY_SEPARATOR.$name);
|
||||||
|
|
||||||
|
$directories[] = [
|
||||||
|
'name' => $name,
|
||||||
|
'description' => $description,
|
||||||
|
'status' => $status,
|
||||||
|
'type' => tr('Cartella'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$requirements = [
|
||||||
|
tr('Apache') => $apache,
|
||||||
|
tr('PHP (_VERSION_)', [
|
||||||
|
'_VERSION_' => phpversion(),
|
||||||
|
]) => $php,
|
||||||
|
tr('Percorsi di servizio') => $directories,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Introduzione
|
||||||
|
echo '
|
||||||
|
<p>'.tr('Benvenuto in _NAME_!', [
|
||||||
|
'_NAME_' => '<strong>OpenSTAManager</strong>',
|
||||||
|
]).'</p>
|
||||||
|
<p>'.tr("Prima di procedere alla configurazione e all'installazione del software, sono necessari alcuni accorgimenti per garantire il corretto funzionamento del gestionale").'.</p>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<p>'.tr('Le estensioni e impostazioni PHP possono essere personalizzate nel file di configurazione _FILE_', [
|
||||||
|
'_FILE_' => '<b>php.ini</b>',
|
||||||
|
]).'.</p>
|
||||||
|
<hr>';
|
||||||
|
|
||||||
|
// Tabelle di riepilogo
|
||||||
|
foreach ($requirements as $key => $values) {
|
||||||
|
$statuses = array_column($values, 'status');
|
||||||
|
$general_status = true;
|
||||||
|
foreach ($statuses as $status) {
|
||||||
|
$general_status &= $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<div class="box box-'.($general_status ? 'success collapsed-box' : 'danger').'">
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<h3 class="box-title">'.$key.'</h3>';
|
||||||
|
|
||||||
|
if ($general_status) {
|
||||||
|
echo '
|
||||||
|
<div class="box-tools pull-right">
|
||||||
|
<button type="button" class="btn btn-box-tool" data-widget="collapse">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</div>
|
||||||
|
<div class="box-body no-padding">
|
||||||
|
<table class="table">';
|
||||||
|
|
||||||
|
foreach ($values as $value) {
|
||||||
|
echo '
|
||||||
|
<tr class="'.($value['status'] ? 'success' : 'danger').'">
|
||||||
|
<td style="width: 10px"><i class="fa fa-'.($value['status'] ? 'check' : 'times').'"></i></td>
|
||||||
|
<td>'.$value['type'].'</td>
|
||||||
|
<td>'.$value['name'].'</td>
|
||||||
|
<td>'.$value['description'].'</td>
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user