mirror of
https://github.com/tips-of-mine/GLPI-Plugin-CVE-Prototype.git
synced 2025-06-27 22:58:45 +02:00
95 lines
2.5 KiB
PHP
95 lines
2.5 KiB
PHP
<?php
|
|
/**
|
|
* GLPI CVE Plugin - Vulnerability Alert Form
|
|
*/
|
|
|
|
include ("../../../inc/includes.php");
|
|
|
|
Session::checkRight("plugin_cve_alert", READ);
|
|
|
|
$alert = new PluginCveCveAlert();
|
|
|
|
if (isset($_POST['create_ticket']) && isset($_POST['id'])) {
|
|
$alert->getFromDB($_POST['id']);
|
|
|
|
// Process alert to create a ticket
|
|
PluginCveCveInventory::processAlert($_POST['id']);
|
|
|
|
Html::back();
|
|
} else if (isset($_POST["add"])) {
|
|
$alert->check(-1, CREATE, $_POST);
|
|
if ($alert->add($_POST)) {
|
|
Event::log(
|
|
$alert->fields['id'],
|
|
"plugin_cve_alert",
|
|
4,
|
|
"inventory",
|
|
sprintf(__('%1$s adds the vulnerability alert %2$s'), $_SESSION["glpiname"], $_POST["name"])
|
|
);
|
|
}
|
|
Html::back();
|
|
} else if (isset($_POST["delete"])) {
|
|
$alert->check($_POST["id"], DELETE);
|
|
if ($alert->delete($_POST)) {
|
|
Event::log(
|
|
$_POST["id"],
|
|
"plugin_cve_alert",
|
|
4,
|
|
"inventory",
|
|
sprintf(__('%1$s deletes the vulnerability alert %2$s'), $_SESSION["glpiname"], $_POST["id"])
|
|
);
|
|
}
|
|
$alert->redirectToList();
|
|
} else if (isset($_POST["restore"])) {
|
|
$alert->check($_POST["id"], DELETE);
|
|
if ($alert->restore($_POST)) {
|
|
Event::log(
|
|
$_POST["id"],
|
|
"plugin_cve_alert",
|
|
4,
|
|
"inventory",
|
|
sprintf(__('%1$s restores the vulnerability alert %2$s'), $_SESSION["glpiname"], $_POST["id"])
|
|
);
|
|
}
|
|
$alert->redirectToList();
|
|
} else if (isset($_POST["purge"])) {
|
|
$alert->check($_POST["id"], PURGE);
|
|
if ($alert->delete($_POST, 1)) {
|
|
Event::log(
|
|
$_POST["id"],
|
|
"plugin_cve_alert",
|
|
4,
|
|
"inventory",
|
|
sprintf(__('%1$s purges the vulnerability alert %2$s'), $_SESSION["glpiname"], $_POST["id"])
|
|
);
|
|
}
|
|
$alert->redirectToList();
|
|
} else if (isset($_POST["update"])) {
|
|
$alert->check($_POST["id"], UPDATE);
|
|
if ($alert->update($_POST)) {
|
|
Event::log(
|
|
$_POST["id"],
|
|
"plugin_cve_alert",
|
|
4,
|
|
"inventory",
|
|
sprintf(__('%1$s updates the vulnerability alert %2$s'), $_SESSION["glpiname"], $_POST["id"])
|
|
);
|
|
}
|
|
Html::back();
|
|
} else {
|
|
Html::header(
|
|
PluginCveCveAlert::getTypeName(Session::getPluralNumber()),
|
|
$_SERVER['PHP_SELF'],
|
|
"tools",
|
|
"PluginCveCveMenu",
|
|
"alert"
|
|
);
|
|
|
|
$id = 0;
|
|
if (isset($_GET["id"])) {
|
|
$id = $_GET["id"];
|
|
}
|
|
|
|
$alert->display(['id' => $id]);
|
|
Html::footer();
|
|
} |