GLPI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------ */ // ---------------------------------------------------------------------- // Original Author of file: David DURIEUX // Purpose of file: // ---------------------------------------------------------------------- $NEEDED_ITEMS = array("networking"); define('GLPI_ROOT', '../../..'); include GLPI_ROOT . "/inc/includes.php"; checkRight("networking", "r"); PluginFusioninventoryAuth::checkRight("snmp_networking", "r"); $plugin_fusioninventory_snmp = new PluginFusioninventorySNMP(); if (isset($_POST['update']) && isset($_POST['ID'])) { PluginFusioninventoryAuth::checkRight("snmp_networking", "w"); $plugin_fusioninventory_snmp->update_network_infos($_POST['ID'], $_POST['model_infos'], $_POST['FK_snmp_connection']); } else { if (isset($_POST["GetRightModel"]) && isset($_POST['ID'])) { $plugin_fusioninventory_model_infos = new PluginFusioninventoryModelInfos(); $plugin_fusioninventory_model_infos->getrightmodel($_POST['ID'], NETWORKING_TYPE); } } glpi_header($_SERVER['HTTP_REFERER']);
include GLPI_ROOT . "/inc/includes.php"; PluginFusioninventoryAuth::checkRight("snmp_printers", "r"); if (isset($_POST['update']) && isset($_POST['ID'])) { PluginFusioninventoryAuth::checkRight("snmp_printers", "w"); $plugin_fusioninventory_printers = new PluginFusioninventoryPrinters(); $_POST['FK_printers'] = $_POST['ID']; unset($_POST['ID']); $query = "SELECT * \n FROM `glpi_plugin_fusioninventory_printers`\n WHERE `FK_printers`='" . $_POST['FK_printers'] . "' "; $result = $DB->query($query); $data = $DB->fetch_assoc($result); $_POST['ID'] = $data['ID']; $plugin_fusioninventory_printers->update($_POST); } else { if (isset($_POST["GetRightModel"]) && isset($_POST['ID'])) { $plugin_fusioninventory_model_infos = new PluginFusioninventoryModelInfos(); $plugin_fusioninventory_model_infos->getrightmodel($_POST['ID'], PRINTER_TYPE); } } if (isset($_POST['update_cartridges']) && isset($_POST['ID'])) { PluginFusioninventoryAuth::checkRight("snmp_printers", "w"); $plugin_fusioninventory_printers_cartridges = new PluginFusioninventoryPrintersCartridges(); $query = "SELECT * \n FROM `glpi_plugin_fusioninventory_printers_cartridges`\n WHERE `FK_printers`='" . $_POST['ID'] . "'\n AND `object_name`='" . $_POST['object_name'] . "' "; $result = $DB->query($query); if ($DB->numrows($result) == "0") { $_POST['FK_printers'] = $_POST['ID']; unset($_POST['ID']); $plugin_fusioninventory_printers_cartridges->add($_POST); } else { $data = $DB->fetch_assoc($result); $plugin_fusioninventory_printers_cartridges->update($_POST); }
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; } }