Stable
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use GlpiPlugin\Urbackup\Profile;
|
||||
use GlpiPlugin\Urbackup\Server;
|
||||
use Html;
|
||||
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
define('GLPI_ROOT', dirname(__DIR__, 4));
|
||||
}
|
||||
|
||||
include_once GLPI_ROOT . "/inc/includes.php";
|
||||
|
||||
if (!Profile::canCurrentUser(UPDATE)) {
|
||||
Html::displayRightError();
|
||||
}
|
||||
|
||||
$server = new Server();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$id = $_POST['id'] ?? 0;
|
||||
|
||||
if ($id > 0) {
|
||||
$server->check($id, UPDATE);
|
||||
$server->update($_POST);
|
||||
} else {
|
||||
$server->check(-1, CREATE);
|
||||
$server->add($_POST);
|
||||
}
|
||||
|
||||
Html::redirect(PLUGIN_URBACKUP_WEB_DIR . "/front/server.php");
|
||||
}
|
||||
|
||||
$ID = $_GET['id'] ?? null;
|
||||
|
||||
Html::header(
|
||||
$ID ? __('Edit UrBackup server', 'urbackup') : __('Add UrBackup server', 'urbackup'),
|
||||
'',
|
||||
'Assets',
|
||||
'GlpiPlugin\Urbackup\Server'
|
||||
);
|
||||
|
||||
$server->showForm($ID);
|
||||
|
||||
if ($ID > 0 && $server->getFromDB($ID)) {
|
||||
echo '<div class="card mt-4">';
|
||||
echo '<div class="card-header">';
|
||||
echo '<h5 class="mb-0">' . htmlspecialchars(__('Linked clients', 'urbackup')) . '</h5>';
|
||||
echo '</div>';
|
||||
echo '<div class="card-body">';
|
||||
Server::showLinkedClientsTab($server);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="card mt-4">';
|
||||
echo '<div class="card-header">';
|
||||
echo '<h5 class="mb-0">' . htmlspecialchars(__('Unlinked clients', 'urbackup')) . '</h5>';
|
||||
echo '</div>';
|
||||
echo '<div class="card-body">';
|
||||
Server::showUnlinkedClientsTab($server);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
Html::footer();
|
||||
Reference in New Issue
Block a user