diff --git a/front/rule.form.php b/front/rule.form.php new file mode 100644 index 0000000..57df067 --- /dev/null +++ b/front/rule.form.php @@ -0,0 +1,88 @@ +check(-1, CREATE, $_POST); + if ($rule->add($_POST)) { + Event::log( + $rule->fields['id'], + "plugin_cve_rule", + 4, + "inventory", + sprintf(__('%1$s adds the rule %2$s'), $_SESSION["glpiname"], $_POST["name"]) + ); + } + Html::back(); +} else if (isset($_POST["delete"])) { + $rule->check($_POST["id"], DELETE); + if ($rule->delete($_POST)) { + Event::log( + $_POST["id"], + "plugin_cve_rule", + 4, + "inventory", + sprintf(__('%1$s deletes the rule %2$s'), $_SESSION["glpiname"], $_POST["id"]) + ); + } + $rule->redirectToList(); +} else if (isset($_POST["restore"])) { + $rule->check($_POST["id"], DELETE); + if ($rule->restore($_POST)) { + Event::log( + $_POST["id"], + "plugin_cve_rule", + 4, + "inventory", + sprintf(__('%1$s restores the rule %2$s'), $_SESSION["glpiname"], $_POST["id"]) + ); + } + $rule->redirectToList(); +} else if (isset($_POST["purge"])) { + $rule->check($_POST["id"], PURGE); + if ($rule->delete($_POST, 1)) { + Event::log( + $_POST["id"], + "plugin_cve_rule", + 4, + "inventory", + sprintf(__('%1$s purges the rule %2$s'), $_SESSION["glpiname"], $_POST["id"]) + ); + } + $rule->redirectToList(); +} else if (isset($_POST["update"])) { + $rule->check($_POST["id"], UPDATE); + if ($rule->update($_POST)) { + Event::log( + $_POST["id"], + "plugin_cve_rule", + 4, + "inventory", + sprintf(__('%1$s updates the rule %2$s'), $_SESSION["glpiname"], $_POST["id"]) + ); + } + Html::back(); +} else { + Html::header( + PluginCveCveRule::getTypeName(Session::getPluralNumber()), + $_SERVER['PHP_SELF'], + "tools", + "PluginCveCveMenu", + "cverule" + ); + + $id = 0; + if (isset($_GET["id"])) { + $id = $_GET["id"]; + } + + $rule->display(['id' => $id]); + Html::footer(); +} \ No newline at end of file diff --git a/front/rule.php b/front/rule.php new file mode 100644 index 0000000..71cbbb9 --- /dev/null +++ b/front/rule.php @@ -0,0 +1,20 @@ + 0.0.1 - ~10.0.18 - https://github.com/tips-of-mine/GLPI-Plugin-CVE-Prototype/releases/download/0.0.1/cve-0.0.1.tar.gz + ~10.0 + https://github.com/tips-of-mine/GLPI-Plugin-CVE-Prototype/releases/download/0.0.1/cve-prototype-0.0.1.tar.gz