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