本文整理汇总了PHP中Computer_Item::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Computer_Item::delete方法的具体用法?PHP Computer_Item::delete怎么用?PHP Computer_Item::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Computer_Item
的用法示例。
在下文中一共展示了Computer_Item::delete方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveDirectConnections
/**
* Move direct connections from old printer to the new one
*
* @param $ID the old printer's id
* @param $new_printers_id the new printer's id
*
* @return nothing
**/
function moveDirectConnections($ID, $new_printers_id)
{
global $DB;
$computeritem = new Computer_Item();
//For each direct connection of this printer
foreach (getAllDatasFromTable("glpi_computers_items", "`itemtype` = 'Printer'\n AND `items_id` = '{$ID}'") as $connection) {
//Direct connection exists in the target printer ?
if (!countElementsInTable("glpi_computers_items", "`itemtype` = 'Printer'\n AND `items_id` = '{$new_printers_id}'\n AND `computers_id`='" . $connection["computers_id"] . "'")) {
//Direct connection doesn't exists in the target printer : move it
$computeritem->update(array('id' => $connection['id'], 'items_id' => $new_printers_id));
} else {
//Direct connection already exists in the target printer : delete it
$computeritem->delete($connection);
}
}
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:24,代码来源:ruledictionnaryprintercollection.class.php
示例2: transferDirectConnection
//.........这里部分代码省略.........
// Not yet tranfer
// Can be managed like a non global one ?
// = all linked computers need to be transfer (so not copy)
$query = "SELECT count(*) AS CPT\n FROM `glpi_computers_items`\n WHERE `itemtype` = '" . $link_type . "'\n AND `items_id` = '{$item_ID}'\n AND `computers_id`\n NOT IN " . $this->item_search['Computer'];
$result_search = $DB->query($query);
// All linked computers need to be transfer -> use unique transfer system
if ($DB->result($result_search, 0, 'CPT') == 0) {
$need_clean_process = false;
$this->transferItem($link_type, $item_ID, $item_ID);
$newID = $item_ID;
} else {
// else Transfer by Copy
$need_clean_process = true;
// Is existing global item in the destination entity ?
$query = "SELECT *\n FROM `" . getTableForItemType($link_type) . "`\n WHERE `is_global` = '1'\n AND `entities_id` = '" . $this->to . "'\n AND `name`\n = '" . addslashes($link_item->getField('name')) . "'";
if ($result_search = $DB->query($query)) {
if ($DB->numrows($result_search) > 0) {
$newID = $DB->result($result_search, 0, 'id');
$this->addToAlreadyTransfer($link_type, $item_ID, $newID);
}
}
// Not found -> transfer copy
if ($newID < 0) {
// 1 - create new item
unset($link_item->fields['id']);
$input = $link_item->fields;
$input['entities_id'] = $this->to;
unset($link_item->fields);
$newID = $link_item->add($input);
// 2 - transfer as copy
$this->transferItem($link_type, $item_ID, $newID);
}
// Founded -> use to link : nothing to do
}
}
// Finish updated link if needed
if ($newID > 0 && $newID != $item_ID) {
$query = "UPDATE `glpi_computers_items`\n SET `items_id` = '{$newID}'\n WHERE `id` = '" . $data['id'] . "' ";
$DB->query($query);
}
} else {
// Else delete link
// Call Disconnect for global device (no disconnect behavior, but history )
$conn = new Computer_Item();
$conn->delete(array('id' => $data['id'], '_no_auto_action' => true));
$need_clean_process = true;
// OCS clean link
if ($ocs_computer && !empty($ocs_field)) {
$query = "UPDATE `glpi_ocslinks`\n SET `{$ocs_field}` = NULL\n WHERE `computers_id` = '{$ID}'";
$DB->query($query);
}
}
// If clean and not linked dc -> delete
if ($need_clean_process && $clean) {
$query = "SELECT COUNT(*) AS CPT\n FROM `glpi_computers_items`\n WHERE `items_id` = '{$item_ID}'\n AND `itemtype` = '" . $link_type . "'";
if ($result_dc = $DB->query($query)) {
if ($DB->result($result_dc, 0, 'CPT') == 0) {
if ($clean == 1) {
$link_item->delete(array('id' => $item_ID));
}
if ($clean == 2) {
// purge
$link_item->delete(array('id' => $item_ID), 1);
}
}
}
}
} else {
// If unique :
//if keep -> transfer list else unlink
if ($keep) {
$this->transferItem($link_type, $item_ID, $item_ID);
} else {
// Else delete link (apply disconnect behavior)
$conn = new Computer_Item();
$conn->delete(array('id' => $data['id']));
//if clean -> delete
if ($clean == 1) {
$link_item->delete(array('id' => $item_ID));
} else {
if ($clean == 2) {
// purge
$link_item->delete(array('id' => $item_ID), 1);
}
}
if ($ocs_computer && !empty($ocs_field)) {
$query = "UPDATE `glpi_ocslinks`\n SET `{$ocs_field}` = NULL\n WHERE `computers_id` = '{$ID}'";
$DB->query($query);
}
}
}
} else {
// Unexisting item / Force disconnect
$conn = new Computer_Item();
$conn->delete(array('id' => $data['id'], '_no_history' => true, '_no_auto_action' => true));
}
}
}
}
}
示例3: manageConnectionComputer
/**
* Delete direct connection beetween an item and a computer when transfering the item
*
* @param $itemtype itemtype to tranfer
* @param $ID ID of the item
*
* @since version 0.84.4
**/
function manageConnectionComputer($itemtype, $ID)
{
global $DB;
// Get connections
$query = "SELECT *\n FROM `glpi_computers_items`\n WHERE `computers_id` NOT IN " . $this->item_search['Computer'] . "\n AND `itemtype` = '" . $itemtype . "'\n AND `items_id` = {$ID}";
if ($result = $DB->query($query)) {
if ($DB->numrows($result) != 0) {
// Foreach get item
$conn = new Computer_Item();
$comp = new Computer();
while ($data = $DB->fetch_assoc($result)) {
$item_ID = $data['items_id'];
if ($comp->getFromDB($item_ID)) {
$conn->delete(array('id' => $data['id']));
} else {
// Unexisting item / Force disconnect
$conn->delete(array('id' => $data['id'], '_no_history' => true, '_no_auto_action' => true));
}
}
}
}
}
示例4: cleanDBonPurge
function cleanDBonPurge()
{
global $DB;
$query = "SELECT `id`\n FROM `glpi_computers_items`\n WHERE `itemtype` = '" . $this->getType() . "'\n AND `items_id` = '" . $this->fields['id'] . "'";
if ($result = $DB->query($query)) {
if ($DB->numrows($result) > 0) {
$conn = new Computer_Item();
while ($data = $DB->fetch_assoc($result)) {
$data['_no_auto_action'] = true;
$conn->delete($data);
}
}
}
$ip = new Item_Problem();
$ip->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
}
示例5: sprintf
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
* @since version 0.84
*/
include '../inc/includes.php';
Session::checkCentralAccess();
$conn = new Computer_Item();
if (isset($_POST["disconnect"])) {
$conn->check($_POST["id"], PURGE);
$conn->delete($_POST, 1);
Event::log($_POST["computers_id"], "computers", 5, "inventory", sprintf(__('%s disconnects an item'), $_SESSION["glpiname"]));
Html::back();
// Connect a computer to a printer/monitor/phone/peripheral
} else {
if (isset($_POST["add"])) {
if (isset($_POST["items_id"]) && $_POST["items_id"] > 0) {
$conn->check(-1, CREATE, $_POST);
if ($newID = $conn->add($_POST)) {
Event::log($_POST["computers_id"], "computers", 5, "inventory", sprintf(__('%s connects an item'), $_SESSION["glpiname"]));
}
}
Html::back();
}
}
Html::displayErrorAndDie('Lost');
示例6: importPeripheral
/**
*
* Import peripherals from OCS
* @since 1.0
* @param $cfg_ocs OCSNG mode configuration
* @param $computers_id computer's id in GLPI
* @param $ocsid computer's id in OCS
* @param $ocsservers_id OCS server id
* @param $entity the entity in which the peripheral will be created
* @param $dohistory record in history link between peripheral and computer
*/
static function importPeripheral($cfg_ocs, $computers_id, $ocsservers_id, $ocsid, $entity, $dohistory)
{
global $PluginOcsinventoryngDBocs, $DB;
self::checkOCSconnection($ocsservers_id);
if ($cfg_ocs["import_periph"]) {
$already_processed = array();
$p = new Peripheral();
$conn = new Computer_Item();
$query = "SELECT DISTINCT `CAPTION`, `MANUFACTURER`, `INTERFACE`, `TYPE`\n FROM `inputs`\n WHERE `HARDWARE_ID` = '{$ocsid}'\n AND `CAPTION` <> ''";
$result = $PluginOcsinventoryngDBocs->query($query);
if ($PluginOcsinventoryngDBocs->numrows($result) > 0) {
while ($line = $PluginOcsinventoryngDBocs->fetch_array($result)) {
$line = Toolbox::clean_cross_side_scripting_deep(Toolbox::addslashes_deep($line));
$periph = array();
$periph["name"] = self::encodeOcsDataInUtf8($cfg_ocs["ocs_db_utf8"], $line["CAPTION"]);
//Look for a monitor with the same name (and serial if possible) already connected
//to this computer
$query = "SELECT `p`.`id`, `gci`.`is_deleted`\n FROM `glpi_printers` as `p`, `glpi_computers_items` as `gci`\n WHERE `p`.`id` = `gci`.`items_id`\n AND `gci`.`is_dynamic`='1'\n AND `computers_id`='{$computers_id}'\n AND `itemtype`='Peripheral'\n AND `p`.`name`='" . $periph["name"] . "'";
$results = $DB->query($query);
$id = false;
$lock = false;
if ($DB->numrows($results) > 0) {
$id = $DB->result($results, 0, 'id');
$lock = $DB->result($results, 0, 'is_deleted');
}
if (!$id) {
// Clean peripheral object
$p->reset();
if ($line["MANUFACTURER"] != "NULL") {
$periph["brand"] = self::encodeOcsDataInUtf8($cfg_ocs["ocs_db_utf8"], $line["MANUFACTURER"]);
}
if ($line["INTERFACE"] != "NULL") {
$periph["comment"] = self::encodeOcsDataInUtf8($cfg_ocs["ocs_db_utf8"], $line["INTERFACE"]);
}
$periph["peripheraltypes_id"] = Dropdown::importExternal('PeripheralType', $line["TYPE"]);
$id_periph = 0;
if ($cfg_ocs["import_periph"] == 1) {
//Config says : manage peripherals as global
//check if peripherals already exists in GLPI
$periph["is_global"] = 1;
$query = "SELECT `id`\n FROM `glpi_peripherals`\n WHERE `name` = '" . $periph["name"] . "'\n AND `is_global` = '1'\n AND `entities_id` = '{$entity}'";
$result_search = $DB->query($query);
if ($DB->numrows($result_search) > 0) {
//Periph is already in GLPI
//Do not import anything just get periph ID for link
$id_periph = $DB->result($result_search, 0, "id");
} else {
$input = $periph;
if ($cfg_ocs["states_id_default"] > 0) {
$input["states_id"] = $cfg_ocs["states_id_default"];
}
$input["entities_id"] = $entity;
$id_periph = $p->add($input);
}
} else {
if ($cfg_ocs["import_periph"] == 2) {
//Config says : manage peripherals as single units
//Import all peripherals as non global.
$input = $periph;
$input["is_global"] = 0;
if ($cfg_ocs["states_id_default"] > 0) {
$input["states_id"] = $cfg_ocs["states_id_default"];
}
$input["entities_id"] = $entity;
$id_periph = $p->add($input);
}
}
if ($id_periph) {
$already_processed[] = $id_periph;
$conn = new Computer_Item();
if ($connID = $conn->add(array('computers_id' => $computers_id, 'itemtype' => 'Peripheral', 'items_id' => $id_periph, '_no_history' => !$dohistory, 'is_dynamic' => 1))) {
//Update column "is_deleted" set value to 0 and set status to default
$input = array();
$input["id"] = $id_periph;
$input["is_deleted"] = 0;
$input["entities_id"] = $entity;
if ($cfg_ocs["states_id_default"] > 0) {
$input["states_id"] = $cfg_ocs["states_id_default"];
}
$p->update($input);
}
}
} else {
$already_processed[] = $id;
}
}
}
//Look for all monitors, not locked, not linked to the computer anymore
$query = "SELECT `id`\n FROM `glpi_computers_items`\n WHERE `itemtype`='Peripheral'\n AND `computers_id`='{$computers_id}'\n AND `is_dynamic`='1'\n AND `is_deleted`='0'";
//.........这里部分代码省略.........
示例7: cleanDBonPurge
function cleanDBonPurge()
{
global $DB;
$query = "DELETE\n FROM `glpi_computers_softwareversions`\n WHERE `computers_id` = '" . $this->fields['id'] . "'";
$result = $DB->query($query);
$query = "SELECT `id`\n FROM `glpi_computers_items`\n WHERE `computers_id` = '" . $this->fields['id'] . "'";
if ($result = $DB->query($query)) {
if ($DB->numrows($result) > 0) {
$conn = new Computer_Item();
while ($data = $DB->fetch_array($result)) {
$data['_no_auto_action'] = true;
$conn->delete($data);
}
}
}
$query = "DELETE\n FROM `glpi_registrykeys`\n WHERE `computers_id` = '" . $this->fields['id'] . "'";
$result = $DB->query($query);
$compdev = new Computer_Device();
$compdev->cleanDBonItemDelete('Computer', $this->fields['id']);
$query = "DELETE\n FROM `glpi_ocslinks`\n WHERE `computers_id` = '" . $this->fields['id'] . "'";
$result = $DB->query($query);
$disk = new ComputerDisk();
$disk->cleanDBonItemDelete('Computer', $this->fields['id']);
$vm = new ComputerVirtualMachine();
$vm->cleanDBonItemDelete('Computer', $this->fields['id']);
}
示例8: updateComputer
//.........这里部分代码省略.........
$this->addProcessor($a_processor, $computers_id, $no_history);
}
} else {
// Check all fields from source: 'designation', 'serial', 'manufacturers_id',
// 'frequence'
foreach ($a_computerinventory['processor'] as $key => $arrays) {
$frequence = $arrays['frequence'];
unset($arrays['frequence']);
unset($arrays['frequency']);
unset($arrays['frequency_default']);
foreach ($db_processors as $keydb => $arraydb) {
$frequencedb = $arraydb['frequence'];
unset($arraydb['frequence']);
unset($arraydb['frequency']);
unset($arraydb['frequency_default']);
if ($arrays == $arraydb) {
$a_criteria = $deviceProcessor->getImportCriteria();
$criteriafrequence = $a_criteria['frequence'];
$compare = explode(':', $criteriafrequence);
if ($frequence > $frequencedb - $compare[1] && $frequence < $frequencedb + $compare[1]) {
unset($a_computerinventory['processor'][$key]);
unset($db_processors[$keydb]);
break;
}
}
}
}
if (count($a_computerinventory['processor']) == 0 and count($db_processors) == 0) {
// Nothing to do
} else {
if (count($db_processors) != 0) {
// Delete processor in DB
foreach ($db_processors as $idtmp => $data) {
$item_DeviceProcessor->delete(array('id' => $idtmp), 1);
}
}
if (count($a_computerinventory['processor']) != 0) {
foreach ($a_computerinventory['processor'] as $a_processor) {
$this->addProcessor($a_processor, $computers_id, $no_history);
}
}
}
}
}
// * Memories
if ($pfConfig->getValue("component_memory") != 0) {
$db_memories = array();
if ($no_history === FALSE) {
$query = "SELECT `glpi_items_devicememories`.`id`, `designation`, `size`,\n `frequence`, `serial`, `devicememorytypes_id`,\n `glpi_items_devicememories`.`busID`\n FROM `glpi_items_devicememories`\n LEFT JOIN `glpi_devicememories` ON `devicememories_id`=`glpi_devicememories`.`id`\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']);
$data1 = Toolbox::addslashes_deep($data);
$db_memories[$idtmp] = $data1;
}
}
if (count($db_memories) == 0) {
foreach ($a_computerinventory['memory'] as $a_memory) {
$this->addMemory($a_memory, $computers_id, $no_history);
}
} else {
// Check all fields from source: 'designation', 'serial', 'size',
// 'devicememorytypes_id', 'frequence'
foreach ($a_computerinventory['memory'] as $key => $arrays) {
$frequence = $arrays['frequence'];
示例9: cleanDBonPurge
function cleanDBonPurge()
{
global $DB;
$query = "SELECT `id`\n FROM `glpi_computers_items`\n WHERE `itemtype` = '" . $this->getType() . "'\n AND `items_id` = '" . $this->fields['id'] . "'";
if ($result = $DB->query($query)) {
if ($DB->numrows($result) > 0) {
$conn = new Computer_Item();
while ($data = $DB->fetch_array($result)) {
$data['_no_auto_action'] = true;
$conn->delete($data);
}
}
}
$query = "UPDATE `glpi_cartridges`\n SET `printers_id` = NULL\n WHERE `printers_id` = '" . $this->fields['id'] . "'";
$result = $DB->query($query);
}
示例10: resetPeripherals
/**
* Delete all old periphs for a computer.
*
* @param $glpi_computers_id integer : glpi computer id.
*
* @return nothing.
**/
static function resetPeripherals($glpi_computers_id)
{
global $DB;
$query = "SELECT*\n FROM `glpi_computers_items`\n WHERE `computers_id` = '{$glpi_computers_id}'\n AND `itemtype` = 'Peripheral'";
$result = $DB->query($query);
$per = new Peripheral();
if ($DB->numrows($result) > 0) {
$conn = new Computer_Item();
while ($data = $DB->fetch_assoc($result)) {
$conn->delete(array('id' => $data['id']));
$query2 = "SELECT COUNT(*)\n FROM `glpi_computers_items`\n WHERE `items_id` = '" . $data['items_id'] . "'\n AND `itemtype` = 'Peripheral'";
$result2 = $DB->query($query2);
if ($DB->result($result2, 0, 0) == 1) {
$per->delete(array('id' => $data['items_id']), 1);
}
}
}
}
示例11: sprintf
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, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
* @since version 0.84
*/
include '../inc/includes.php';
Session::checkCentralAccess();
$conn = new Computer_Item();
if (isset($_POST["disconnect"])) {
$conn->check($_POST["id"], 'd');
$conn->delete($_POST);
Event::log($_POST["computers_id"], "computers", 5, "inventory", sprintf(__('%s disconnects an item'), $_SESSION["glpiname"]));
Html::back();
// Connect a computer to a printer/monitor/phone/peripheral
} else {
if (isset($_POST["add"])) {
if (isset($_POST["items_id"]) && $_POST["items_id"] > 0) {
$conn->check(-1, 'w', $_POST);
$conn->add($_POST);
Event::log($_POST["computers_id"], "computers", 5, "inventory", sprintf(__('%s connects an item'), $_SESSION["glpiname"]));
}
Html::back();
}
}
Html::displayErrorAndDie('Lost');
示例12:
Event::log($_REQUEST["id"], "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][24] . " " . $computer->getField('name'));
}
$computer->redirectToList();
//update a computer
} else {
if (isset($_POST["update"])) {
$computer->check($_POST['id'], 'w');
$computer->update($_POST);
Event::log($_POST["id"], "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
glpi_header($_SERVER['HTTP_REFERER']);
// Disconnect a computer from a printer/monitor/phone/peripheral
} else {
if (isset($_GET["disconnect"])) {
$conn = new Computer_Item();
$conn->check($_GET["id"], 'w');
$conn->delete($_GET);
$computer->check($_GET['computers_id'], 'w');
Event::log($_GET["computers_id"], "computers", 5, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][26]);
glpi_header($_SERVER['HTTP_REFERER']);
// Connect a computer to a printer/monitor/phone/peripheral
} else {
if (isset($_POST["connect"]) && isset($_POST["items_id"]) && $_POST["items_id"] > 0) {
$conn = new Computer_Item();
$conn->check(-1, 'w', $_POST);
$conn->add($_POST);
Event::log($_POST["computers_id"], "computers", 5, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][27]);
glpi_header($_SERVER['HTTP_REFERER']);
} else {
if (isset($_POST["unlock_monitor"])) {
$computer->check($_POST['id'], 'w');
if (isset($_POST["lockmonitor"]) && count($_POST["lockmonitor"])) {
示例13: updatePeripherals
/**
* Import the devices for a computer
*
* @param $itemtype integer : item type
* @param $entity integer : entity of the computer
* @param $computers_id integer : glpi computer id.
* @param $ocsid integer : ocs computer id (ID).
* @param $ocsservers_id integer : ocs server id
* @param $cfg_ocs array : ocs config
* @param $import_periph array : already imported periph
* @param $dohistory boolean : log changes ?
*
* @return Nothing (void).
**/
static function updatePeripherals($itemtype, $entity, $computers_id, $ocsid, $ocsservers_id, $cfg_ocs, $import_periph, $dohistory)
{
global $DB, $DBocs;
self::checkOCSconnection($ocsservers_id);
$do_clean = false;
$connID = 0;
//Tag for data since 0.70 for the import_monitor array.
$count_monitor = count($import_periph);
switch ($itemtype) {
case 'Monitor':
if ($cfg_ocs["import_monitor"]) {
//Update data in import_monitor array for 0.70
if (!in_array(self::IMPORT_TAG_070, $import_periph)) {
foreach ($import_periph as $key => $val) {
$monitor_tag = $val;
//delete old value
self::deleteInOcsArray($computers_id, $key, "import_monitor");
//search serial when it exists
$monitor_serial = "";
$query_monitor_id = "SELECT `items_id`\n FROM `glpi_computers_items`\n WHERE `id` = '{$key}'";
$result_monitor_id = $DB->query($query_monitor_id);
if ($DB->numrows($result_monitor_id) == 1) {
//get monitor Id
$id_monitor = $DB->result($result_monitor_id, 0, "items_id");
$query_monitor_serial = "SELECT `serial`\n FROM `glpi_monitors`\n WHERE `id` = '{$id_monitor}'";
$result_monitor_serial = $DB->query($query_monitor_serial);
//get serial
if ($DB->numrows($result_monitor_serial) == 1) {
$monitor_serial = $DB->result($result_monitor_serial, 0, "serial");
}
}
//concat name + serial
$monitor_tag .= $monitor_serial;
//add new value (serial + name when its possible)
self::addToOcsArray($computers_id, array($key => $monitor_tag), "import_monitor");
//Update the array with the new value of the monitor
$import_periph[$key] = $monitor_tag;
}
//add the tag for the array version's
self::addToOcsArray($computers_id, array(0 => self::IMPORT_TAG_070), "import_monitor");
}
$do_clean = true;
$m = new Monitor();
$query = "SELECT DISTINCT `CAPTION`, `MANUFACTURER`, `DESCRIPTION`, `SERIAL`, `TYPE`\n FROM `monitors`\n WHERE `HARDWARE_ID` = '{$ocsid}'";
$result = $DBocs->query($query);
$lines = array();
$checkserial = true;
// First pass - check if all serial present
if ($DBocs->numrows($result) > 0) {
while ($line = $DBocs->fetch_array($result)) {
if (empty($line["SERIAL"])) {
$checkserial = false;
}
$lines[] = clean_cross_side_scripting_deep(addslashes_deep($line));
}
}
if (count($lines) > 0 && ($cfg_ocs["import_monitor"] <= 2 || $checkserial)) {
foreach ($lines as $line) {
$mon = array();
$mon["name"] = $line["CAPTION"];
if (empty($line["CAPTION"]) && !empty($line["MANUFACTURER"])) {
$mon["name"] = $line["MANUFACTURER"];
}
if (empty($line["CAPTION"]) && !empty($line["TYPE"])) {
if (!empty($line["MANUFACTURER"])) {
$mon["name"] .= " ";
}
$mon["name"] .= $line["TYPE"];
}
$mon["serial"] = $line["SERIAL"];
$checkMonitor = $mon["name"];
if (!empty($mon["serial"])) {
$checkMonitor .= $mon["serial"];
}
if (!empty($mon["name"])) {
$id = array_search(stripslashes($checkMonitor), $import_periph);
}
if ($id === false) {
// Clean monitor object
$m->reset();
$mon["manufacturers_id"] = Dropdown::importExternal('Manufacturer', $line["MANUFACTURER"]);
if ($cfg_ocs["import_monitor_comment"]) {
$mon["comment"] = $line["DESCRIPTION"];
}
$id_monitor = 0;
if ($cfg_ocs["import_monitor"] == 1) {
//.........这里部分代码省略.........