connessione con hardware in assets

This commit is contained in:
test
2026-08-07 14:27:33 +02:00
parent 7c6e244155
commit f575d8cb05
33 changed files with 3489 additions and 1608 deletions
+42 -6
View File
@@ -4,17 +4,53 @@ declare(strict_types=1);
use GlpiPlugin\Urbackup\Config;
global $CFG_GLPI;
if (!defined('GLPI_ROOT')) {
define('GLPI_ROOT', dirname(__DIR__, 4));
}
include_once GLPI_ROOT . '/inc/includes.php';
// Check user has right to manage plugin configuration
if (!Session::haveRight('config', UPDATE)) {
Html::displayRightError();
}
// Handle form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['update'])) {
Config::saveConfiguration($_POST);
Html::redirect($_SERVER['REQUEST_URI']);
if (($_SERVER['REQUEST_METHOD'] ?? 'GET') === 'POST') {
// CSRF token is validated by the global CheckCsrfListener on every POST.
if (isset($_POST['update'])) {
global $DB;
$enable_computer = (string) ($_POST['enable_computer'] ?? '0') === '1' ? '1' : '0';
$table = Config::getTable();
$iterator = $DB->request([
'FROM' => $table,
'WHERE' => ['name' => 'enable_computer'],
'LIMIT' => 1,
]);
$row = $iterator->current();
$values = [
'value' => $enable_computer,
'date_mod' => $_SESSION['glpi_currenttime'] ?? date('Y-m-d H:i:s'),
];
if ($row === false) {
$values['name'] = 'enable_computer';
$values['date_creation'] = $_SESSION['glpi_currenttime'] ?? date('Y-m-d H:i:s');
$DB->insert($table, $values);
} else {
$DB->update($table, $values, ['name' => 'enable_computer']);
}
Session::addMessageAfterRedirect(
__('Configuration saved.', 'urbackup'),
false,
INFO
);
Html::redirect(Config::getFormURL());
}
}
// Display GLPI header
@@ -30,4 +66,4 @@ $config = new Config();
$config->showForm(1);
// Display GLPI footer
Html::footer();
Html::footer();