Update plugin configuration files for proper GLPI detection

This commit is contained in:
tips-of-mine
2025-05-31 11:14:08 +02:00
committed by GitHub
parent f1316266fa
commit 449a322bab
8 changed files with 505 additions and 6 deletions

88
front/cve.form.php Normal file
View File

@ -0,0 +1,88 @@
<?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();
}