示例#1
0
*/
// ----------------------------------------------------------------------
// Original Author of file: Dennis Plöger <*****@*****.**>
// Purpose of file: Rack CRUD form
// ----------------------------------------------------------------------
$NEEDED_ITEMS = array('plugin');
include '../../../inc/includes.php';
if (!isset($_GET["id"])) {
    $_GET["id"] = "-1";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$rack = new PluginRackviewRack();
if (isset($_POST['add'])) {
    $rack->check(-1, 'w', $_POST);
    $newId = $rack->add($_POST);
    Html::redirect($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST['delete']) || isset($_POST['purge'])) {
        $rack->check($_POST['id'], 'w');
        $rack->delete($_POST);
        Html::redirect($CFG_GLPI['root_doc'] . '/plugins/rackview/index.php');
    } else {
        if (isset($_POST['update'])) {
            $rack->check($_POST['id'], 'w');
            $rack->update($_POST);
            Html::redirect($_SERVER['HTTP_REFERER']);
        } else {
            $rack->check($_GET["id"], 'r');
            if (!isset($_SESSION['glpi_tab'])) {