本文整理汇总了PHP中NetworkPort::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP NetworkPort::delete方法的具体用法?PHP NetworkPort::delete怎么用?PHP NetworkPort::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkPort
的用法示例。
在下文中一共展示了NetworkPort::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanDatabase
private function cleanDatabase()
{
global $DB;
$networkport = new NetworkPort();
if ($networkport->getFromDB($this->getID())) {
if (!in_array($networkport->fields['instantiation_type'], NetworkPort::getNetworkPortInstantiations())) {
$networkport->delete($networkport->fields);
}
}
if (countElementsInTable($this->getTable()) == 0) {
$query = "DROP TABLE `" . $this->getTable() . "`";
$DB->query($query);
}
}
示例2: deleteNetworking
/**
* Delete network ports for an itemtype
* @param the itemtype
* @return nothing
*/
static function deleteNetworking($itemtype)
{
$networkport = new NetworkPort();
foreach ($networkport->find("`itemtype`='{$itemtype}'") as $port) {
$networkport->delete($port);
}
}
示例3: transferNetworkLink
/**
* Transfer network links
*
* @param $itemtype original type of transfered item
* @param $ID original ID of the item
* @param $newID new ID of the item
**/
function transferNetworkLink($itemtype, $ID, $newID)
{
global $DB;
/// TODO manage with new network system
$np = new NetworkPort();
$nn = new NetworkPort_NetworkPort();
$query = "SELECT `glpi_networkports`.*, `glpi_networkportethernets`.`netpoints_id`\n FROM `glpi_networkports`\n LEFT JOIN `glpi_networkportethernets`\n ON (`glpi_networkports`.`id` = `glpi_networkportethernets`.`networkports_id`)\n WHERE `glpi_networkports`.`items_id` = '{$ID}'\n AND `glpi_networkports`.`itemtype` = '{$itemtype}'";
if ($result = $DB->query($query)) {
if ($DB->numrows($result) != 0) {
switch ($this->options['keep_networklink']) {
// Delete netport
case 0:
// Not a copy -> delete
if ($ID == $newID) {
while ($data = $DB->fetch_assoc($result)) {
$np->delete(array('id' => $data['id']));
}
}
// Copy -> do nothing
break;
// Disconnect
// Disconnect
case 1:
// Not a copy -> disconnect
if ($ID == $newID) {
while ($data = $DB->fetch_assoc($result)) {
if ($nn->getFromDBForNetworkPort($data['id'])) {
$nn->delete($data);
}
if ($data['netpoints_id']) {
$netpointID = $this->transferDropdownNetpoint($data['netpoints_id']);
$input['id'] = $data['id'];
$input['netpoints_id'] = $netpointID;
$np->update($input);
}
}
} else {
// Copy -> copy netports
while ($data = $DB->fetch_assoc($result)) {
$data = Toolbox::addslashes_deep($data);
unset($data['id']);
$data['items_id'] = $newID;
$data['netpoints_id'] = $this->transferDropdownNetpoint($data['netpoints_id']);
unset($np->fields);
$np->add(toolbox::addslashes_deep($data));
}
}
break;
// Keep network links
// Keep network links
default:
// Copy -> Copy netpoints (do not keep links)
if ($ID != $newID) {
while ($data = $DB->fetch_assoc($result)) {
unset($data['id']);
$data['items_id'] = $newID;
$data['netpoints_id'] = $this->transferDropdownNetpoint($data['netpoints_id']);
unset($np->fields);
$np->add(toolbox::addslashes_deep($data));
}
} else {
while ($data = $DB->fetch_assoc($result)) {
// Not a copy -> only update netpoint
if ($data['netpoints_id']) {
$netpointID = $this->transferDropdownNetpoint($data['netpoints_id']);
$input['id'] = $data['id'];
$input['netpoints_id'] = $netpointID;
$np->update($input);
}
}
}
}
}
}
}
示例4: pluginFusioninventoryInstall
function pluginFusioninventoryInstall($version, $migrationname = 'Migration')
{
global $DB;
ini_set("memory_limit", "-1");
ini_set("max_execution_time", "0");
$migration = new $migrationname($version);
/*
* Load classes
*/
foreach (glob(GLPI_ROOT . '/plugins/fusioninventory/inc/*.php') as $file) {
require_once $file;
}
$migration->displayMessage("Installation of plugin FusionInventory");
// Get informations of plugin
/*
* Clean if Fusion / Tracker has been installed and uninstalled (not clean correctly)
*/
$migration->displayMessage("Clean data from old installation of the plugin");
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5150'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5151'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5152'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5153'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5156'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5157'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5158'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5159'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5161'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5165'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5166'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5167'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype`='5168'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype` LIKE 'PluginFusioninventory%'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype` LIKE 'PluginFusinvinventory%'";
$DB->query($sql);
$sql = "DELETE FROM `glpi_displaypreferences`\n WHERE `itemtype` LIKE 'PluginFusinvsnmp%'";
$DB->query($sql);
// Purge network ports have itemtype tp 5153
$networkPort = new NetworkPort();
$sql = "SELECT * FROM `glpi_networkports`\n WHERE `itemtype`='5153'";
$result = $DB->query($sql);
while ($data = $DB->fetch_array($result)) {
$networkPort->delete(array('id' => $data['id']), 1);
}
/*
* Remove old rules
*/
$migration->displayMessage("Clean rules from old installation of the plugin");
$Rule = new Rule();
$a_rules = $Rule->find("`sub_type`='PluginFusioninventoryInventoryRuleImport'");
foreach ($a_rules as $data) {
$Rule->delete($data);
}
$a_rules = $Rule->find("`sub_type`='PluginFusinvinventoryRuleEntity'");
foreach ($a_rules as $data) {
$Rule->delete($data);
}
$a_rules = $Rule->find("`sub_type`='PluginFusinvinventoryRuleLocation'");
foreach ($a_rules as $data) {
$Rule->delete($data);
}
/*
* Create DB structure
*/
$migration->displayMessage("Creation tables in database");
$DB_file = GLPI_ROOT . "/plugins/fusioninventory/install/mysql/plugin_fusioninventory-empty.sql";
if (!$DB->runFile($DB_file)) {
$migration->displayMessage("Error on creation tables in database");
}
if (!$DB->runFile(GLPI_ROOT . "/plugins/fusioninventory/install/mysql/usbid.sql")) {
$migration->displayMessage("Error on creation table usbid in database");
}
if (!$DB->runFile(GLPI_ROOT . "/plugins/fusioninventory/install/mysql/pciid.sql")) {
$migration->displayMessage("Error on creation table pciid in database");
}
if (!$DB->runFile(GLPI_ROOT . "/plugins/fusioninventory/install/mysql/oui.sql")) {
$migration->displayMessage("Error on creation table oui in database");
}
/*
* Creation of folders
*/
$migration->displayMessage("Creation of folders");
if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/fusioninventory')) {
mkdir(GLPI_PLUGIN_DOC_DIR . '/fusioninventory');
}
if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/fusioninventory/tmp')) {
mkdir(GLPI_PLUGIN_DOC_DIR . '/fusioninventory/tmp');
//.........这里部分代码省略.........
示例5: importNetwork
/**
* @param $cfg_ocs
* @param $ocsComputer
* @param $computers_id
* @param $entities_id
*/
static function importNetwork($cfg_ocs, $ocsComputer, $computers_id, $entities_id)
{
global $DB;
// Group by DESCRIPTION, MACADDR, TYPE, TYPEMIB, SPEED, VIRTUALDEV
// to get an array in IPADDRESS
$ocsNetworks = array();
foreach ($ocsComputer as $ocsNetwork) {
$key = $ocsNetwork['DESCRIPTION'] . $ocsNetwork['MACADDR'] . $ocsNetwork['TYPE'] . $ocsNetwork['TYPEMIB'] . $ocsNetwork['SPEED'] . $ocsNetwork['VIRTUALDEV'];
if (!isset($ocsNetworks[$key])) {
$ocsNetworks[$key] = $ocsNetwork;
$ocsNetworks[$key]['IPADDRESS'] = array($ocsNetwork['IPADDRESS']);
} else {
$ocsNetworks[$key]['IPADDRESS'][] = $ocsNetwork['IPADDRESS'];
}
}
$network_ports = array();
$network_ifaces = array();
foreach ($ocsNetworks as $line) {
$line = Toolbox::clean_cross_side_scripting_deep(Toolbox::addslashes_deep($line));
$mac = $line['MACADDR'];
if (!isset($network_ports[$mac])) {
$network_ports[$mac] = array('virtual' => array());
}
$name = PluginOcsinventoryngOcsServer::encodeOcsDataInUtf8($cfg_ocs["ocs_db_utf8"], $line['DESCRIPTION']);
if (!empty($line['IPADDRESS'])) {
$ip = $line['IPADDRESS'];
} else {
$ip = false;
}
$networkport_type = new PluginOcsinventoryngNetworkPortType();
$networkport_type->getFromTypeAndTypeMIB($line);
$speed = NetworkPortEthernet::transformPortSpeed($line['SPEED'], false);
if (!empty($speed)) {
$networkport_type->fields['speed'] = $speed;
}
$values = array('name' => $name, 'type' => array_push($network_ifaces, $networkport_type) - 1, 'ip' => $ip, 'result' => $line);
// Virtual dev can be :
// 1°) specifically defined from OCS
// 2°) if there is already one main device
// 3°) if the networkport is issued by VMWare
if (isset($line['VIRTUALDEV']) && $line['VIRTUALDEV'] == '1' || isset($network_ports[$mac]['main']) || preg_match('/^vm(k|nic)([0-9]+)$/', $name)) {
$network_ports[$mac]['virtual'][] = $values;
} else {
$network_ports[$mac]['main'] = $values;
}
}
$already_known_ports = array();
$already_known_ifaces = array();
foreach ($network_ports as $mac => $ports) {
if (isset($ports['main'])) {
$main = $ports['main'];
$type = $network_ifaces[$main['type']];
// First search for the Network Card
$item_device = new Item_DeviceNetworkCard();
$item_device->getFromDBByQuery("INNER JOIN `glpi_devicenetworkcards`\n ON (`glpi_devicenetworkcards`.`designation`='" . $main['name'] . "')\n WHERE `glpi_items_devicenetworkcards`.`itemtype`='Computer'\n AND `glpi_items_devicenetworkcards`.`items_id`='{$computers_id}'\n AND `glpi_items_devicenetworkcards`.`mac`='{$mac}'\n AND `glpi_items_devicenetworkcards`.`devicenetworkcards_id`=\n `glpi_devicenetworkcards`.`id`");
// If not found, then, create it
if ($item_device->isNewItem()) {
$deviceNetworkCard = new DeviceNetworkCard();
$device_input = array('designation' => $main['name'], 'bandwidth' => $type->fields['speed'], 'entities_id' => $entities_id);
$net_id = $deviceNetworkCard->import($device_input);
if ($net_id) {
$item_device->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'entities_id' => $entities_id, 'devicenetworkcards_id' => $net_id, 'mac' => $mac, '_no_history' => !$cfg_ocs['history_network'], 'is_dynamic' => 1, 'is_deleted' => 0));
}
}
if (!$item_device->isNewItem()) {
$already_known_ifaces[] = $item_device->getID();
}
if ($type->fields['instantiation_type'] == __CLASS__) {
$result = $main['result'];
$inst_input = array('TYPE' => $result['TYPE'], 'TYPEMIB' => $result['TYPEMIB'], 'speed' => $result['SPEED']);
} else {
$inst_input = $type->fields;
foreach (array('id', 'name', 'OCS_TYPE', 'OCS_TYPEMIB', 'instantiation_type', 'comment') as $field) {
unset($inst_input[$field]);
}
}
$inst_input['items_devicenetworkcards_id'] = $item_device->getID();
$networkports_id = self::updateNetworkPort($mac, $main['name'], $computers_id, $type->fields['instantiation_type'], $inst_input, $main['ip'], false, $cfg_ocs['history_network'], $already_known_ports);
if ($networkports_id < 0) {
continue;
}
$already_known_ports[] = $networkports_id;
} else {
$networkports_id = 0;
}
foreach ($ports['virtual'] as $port) {
$inst_input = array('networkports_id_alias' => $networkports_id);
$id = self::updateNetworkPort($mac, $port['name'], $computers_id, 'NetworkPortAlias', $inst_input, $port['ip'], true, $cfg_ocs['history_network'], $already_known_ports);
if ($id > 0) {
$already_known_ports[] = $id;
}
}
}
$query = "SELECT `id`\n FROM `glpi_networkports`\n WHERE `itemtype` = 'Computer'\n AND `items_id` = '{$computers_id}'\n AND `is_dynamic` = '1'";
//.........这里部分代码省略.........
示例6: updateDevices
//.........这里部分代码省略.........
//carte son
$do_clean = true;
foreach ($ocsComputer as $line2) {
$line2 = Toolbox::clean_cross_side_scripting_deep(Toolbox::addslashes_deep($line2));
if ($line2['NAME']) {
if (!$cfg_ocs["ocs_db_utf8"] && !Toolbox::seems_utf8($line2["NAME"])) {
$line2["NAME"] = Toolbox::encodeInUtf8($line2["NAME"]);
}
$snd["entities_id"] = $entities_id;
$snd["designation"] = $line2["NAME"];
if (!in_array(stripslashes($prevalue . $snd["designation"]), $import_device)) {
if (!empty($line2["DESCRIPTION"])) {
$snd["comment"] = $line2["DESCRIPTION"];
}
$DeviceSoundCard = new DeviceSoundCard();
$snd_id = $DeviceSoundCard->import($snd);
if ($snd_id) {
$CompDevice->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'entities_id' => $entities_id, 'devicesoundcards_id' => $snd_id, 'is_dynamic' => 1), array(), $cfg_ocs['history_devices']);
}
} else {
$id = array_search(stripslashes($prevalue . $snd["designation"]), $import_device);
unset($import_device[$id]);
}
}
}
break;
case "Item_DeviceMotherboard":
$CompDevice = new $devicetype();
//Bios
$do_clean = true;
$mb["designation"] = $ocsComputer["MMODEL"];
$mb["entities_id"] = $entities_id;
$mb["manufacturers_id"] = Dropdown::importExternal('Manufacturer', self::encodeOcsDataInUtf8($cfg_ocs['ocs_db_utf8'], $ocsComputer["MMANUFACTURER"]));
if (!in_array(stripslashes($prevalue . $mb["designation"]), $import_device)) {
$DeviceMB = new DeviceMotherboard();
$devicemotherboards_id = $DeviceMB->import($mb);
if ($devicemotherboards_id) {
$serial = $ocsComputer["MSN"];
$CompDevice->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'devicemotherboards_id' => $devicemotherboards_id, 'is_dynamic' => 1, 'serial' => $serial, 'entities_id' => $entities_id), array(), $cfg_ocs['history_devices']);
}
} else {
$tmp = array_search(stripslashes($prevalue . $mb["designation"]), $import_device);
unset($import_device[$tmp]);
}
break;
case "Item_DeviceControl":
//controllers
$do_clean = true;
$CompDevice = new $devicetype();
foreach ($ocsComputer as $line2) {
$line2 = Toolbox::clean_cross_side_scripting_deep(Toolbox::addslashes_deep($line2));
if ($line2['NAME']) {
if (!$cfg_ocs["ocs_db_utf8"] && !Toolbox::seems_utf8($line2["NAME"])) {
$line2["NAME"] = Toolbox::encodeInUtf8($line2["NAME"]);
}
$ctrl["entities_id"] = $entities_id;
$ctrl["designation"] = $line2["NAME"];
//TODO : OCS TYPE = IDE Controller
// GLPI : interface = IDE
//$ctrl["interfacetypes_id"] = $line2["TYPE"];
$ctrl["manufacturers_id"] = Dropdown::importExternal('Manufacturer', self::encodeOcsDataInUtf8($cfg_ocs['ocs_db_utf8'], $line2["MANUFACTURER"]));
if (!in_array(stripslashes($prevalue . $ctrl["designation"]), $import_device)) {
if (!empty($line2["DESCRIPTION"])) {
$ctrl["comment"] = $line2["DESCRIPTION"];
}
$DeviceControl = new DeviceControl();
$ctrl_id = $DeviceControl->import($ctrl);
if ($ctrl_id) {
$CompDevice->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'entities_id' => $entities_id, 'devicecontrols_id' => $ctrl_id, 'is_dynamic' => 1), array(), $cfg_ocs['history_devices']);
}
} else {
$id = array_search(stripslashes($prevalue . $ctrl["designation"]), $import_device);
unset($import_device[$id]);
}
}
}
break;
}
// Delete Unexisting Items not found in OCS
if ($do_clean && count($import_device)) {
foreach ($import_device as $key => $val) {
if (!(strpos($key, $devicetype . '$$') === false)) {
list($type, $id) = explode(self::FIELD_SEPARATOR, $key);
$CompDevice = new $devicetype();
$CompDevice->delete(array('id' => $id, '_no_history' => !$cfg_ocs['history_devices']), true, $cfg_ocs['history_devices']);
}
}
}
//TODO Import IP
if ($do_clean && count($import_ip) && $devicetype == "Item_DeviceNetworkCard") {
foreach ($import_ip as $key => $val) {
if ($key > 0) {
$netport = new NetworkPort();
$netport->delete(array('id' => $key, '_no_history' => !$cfg_ocs['history_network']), 0, $cfg_ocs['history_network']);
}
}
}
//Alimentation
//Carte mere
}
示例7: updateDevices
//.........这里部分代码省略.........
} else {
$tmp = array_search(stripslashes($prevalue . $processor["designation"]), $import_device);
list($type, $id) = explode(self::FIELD_SEPARATOR, $tmp);
$CompDevice->update(array('id' => $id, 'frequency' => $line["PROCESSORS"]));
unset($import_device[$tmp]);
}
}
}
}
break;
case "Item_DeviceNetworkCard":
//Carte reseau
if ($cfg_ocs["import_device_iface"] || $cfg_ocs["import_ip"]) {
PluginOcsinventoryngNetworkPort::importNetwork($PluginOcsinventoryngDBocs, $cfg_ocs, $ocsid, $computers_id, $dohistory);
}
break;
case "Item_DeviceGraphicCard":
$CompDevice = new $devicetype();
//carte graphique
if ($cfg_ocs["import_device_gfxcard"]) {
$do_clean = true;
$query2 = "SELECT DISTINCT(`NAME`) AS NAME,\n `MEMORY`\n FROM `videos`\n WHERE `HARDWARE_ID` = '{$ocsid}'\n AND `NAME` != ''\n ORDER BY `ID`";
$result2 = $PluginOcsinventoryngDBocs->query($query2);
if ($PluginOcsinventoryngDBocs->numrows($result2) > 0) {
while ($line2 = $PluginOcsinventoryngDBocs->fetch_array($result2)) {
$line2 = Toolbox::clean_cross_side_scripting_deep(Toolbox::addslashes_deep($line2));
$video["designation"] = $line2["NAME"];
if (!is_numeric($line2["MEMORY"])) {
$line2["MEMORY"] = 0;
}
if (!in_array(stripslashes($prevalue . $video["designation"]), $import_device)) {
$video["memory_default"] = $line2["MEMORY"];
$DeviceGraphicCard = new DeviceGraphicCard();
$video_id = $DeviceGraphicCard->import($video);
if ($video_id) {
$devID = $CompDevice->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'devicegraphiccards_id' => $video_id, 'memory' => $line2["MEMORY"], 'is_dynamic' => 1, '_no_history' => !$dohistory));
}
} else {
$tmp = array_search(stripslashes($prevalue . $video["designation"]), $import_device);
list($type, $id) = explode(self::FIELD_SEPARATOR, $tmp);
$CompDevice->update(array('id' => $id, 'memory' => $line2["MEMORY"]));
unset($import_device[$tmp]);
}
}
}
}
break;
case "Item_DeviceSoundCard":
$CompDevice = new $devicetype();
//carte son
if ($cfg_ocs["import_device_sound"]) {
$do_clean = true;
$query2 = "SELECT DISTINCT(`NAME`) AS NAME,\n `DESCRIPTION`\n FROM `sounds`\n WHERE `HARDWARE_ID` = '{$ocsid}'\n AND `NAME` != ''\n ORDER BY `ID`";
$result2 = $PluginOcsinventoryngDBocs->query($query2);
if ($PluginOcsinventoryngDBocs->numrows($result2) > 0) {
while ($line2 = $PluginOcsinventoryngDBocs->fetch_array($result2)) {
$line2 = Toolbox::clean_cross_side_scripting_deep(Toolbox::addslashes_deep($line2));
if (!$cfg_ocs["ocs_db_utf8"] && !Toolbox::seems_utf8($line2["NAME"])) {
$line2["NAME"] = Toolbox::encodeInUtf8($line2["NAME"]);
}
$snd["designation"] = $line2["NAME"];
if (!in_array(stripslashes($prevalue . $snd["designation"]), $import_device)) {
if (!empty($line2["DESCRIPTION"])) {
$snd["comment"] = $line2["DESCRIPTION"];
}
$DeviceSoundCard = new DeviceSoundCard();
$snd_id = $DeviceSoundCard->import($snd);
if ($snd_id) {
$devID = $CompDevice->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'devicesoundcards_id' => $snd_id, 'is_dynamic' => 1, '_no_history' => !$dohistory));
}
} else {
$id = array_search(stripslashes($prevalue . $snd["designation"]), $import_device);
unset($import_device[$id]);
}
}
}
}
break;
}
// Delete Unexisting Items not found in OCS
if ($do_clean && count($import_device)) {
foreach ($import_device as $key => $val) {
if (!(strpos($key, $devicetype . '$$') === false)) {
list($type, $id) = explode(self::FIELD_SEPARATOR, $key);
$CompDevice->delete(array('id' => $id, '_no_history' => !$dohistory, 1), true);
}
}
}
//TODO Import IP
if ($do_clean && count($import_ip) && $devicetype == "Item_DeviceNetworkCard") {
foreach ($import_ip as $key => $val) {
if ($key > 0) {
$netport = new NetworkPort();
$netport->delete(array('id' => $key));
}
}
}
//Alimentation
//Carte mere
}
示例8: unset
$input["logical_number"] = $i;
$input["name"] = $_POST["name"] . $add . $i;
unset($np->fields["id"]);
if ($np->can(-1, CREATE, $input)) {
$np->splitInputForElements($input);
$np->add($input);
$np->updateDependencies(1);
}
}
Event::log(0, "networkport", 5, "inventory", sprintf(__('%s adds several network ports'), $_SESSION["glpiname"]));
Html::back();
}
} else {
if (isset($_POST["purge"])) {
$np->check($_POST['id'], PURGE);
$np->delete($_POST, 1);
Event::log($_POST['id'], "networkport", 5, "inventory", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
if ($item = getItemForItemtype($np->fields['itemtype'])) {
Html::redirect($item->getFormURL() . '?id=' . $np->fields['items_id']);
}
Html::redirect($CFG_GLPI["root_doc"] . "/front/central.php");
} else {
if (isset($_POST["update"])) {
$np->check($_POST['id'], UPDATE);
$np->splitInputForElements($_POST);
$np->update($_POST);
$np->updateDependencies(1);
Event::log($_POST["id"], "networkport", 4, "inventory", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
Html::back();
} else {
if (isset($_POST["disconnect"])) {
示例9: purgeUnmanagedDevice
/**
* Purge unmanaged devices
*
* @param $pram object to purge
*
* @return nothing
*
**/
static function purgeUnmanagedDevice($parm)
{
// Delete XML file if exist
$folder = substr($parm->fields["id"], 0, -1);
if (empty($folder)) {
$folder = '0';
}
if (file_exists(GLPI_PLUGIN_DOC_DIR . "/fusioninventory/xml/PluginFusioninventoryUnmanaged/" . $folder . "/" . $parm->fields["id"])) {
unlink(GLPI_PLUGIN_DOC_DIR . "/fusioninventory/xml/PluginFusioninventoryUnmanaged/" . $folder . "/" . $parm->fields["id"]);
}
// Delete Networkports
$NetworkPort = new NetworkPort();
$a_ports = $NetworkPort->find("`items_id`='" . $parm->fields["id"] . "'\n AND `itemtype`='PluginFusioninventoryUnmanaged'");
foreach ($a_ports as $a_port) {
$NetworkPort->delete($a_port, 1);
}
}
示例10: plugin_item_purge_fusioninventory
function plugin_item_purge_fusioninventory($parm)
{
switch (get_class($parm)) {
case 'NetworkPort_NetworkPort':
// If remove connection of a hub port (unknown device), we must delete this port too
$NetworkPort = new NetworkPort();
$NetworkPort_Vlan = new NetworkPort_Vlan();
$pfUnmanaged = new PluginFusioninventoryUnmanaged();
$networkPort_NetworkPort = new NetworkPort_NetworkPort();
$a_hubs = array();
$port_id = $NetworkPort->getContact($parm->getField('networkports_id_1'));
$NetworkPort->getFromDB($parm->getField('networkports_id_1'));
if ($NetworkPort->fields['itemtype'] == 'PluginFusioninventoryUnmanaged') {
$pfUnmanaged->getFromDB($NetworkPort->fields['items_id']);
if ($pfUnmanaged->fields['hub'] == '1') {
$a_hubs[$NetworkPort->fields['items_id']] = 1;
$NetworkPort->delete($NetworkPort->fields);
}
}
$NetworkPort->getFromDB($port_id);
if ($port_id) {
if ($NetworkPort->fields['itemtype'] == 'PluginFusioninventoryUnmanaged') {
$pfUnmanaged->getFromDB($NetworkPort->fields['items_id']);
if ($pfUnmanaged->fields['hub'] == '1') {
$a_hubs[$NetworkPort->fields['items_id']] = 1;
}
}
}
$port_id = $NetworkPort->getContact($parm->getField('networkports_id_2'));
$NetworkPort->getFromDB($parm->getField('networkports_id_2'));
if ($NetworkPort->fields['itemtype'] == 'PluginFusioninventoryUnmanaged') {
if ($pfUnmanaged->getFromDB($NetworkPort->fields['items_id'])) {
if ($pfUnmanaged->fields['hub'] == '1') {
$a_vlans = $NetworkPort_Vlan->getVlansForNetworkPort($NetworkPort->fields['id']);
foreach ($a_vlans as $vlan_id) {
$NetworkPort_Vlan->unassignVlan($NetworkPort->fields['id'], $vlan_id);
}
$a_hubs[$NetworkPort->fields['items_id']] = 1;
$NetworkPort->delete($NetworkPort->fields);
}
}
}
if ($port_id) {
$NetworkPort->getFromDB($port_id);
if ($NetworkPort->fields['itemtype'] == 'PluginFusioninventoryUnmanaged') {
$pfUnmanaged->getFromDB($NetworkPort->fields['items_id']);
if ($pfUnmanaged->fields['hub'] == '1') {
$a_hubs[$NetworkPort->fields['items_id']] = 1;
}
}
}
// If hub have no port, delete it
foreach (array_keys($a_hubs) as $unkowndevice_id) {
$a_networkports = $NetworkPort->find("`itemtype`='PluginFusioninventoryUnmanaged'\n AND `items_id`='" . $unkowndevice_id . "' ");
if (count($a_networkports) < 2) {
$pfUnmanaged->delete(array('id' => $unkowndevice_id), 1);
} else {
if (count($a_networkports) == '2') {
$switchPorts_id = 0;
$otherPorts_id = 0;
foreach ($a_networkports as $data) {
if ($data['name'] == 'Link') {
$switchPorts_id = $NetworkPort->getContact($data['id']);
} else {
if ($otherPorts_id == '0') {
$otherPorts_id = $NetworkPort->getContact($data['id']);
} else {
$switchPorts_id = $NetworkPort->getContact($data['id']);
}
}
}
$pfUnmanaged->disconnectDB($switchPorts_id);
// disconnect this port
$pfUnmanaged->disconnectDB($otherPorts_id);
// disconnect destination port
$networkPort_NetworkPort->add(array('networkports_id_1' => $switchPorts_id, 'networkports_id_2' => $otherPorts_id));
}
}
}
break;
case 'NetworkEquipment':
// Delete all ports
$query_delete = "DELETE FROM `glpi_plugin_fusioninventory_networkequipments`\n WHERE `networkequipments_id`='" . $parm->fields["id"] . "';";
$DB->query($query_delete);
$query_select = "SELECT `glpi_plugin_fusioninventory_networkports`.`id`,\n `glpi_networkports`.`id` as nid\n FROM `glpi_plugin_fusioninventory_networkports`\n LEFT JOIN `glpi_networkports`\n ON `glpi_networkports`.`id` = `networkports_id`\n WHERE `items_id`='" . $parm->fields["id"] . "'\n AND `itemtype`='NetworkEquipment';";
$result = $DB->query($query_select);
while ($data = $DB->fetch_array($result)) {
$query_delete = "DELETE FROM `glpi_plugin_fusioninventory_networkports`\n WHERE `id`='" . $data["id"] . "';";
$DB->query($query_delete);
$query_delete = "DELETE FROM `glpi_plugin_fusinvsnmp_networkportlogs`\n WHERE `networkports_id`='" . $data['nid'] . "'";
$DB->query($query_delete);
}
break;
case "Printer":
$query_delete = "DELETE FROM `glpi_plugin_fusioninventory_printers`\n WHERE `printers_id`='" . $parm->fields["id"] . "';";
$DB->query($query_delete);
$query_delete = "DELETE FROM `glpi_plugin_fusioninventory_printercartridges`\n WHERE `printers_id`='" . $parm->fields["id"] . "';";
$DB->query($query_delete);
$query_delete = "DELETE FROM `glpi_plugin_fusioninventory_printerlogs`\n WHERE `printers_id`='" . $parm->fields["id"] . "';";
$DB->query($query_delete);
//.........这里部分代码省略.........
示例11: manageNetworkPort
function manageNetworkPort($inventory_networkports, $computers_id, $no_history)
{
global $DB;
$networkPort = new NetworkPort();
$networkName = new NetworkName();
$iPAddress = new IPAddress();
$iPNetwork = new IPNetwork();
$networkPortEthernet = new NetworkPortEthernet();
$item_DeviceNetworkCard = new Item_DeviceNetworkCard();
foreach ($inventory_networkports as $a_networkport) {
if ($a_networkport['mac'] != '') {
$a_networkports = $networkPort->find("`mac`='" . $a_networkport['mac'] . "'\n AND `itemtype`='PluginFusioninventoryUnmanaged'", "", 1);
if (count($a_networkports) > 0) {
$input = current($a_networkports);
$unmanageds_id = $input['items_id'];
$input['logical_number'] = $a_networkport['logical_number'];
$input['itemtype'] = 'Computer';
$input['items_id'] = $computers_id;
$input['is_dynamic'] = 1;
$input['name'] = $a_networkport['name'];
$networkPort->update($input, !$no_history);
$pfUnmanaged = new PluginFusioninventoryUnmanaged();
$pfUnmanaged->delete(array('id' => $unmanageds_id), 1);
}
}
}
// end get port from unknwon device
$db_networkport = array();
if ($no_history === FALSE) {
$query = "SELECT `id`, `name`, `mac`, `instantiation_type`, `logical_number`\n FROM `glpi_networkports`\n WHERE `items_id` = '{$computers_id}'\n AND `itemtype`='Computer'\n AND `is_dynamic`='1'";
$result = $DB->query($query);
while ($data = $DB->fetch_assoc($result)) {
$idtmp = $data['id'];
unset($data['id']);
if (is_null($data['mac'])) {
$data['mac'] = '';
}
if (preg_match("/[^a-zA-Z0-9 \\-_\\(\\)]+/", $data['name'])) {
$data['name'] = Toolbox::addslashes_deep($data['name']);
}
$db_networkport[$idtmp] = array_map('strtolower', $data);
}
}
$simplenetworkport = array();
foreach ($inventory_networkports as $key => $a_networkport) {
// Add ipnetwork if not exist
if ($a_networkport['gateway'] != '' && $a_networkport['netmask'] != '' && $a_networkport['subnet'] != '') {
if (countElementsInTable('glpi_ipnetworks', "`address`='" . $a_networkport['subnet'] . "'\n AND `netmask`='" . $a_networkport['netmask'] . "'\n AND `gateway`='" . $a_networkport['gateway'] . "'\n AND `entities_id`='" . $_SESSION["plugin_fusioninventory_entity"] . "'") == 0) {
$input_ipanetwork = array('name' => $a_networkport['subnet'] . '/' . $a_networkport['netmask'] . ' - ' . $a_networkport['gateway'], 'network' => $a_networkport['subnet'] . ' / ' . $a_networkport['netmask'], 'gateway' => $a_networkport['gateway'], 'entities_id' => $_SESSION["plugin_fusioninventory_entity"]);
$iPNetwork->add($input_ipanetwork, array(), !$no_history);
}
}
// End add ipnetwork
$a_field = array('name', 'mac', 'instantiation_type');
foreach ($a_field as $field) {
if (isset($a_networkport[$field])) {
$simplenetworkport[$key][$field] = $a_networkport[$field];
}
}
}
foreach ($simplenetworkport as $key => $arrays) {
$arrayslower = array_map('strtolower', $arrays);
foreach ($db_networkport as $keydb => $arraydb) {
$logical_number = $arraydb['logical_number'];
unset($arraydb['logical_number']);
if ($arrayslower == $arraydb) {
if ($inventory_networkports[$key]['logical_number'] != $logical_number) {
$input = array();
$input['id'] = $keydb;
$input['logical_number'] = $inventory_networkports[$key]['logical_number'];
$networkPort->update($input, !$no_history);
}
// Add / update instantiation_type
if (isset($inventory_networkports[$key]['instantiation_type'])) {
if ($inventory_networkports[$key]['instantiation_type'] == 'NetworkPortEthernet') {
$portsethernet = $networkPortEthernet->find("`networkports_id`='" . $keydb . "'", '', 1);
if (count($portsethernet) == 1) {
$portethernet = current($portsethernet);
$input = $portethernet;
} else {
$input = array('networkports_id' => $keydb);
}
if (isset($inventory_networkports[$key]['speed'])) {
$input['speed'] = $inventory_networkports[$key]['speed'];
$input['speed_other_value'] = $inventory_networkports[$key]['speed'];
}
if (isset($inventory_networkports[$key]['mac'])) {
$networkcards = $item_DeviceNetworkCard->find("`mac`='" . $inventory_networkports[$key]['mac'] . "' " . " AND `itemtype`='Computer'" . " AND `items_id`='" . $computers_id . "'", '', 1);
if (count($networkcards) == 1) {
$networkcard = current($networkcards);
$input['items_devicenetworkcards_id'] = $networkcard['id'];
}
}
$input['_no_history'] = $no_history;
if (isset($input['id'])) {
$networkPortEthernet->update($input);
} else {
$networkPortEthernet->add($input);
}
}
//.........这里部分代码省略.........
示例12: unset
$add = "0";
}
$input["logical_number"] = $i;
$input["name"] = $_POST["name"] . $add . $i;
unset($np->fields["id"]);
if ($np->can(-1, 'w', $input)) {
$np->add($input);
}
}
Event::log(0, "networkport", 5, "inventory", $_SESSION["glpiname"] . " " . ($_POST["to_logical_number"] - $_POST["from_logical_number"] + 1) . " " . $LANG['log'][71]);
glpi_header($_SERVER['HTTP_REFERER']);
}
} else {
if (isset($_POST["delete"])) {
$np->check($_POST['id'], 'd');
$np->delete($_POST);
Event::log($_POST['id'], "networkport", 5, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][73]);
if (class_exists($np->fields['itemtype'])) {
$item = new $np->fields['itemtype']();
glpi_header($item->getFormURL() . '?id=' . $np->fields['items_id']);
}
glpi_header($CFG_GLPI["root_doc"] . "/front/central.php");
} else {
if (isset($_POST["delete_several"])) {
checkRight("networking", "w");
if (isset($_POST["del_port"]) && count($_POST["del_port"])) {
foreach ($_POST["del_port"] as $port_id => $val) {
if ($np->can($port_id, 'd')) {
$np->delete(array("id" => $port_id));
}
}
示例13: updateDevices
//.........这里部分代码省略.........
$line2["MEMORY"] = 0;
}
if (!in_array(stripslashes($prevalue . $video["designation"]), $import_device)) {
$video["memory_default"] = $line2["MEMORY"];
$DeviceGraphicCard = new DeviceGraphicCard();
$video_id = $DeviceGraphicCard->import($video);
if ($video_id) {
$devID = $CompDevice->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'entities_id' => $entities_id, 'devicegraphiccards_id' => $video_id, 'memory' => $line2["MEMORY"], 'is_dynamic' => 1, '_no_history' => !$dohistory));
}
} else {
$tmp = array_search(stripslashes($prevalue . $video["designation"]), $import_device);
list($type, $id) = explode(self::FIELD_SEPARATOR, $tmp);
$CompDevice->update(array('id' => $id, 'memory' => $line2["MEMORY"]));
unset($import_device[$tmp]);
}
}
}
}
}
break;
case "Item_DeviceSoundCard":
$CompDevice = new $devicetype();
//carte son
$do_clean = true;
if ($ocsComputer) {
if (isset($ocsComputer['SOUNDS'])) {
foreach ($ocsComputer['SOUNDS'] as $line2) {
$line2 = Toolbox::clean_cross_side_scripting_deep(Toolbox::addslashes_deep($line2));
if ($line2['NAME']) {
if (!$cfg_ocs["ocs_db_utf8"] && !Toolbox::seems_utf8($line2["NAME"])) {
$line2["NAME"] = Toolbox::encodeInUtf8($line2["NAME"]);
}
$snd["entities_id"] = $entities_id;
$snd["designation"] = $line2["NAME"];
if (!in_array(stripslashes($prevalue . $snd["designation"]), $import_device)) {
if (!empty($line2["DESCRIPTION"])) {
$snd["comment"] = $line2["DESCRIPTION"];
}
$DeviceSoundCard = new DeviceSoundCard();
$snd_id = $DeviceSoundCard->import($snd);
if ($snd_id) {
$devID = $CompDevice->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'entities_id' => $entities_id, 'devicesoundcards_id' => $snd_id, 'is_dynamic' => 1, '_no_history' => !$dohistory));
}
} else {
$id = array_search(stripslashes($prevalue . $snd["designation"]), $import_device);
unset($import_device[$id]);
}
}
}
}
}
break;
case "PluginOcsinventoryngItem_DeviceBiosdata":
$CompDevice = new $devicetype();
//Bios
$do_clean = true;
if ($ocsComputer) {
if (isset($ocsComputer['BIOS'])) {
$bios["designation"] = $ocsComputer['BIOS']["BVERSION"];
$bios["assettag"] = $ocsComputer['BIOS']["ASSETTAG"];
$bios["entities_id"] = $entities_id;
//$date = str_replace("/", "-", $ocsComputer['BIOS']["BDATE"]);
//$date = date("Y-m-d", strtotime($date));
$bios["date"] = $ocsComputer['BIOS']["BDATE"];
$bios["manufacturers_id"] = Dropdown::importExternal('Manufacturer', self::encodeOcsDataInUtf8($cfg_ocs['ocs_db_utf8'], $ocsComputer['BIOS']["SMANUFACTURER"]));
if (!in_array(stripslashes($prevalue . $bios["designation"]), $import_device)) {
$DeviceBios = new PluginOcsinventoryngDeviceBiosdata();
$bios_id = $DeviceBios->import($bios);
if ($bios_id) {
$devID = $CompDevice->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'plugin_ocsinventoryng_devicebiosdatas_id' => $bios_id, 'is_dynamic' => 1, 'entities_id' => $entities_id, '_no_history' => !$dohistory));
}
} else {
$tmp = array_search(stripslashes($prevalue . $bios["designation"]), $import_device);
unset($import_device[$tmp]);
}
}
}
break;
}
// Delete Unexisting Items not found in OCS
if ($do_clean && count($import_device)) {
foreach ($import_device as $key => $val) {
if (!(strpos($key, $devicetype . '$$') === false)) {
list($type, $id) = explode(self::FIELD_SEPARATOR, $key);
$CompDevice->delete(array('id' => $id, '_no_history' => !$dohistory, 1), true);
}
}
}
//TODO Import IP
if ($do_clean && count($import_ip) && $devicetype == "Item_DeviceNetworkCard") {
foreach ($import_ip as $key => $val) {
if ($key > 0) {
$netport = new NetworkPort();
$netport->delete(array('id' => $key));
}
}
}
//Alimentation
//Carte mere
}
示例14: importPorts
function importPorts($a_inventory, $items_id)
{
$pfNetworkporttype = new PluginFusioninventoryNetworkporttype();
$networkPort = new NetworkPort();
$pfNetworkPort = new PluginFusioninventoryNetworkPort();
$networkports_id = 0;
foreach ($a_inventory['networkport'] as $a_port) {
$ifType = $a_port['iftype'];
if ($pfNetworkporttype->isImportType($ifType) || isset($a_inventory['aggregate'][$a_port['logical_number']]) || $ifType == '') {
$a_ports_DB = current($networkPort->find("`itemtype`='NetworkEquipment'\n AND `items_id`='" . $items_id . "'\n AND `logical_number` = '" . $a_port['logical_number'] . "'", '', 1));
if (!isset($a_ports_DB['id'])) {
// Add port
if (isset($a_inventory['aggregate']) && isset($a_inventory['aggregate'][$a_port['logical_number']])) {
$a_port['instantiation_type'] = 'NetworkPortAggregate';
} else {
$a_port['instantiation_type'] = 'NetworkPortEthernet';
}
$a_port['items_id'] = $items_id;
$a_port['itemtype'] = 'NetworkEquipment';
$networkports_id = $networkPort->add($a_port);
unset($a_port['id']);
$a_pfnetworkport_DB = current($pfNetworkPort->find("`networkports_id`='" . $networkports_id . "'", '', 1));
$a_port['id'] = $a_pfnetworkport_DB['id'];
$a_port['lastup'] = date('Y-m-d H:i:s');
$pfNetworkPort->update($a_port);
} else {
// Update port
$networkports_id = $a_ports_DB['id'];
$a_port['id'] = $a_ports_DB['id'];
$networkPort->update($a_port);
unset($a_port['id']);
// Check if pfnetworkport exist.
$a_pfnetworkport_DB = current($pfNetworkPort->find("`networkports_id`='" . $networkports_id . "'", '', 1));
$a_port['networkports_id'] = $networkports_id;
if (isset($a_pfnetworkport_DB['id'])) {
$a_port['id'] = $a_pfnetworkport_DB['id'];
if ($a_port['ifstatus'] == 0 && $a_pfnetworkport_DB['ifstatus'] == 1) {
$a_port['lastup'] = date('Y-m-d H:i:s');
}
$pfNetworkPort->update($a_port);
} else {
$a_port['networkports_id'] = $networkports_id;
$a_port['lastup'] = date('Y-m-d H:i:s');
$pfNetworkPort->add($a_port);
}
}
// Connections
if (isset($a_inventory['connection-lldp'][$a_port['logical_number']])) {
$this->importConnectionLLDP($a_inventory['connection-lldp'][$a_port['logical_number']], $networkports_id);
} else {
if (isset($a_inventory['connection-mac'][$a_port['logical_number']])) {
$this->importConnectionMac($a_inventory['connection-mac'][$a_port['logical_number']], $networkports_id);
}
}
// Vlan
if (isset($a_inventory['vlans'][$a_port['logical_number']])) {
$this->importPortVlan($a_inventory['vlans'][$a_port['logical_number']], $networkports_id);
}
// Aggegation
if (isset($a_inventory['aggregate']) && isset($a_inventory['aggregate'][$a_port['logical_number']])) {
$this->importPortAggregate($a_inventory['aggregate'][$a_port['logical_number']], $networkports_id, $items_id);
}
} else {
// Delete the port
$a_ports_DB = current($networkPort->find("`itemtype`='NetworkEquipment'\n AND `items_id`='" . $items_id . "'\n AND `logical_number` = '" . $a_port['logical_number'] . "'", '', 1));
if (count($a_ports_DB) > 0) {
$networkPort->delete($a_ports_DB);
}
}
}
}
示例15: transferNetworkLink
/**
* Transfer network links
*
* @param $itemtype original type of transfered item
* @param $ID original ID of the item
* @param $newID new ID of the item
* @param $ocs_computer if computer type OCS ID of the item if available
**/
function transferNetworkLink($itemtype, $ID, $newID, $ocs_computer = false)
{
global $DB;
$np = new NetworkPort();
$nn = new NetworkPort_NetworkPort();
$query = "SELECT *\n FROM `glpi_networkports`\n WHERE `items_id` = '{$ID}'\n AND `itemtype` = '{$itemtype}'";
if ($result = $DB->query($query)) {
if ($DB->numrows($result) != 0) {
switch ($this->options['keep_networklink']) {
// Delete netport
case 0:
// Not a copy -> delete
if ($ID == $newID) {
while ($data = $DB->fetch_array($result)) {
$np->delete(array('id' => $data['id']));
}
// Only case of ocs link update is needed (if netports are keep nothing to do)
if ($ocs_computer) {
$query = "UPDATE `glpi_ocslinks`\n SET `import_ip` = NULL\n WHERE `computers_id` = '{$ID}'";
$DB->query($query);
}
}
// Copy -> do nothing
break;
// Disconnect
// Disconnect
case 1:
// Not a copy -> disconnect
if ($ID == $newID) {
while ($data = $DB->fetch_array($result)) {
if ($nn->getFromDBForNetworkPort($data['id'])) {
$nn->delete($data);
}
if ($data['netpoints_id']) {
$netpointID = $this->transferDropdownNetpoint($data['netpoints_id']);
$input['id'] = $data['id'];
$input['netpoints_id'] = $netpointID;
$np->update($input);
}
}
} else {
// Copy -> copy netports
while ($data = $DB->fetch_array($result)) {
$data = addslashes_deep($data);
unset($data['id']);
$data['items_id'] = $newID;
$data['netpoints_id'] = $this->transferDropdownNetpoint($data['netpoints_id']);
unset($np->fields);
$np->add($data);
}
}
break;
// Keep network links
// Keep network links
default:
// Copy -> Copy netpoints (do not keep links)
if ($ID != $newID) {
while ($data = $DB->fetch_array($result)) {
unset($data['id']);
$data['items_id'] = $newID;
$data['netpoints_id'] = $this->transferDropdownNetpoint($data['netpoints_id']);
unset($np->fields);
$np->add($data);
}
} else {
while ($data = $DB->fetch_array($result)) {
// Not a copy -> only update netpoint
if ($data['netpoints_id']) {
$netpointID = $this->transferDropdownNetpoint($data['netpoints_id']);
$input['id'] = $data['id'];
$input['netpoints_id'] = $netpointID;
$np->update($input);
}
}
}
}
}
}
}