Ads host delete page
parent
ad6b2d0799
commit
eea3271fe6
|
@ -96,14 +96,14 @@ class Host {
|
||||||
|
|
||||||
|
|
||||||
// delete a host
|
// delete a host
|
||||||
public function deleteAgent($agent_id) {
|
public function deleteHost($host_id) {
|
||||||
try {
|
try {
|
||||||
$sql = 'DELETE FROM jilo_agents
|
$sql = 'DELETE FROM hosts
|
||||||
WHERE
|
WHERE
|
||||||
id = :agent_id';
|
id = :host_id';
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
$query = $this->db->prepare($sql);
|
||||||
$query->bindParam(':agent_id', $agent_id);
|
$query->bindParam(':host_id', $host_id);
|
||||||
|
|
||||||
$query->execute();
|
$query->execute();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
$action = $_REQUEST['action'] ?? '';
|
$action = $_REQUEST['action'] ?? '';
|
||||||
$agent = $_REQUEST['agent'] ?? '';
|
$agent = $_REQUEST['agent'] ?? '';
|
||||||
|
$host = $_REQUEST['host'] ?? '';
|
||||||
|
|
||||||
require '../app/classes/config.php';
|
require '../app/classes/config.php';
|
||||||
require '../app/classes/host.php';
|
require '../app/classes/host.php';
|
||||||
|
@ -58,6 +59,15 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
];
|
];
|
||||||
$platformObject->addPlatform($newPlatform);
|
$platformObject->addPlatform($newPlatform);
|
||||||
|
|
||||||
|
// deleting a host
|
||||||
|
} elseif (isset($_POST['delete']) && isset($_POST['host']) && $_POST['delete'] === 'true') {
|
||||||
|
$result = $hostObject->deleteHost($host);
|
||||||
|
if ($result === true) {
|
||||||
|
$_SESSION['notice'] = "Host id \"{$_REQUEST['host']}\" deleted.";
|
||||||
|
} else {
|
||||||
|
$_SESSION['error'] = "Deleting the host failed. Error: $result";
|
||||||
|
}
|
||||||
|
|
||||||
// deleting an agent
|
// deleting an agent
|
||||||
} elseif (isset($_POST['delete']) && isset($_POST['agent']) && $_POST['delete'] === 'true') {
|
} elseif (isset($_POST['delete']) && isset($_POST['agent']) && $_POST['delete'] === 'true') {
|
||||||
$result = $agentObject->deleteAgent($agent);
|
$result = $agentObject->deleteAgent($agent);
|
||||||
|
@ -151,6 +161,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
} elseif (isset($action) && $action === 'edit') {
|
} elseif (isset($action) && $action === 'edit') {
|
||||||
include '../app/templates/config-host-edit.php';
|
include '../app/templates/config-host-edit.php';
|
||||||
} elseif (isset($action) && $action === 'delete') {
|
} elseif (isset($action) && $action === 'delete') {
|
||||||
|
$hostDetails = $hostObject->getHostDetails($platform_id, $agent);
|
||||||
include '../app/templates/config-host-delete.php';
|
include '../app/templates/config-host-delete.php';
|
||||||
} else {
|
} else {
|
||||||
if ($userObject->hasRight($user_id, 'view config file')) {
|
if ($userObject->hasRight($user_id, 'view config file')) {
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
<!-- widget "hosts" -->
|
||||||
|
<div class="card text-center w-50 mx-auto">
|
||||||
|
<p class="h4 card-header">Jilo configuration for Jitsi platform <strong>"<?= htmlspecialchars($platformDetails[0]['name']) ?>"</strong></p>
|
||||||
|
<div class="card-body">
|
||||||
|
<p class="card-text">delete a host:</p>
|
||||||
|
<form method="POST" action="<?= htmlspecialchars($app_root) ?>?page=config&item=host">
|
||||||
|
<?php
|
||||||
|
foreach ($hostDetails[0] as $key => $value) {
|
||||||
|
// if ($key === 'id') continue;
|
||||||
|
?>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-4 text-end">
|
||||||
|
<label for="<?= htmlspecialchars($key) ?>" class="form-label"><?= htmlspecialchars($key) ?>:</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="text-start"><?= htmlspecialchars($value ?? '') ?></div>
|
||||||
|
<input type="hidden" name="<?= htmlspecialchars($key) ?>" value="<?= htmlspecialchars($value ?? '') ?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
<br />
|
||||||
|
<input type="hidden" name="host" value="<?= htmlspecialchars($hostDetails[0]['id']) ?>" />
|
||||||
|
<input type="hidden" name="delete" value="true" />
|
||||||
|
<p class="h5 text-danger">Are you sure you want to delete this host?</p>
|
||||||
|
<br />
|
||||||
|
<a class="btn btn-secondary" href="<?= htmlspecialchars($app_root) ?>?page=config&item=host#platform<?= htmlspecialchars($platform_id) ?>host<?= htmlspecialchars($hostDetails[0]['id']) ?>" />Cancel</a>
|
||||||
|
<input type="submit" class="btn btn-danger" value="Delete" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /widget "hosts" -->
|
Loading…
Reference in New Issue