//	logEvent($_POST["ID"], "computers", 4, "inventory", $_SESSION["glpiname"]." ".$LANG['log'][22]);
    glpi_header($CFG_GLPI["root_doc"] . "plugins/fusioninventory/front/unknown.php");
} else {
    if (isset($_POST["restore"])) {
    } else {
        if (isset($_POST["purge"]) || isset($_GET["purge"])) {
        } else {
            if (isset($_POST["update"])) {
                $ptud->check($_POST['ID'], 'w');
                $ptud->update($_POST);
                glpi_header($_SERVER['HTTP_REFERER']);
            } else {
                if (isset($_POST["import"])) {
                    $Import = 0;
                    $NoImport = 0;
                    list($Import, $NoImport) = PluginFusioninventoryDiscovery::import($_POST['ID'], $Import, $NoImport);
                    addMessageAfterRedirect($LANG['plugin_fusioninventory']["discovery"][5] . " : " . $Import);
                    addMessageAfterRedirect($LANG['plugin_fusioninventory']["discovery"][9] . " : " . $NoImport);
                    if ($Import == "0") {
                        glpi_header($_SERVER['HTTP_REFERER']);
                    } else {
                        glpi_header($CFG_GLPI["root_doc"] . "/plugins/fusioninventory/front/unknown.php");
                    }
                }
            }
        }
    }
}
$ptud->showTabs($ID, '', $_SESSION['glpi_tab']);
$ptud->showForm($_SERVER["PHP_SELF"], $ID);
echo "<div id='tabcontent'></div>";
Exemplo n.º 2
0
function plugin_fusioninventory_MassiveActionsProcess($data)
{
    global $LANG;
    switch ($data['action']) {
        case "plugin_fusioninventory_get_model":
            if ($data['device_type'] == NETWORKING_TYPE) {
                foreach ($data['item'] as $key => $val) {
                    if ($val == 1) {
                        $PluginFusioninventoryModelInfos = new PluginFusioninventoryModelInfos();
                        $PluginFusioninventoryModelInfos->getrightmodel($key, NETWORKING_TYPE);
                    }
                }
            } else {
                if ($data['device_type'] == PRINTER_TYPE) {
                    foreach ($data['item'] as $key => $val) {
                        if ($val == 1) {
                            $PluginFusioninventoryModelInfos = new PluginFusioninventoryModelInfos();
                            $PluginFusioninventoryModelInfos->getrightmodel($key, PRINTER_TYPE);
                        }
                    }
                }
            }
            break;
        case "plugin_fusioninventory_assign_model":
            if ($data['device_type'] == NETWORKING_TYPE) {
                foreach ($data['item'] as $key => $val) {
                    if ($val == 1) {
                        PluginFusioninventoryMassiveaction::assign($key, NETWORKING_TYPE, "model", $data["snmp_model"]);
                    }
                }
            } else {
                if ($data['device_type'] == PRINTER_TYPE) {
                    foreach ($data['item'] as $key => $val) {
                        if ($val == 1) {
                            PluginFusioninventoryMassiveaction::assign($key, PRINTER_TYPE, "model", $data["snmp_model"]);
                        }
                    }
                }
            }
            break;
        case "plugin_fusioninventory_assign_auth":
            if ($data['device_type'] == NETWORKING_TYPE) {
                foreach ($data['item'] as $key => $val) {
                    if ($val == 1) {
                        PluginFusioninventoryMassiveaction::assign($key, NETWORKING_TYPE, "auth", $data["FK_snmp_connection"]);
                    }
                }
            } else {
                if ($data['device_type'] == PRINTER_TYPE) {
                    foreach ($data['item'] as $key => $val) {
                        if ($val == 1) {
                            PluginFusioninventoryMassiveaction::assign($key, PRINTER_TYPE, "auth", $data["FK_snmp_connection"]);
                        }
                    }
                }
            }
            break;
        case "plugin_fusioninventory_manage_locks":
            if ($data['device_type'] == NETWORKING_TYPE or $data['device_type'] == PRINTER_TYPE) {
                foreach ($data['item'] as $key => $val) {
                    if ($val == 1) {
                        if (isset($data["lockfield_fusioninventory"]) && count($data["lockfield_fusioninventory"])) {
                            $tab = PluginFusioninventoryLock::exportChecksToArray($data["lockfield_fusioninventory"]);
                            PluginFusioninventoryLock::setLockArray($data['type'], $key, $tab);
                        } else {
                            PluginFusioninventoryLock::setLockArray($data['type'], $key, array());
                        }
                    }
                }
            }
            break;
        case "plugin_fusioninventory_discovery_import":
            if (PluginFusioninventory::haveRight("unknowndevices", "w")) {
                $Import = 0;
                $NoImport = 0;
                foreach ($data['item'] as $key => $val) {
                    if ($val == 1) {
                        list($Import, $NoImport) = PluginFusioninventoryDiscovery::import($key, $Import, $NoImport);
                    }
                }
                addMessageAfterRedirect($LANG['plugin_fusioninventory']["discovery"][5] . " : " . $Import);
                addMessageAfterRedirect($LANG['plugin_fusioninventory']["discovery"][9] . " : " . $NoImport);
            }
            break;
    }
}