mirror of
https://github.com/tips-of-mine/GLPI-Plugin-CVE-Prototype.git
synced 2025-06-27 14:48:45 +02:00
Fix plugin structure for proper GLPI detection
This commit is contained in:
88
front/rule.form.php
Normal file
88
front/rule.form.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* GLPI CVE Plugin - Rule Form
|
||||
*/
|
||||
|
||||
include ("../../../inc/includes.php");
|
||||
|
||||
Session::checkRight("plugin_cve_rule", READ);
|
||||
|
||||
$rule = new PluginCveCveRule();
|
||||
|
||||
if (isset($_POST["add"])) {
|
||||
$rule->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();
|
||||
}
|
20
front/rule.php
Normal file
20
front/rule.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* GLPI CVE Plugin - Rules List
|
||||
*/
|
||||
|
||||
include ("../../../inc/includes.php");
|
||||
|
||||
Session::checkRight("plugin_cve_rule", READ);
|
||||
|
||||
Html::header(
|
||||
PluginCveCveRule::getTypeName(Session::getPluralNumber()),
|
||||
$_SERVER['PHP_SELF'],
|
||||
"tools",
|
||||
"PluginCveCveMenu",
|
||||
"cverule"
|
||||
);
|
||||
|
||||
Search::show('PluginCveCveRule');
|
||||
|
||||
Html::footer();
|
@ -35,8 +35,8 @@
|
||||
<versions>
|
||||
<version>
|
||||
<num>0.0.1</num>
|
||||
<compatibility>~10.0.18</compatibility>
|
||||
<download_url>https://github.com/tips-of-mine/GLPI-Plugin-CVE-Prototype/releases/download/0.0.1/cve-0.0.1.tar.gz</download_url>
|
||||
<compatibility>~10.0</compatibility>
|
||||
<download_url>https://github.com/tips-of-mine/GLPI-Plugin-CVE-Prototype/releases/download/0.0.1/cve-prototype-0.0.1.tar.gz</download_url>
|
||||
</version>
|
||||
</versions>
|
||||
<langs>
|
||||
|
Reference in New Issue
Block a user