break; case 10: showNotesForm($_POST['target'], 'Computer', $_POST["id"]); break; case 11: Reservation::showForItem('Computer', $_POST["id"]); break; case 12: Log::showForItem($computer); break; case 13: OcsLink::showForItem($computer); OcsServer::editLock($_POST['target'], $_POST["id"]); break; case 14: RegistryKey::showForComputer($_POST["id"]); break; case 20: ComputerDisk::showForComputer($computer); break; case 21: ComputerVirtualMachine::showForVirtualMachine($computer); ComputerVirtualMachine::showForComputer($computer); break; default: if (!Plugin::displayAction($computer, $_REQUEST['glpi_tab'])) { Computer_Device::showForComputer($computer); } } } }
static function deleteRegistryKeys($computers_id) { $key = new RegistryKey(); $key->deleteByCriteria(array('computers_id' => $computers_id)); }
/** * Update config of the registry * * This function erase old data and import the new ones about registry (Microsoft OS after Windows 95) * * @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 * * @return Nothing (void). **/ static function updateRegistry($computers_id, $ocsid, $ocsservers_id, $cfg_ocs) { global $DB, $DBocs; self::checkOCSconnection($ocsservers_id); if ($cfg_ocs["import_registry"]) { //before update, delete all entries about $computers_id $query_delete = "DELETE\n FROM `glpi_registrykeys`\n WHERE `computers_id` = '{$computers_id}'"; $DB->query($query_delete); //Get data from OCS database $query = "SELECT `registry`.`NAME` AS name,\n `registry`.`REGVALUE` AS regvalue,\n `registry`.`HARDWARE_ID` AS computers_id,\n `regconfig`.`REGTREE` AS regtree,\n `regconfig`.`REGKEY` AS regkey\n FROM `registry`\n LEFT JOIN `regconfig` ON (`registry`.`NAME` = `regconfig`.`NAME`)\n WHERE `HARDWARE_ID` = '{$ocsid}'"; $result = $DBocs->query($query); if ($DBocs->numrows($result) > 0) { $reg = new RegistryKey(); //update data while ($data = $DBocs->fetch_array($result)) { $data = clean_cross_side_scripting_deep(addslashes_deep($data)); $input = array(); $input["computers_id"] = $computers_id; $input["hive"] = $data["regtree"]; $input["value"] = $data["regvalue"]; $input["path"] = $data["regkey"]; $input["ocs_name"] = $data["name"]; $isNewReg = $reg->add($input, array('disable_unicity_check' => true)); unset($reg->fields); } } } return; }