static function assign($id, $source_type, $source_field, $source_value) { global $DB; $plugin_fusioninventory_snmp = new PluginFusioninventorySNMP(); if ($source_field == "model") { // Get auth $snmp_auth = new PluginFusioninventorySnmpauth(); switch ($source_type) { case NETWORKING_TYPE: $FK_snmp_auth_DB = $snmp_auth->GetSNMPAuth($id, NETWORKING_TYPE); $plugin_fusioninventory_snmp->update_network_infos($id, $source_value, $FK_snmp_auth_DB); break; case PRINTER_TYPE: $FK_snmp_auth_DB = $snmp_auth->GetSNMPAuth($id, PRINTER_TYPE); $plugin_fusioninventory_snmp->update_printer_infos($id, $source_value, $FK_snmp_auth_DB); break; } } else { if ($source_field == "auth") { switch ($source_type) { case NETWORKING_TYPE: // Get model $FK_model_DB = $plugin_fusioninventory_snmp->GetSNMPModel($id, NETWORKING_TYPE); $plugin_fusioninventory_snmp->update_network_infos($id, $FK_model_DB, $source_value); break; case PRINTER_TYPE: // Get model $FK_model_DB = $plugin_fusioninventory_snmp->GetSNMPModel($id, PRINTER_TYPE); $plugin_fusioninventory_snmp->update_printer_infos($id, $FK_model_DB, $source_value); break; } } } }
static function auth_dropdown($selected = "") { global $DB; $plugin_fusioninventory_snmp_auth = new PluginFusioninventorySnmpauth(); $config = new PluginFusioninventoryConfig(); if ($config->getValue("authsnmp") == "file") { echo $plugin_fusioninventory_snmp_auth->selectbox($selected); } else { if ($config->getValue("authsnmp") == "DB") { Dropdown::show("PluginFusioninventorySnmpauth", array('name' => "FK_snmp_connection", 'value' => $selected, 'comments' => false)); } } }
*/ // Original Author of file: David DURIEUX // Purpose of file: // ---------------------------------------------------------------------- if (!defined('GLPI_ROOT')) { define('GLPI_ROOT', '../../..'); } $NEEDED_ITEMS = array("fusioninventory", "search", "setup", "rulesengine"); include GLPI_ROOT . "/inc/includes.php"; commonHeader($LANG['plugin_fusioninventory']["title"][0], $_SERVER["PHP_SELF"], "plugins", "fusioninventory", "snmp_auth"); PluginFusioninventoryAuth::checkRight("snmp_authentification", "r"); $config = new PluginFusioninventoryConfig(); PluginFusioninventoryDisplay::mini_menu(); // Forms for FILE if ($config->getValue("authsnmp") == "file") { $plugin_fusioninventory_snmp_auth = new PluginFusioninventorySnmpauth(); if (!isset($_GET["ID"])) { echo $plugin_fusioninventory_snmp_auth->plugin_fusioninventory_snmp_connections(); } } else { if ($config->getValue("authsnmp") == "DB") { // Forms for DB $_GET['target'] = "snmp_auth.php"; manageGetValuesInSearch(PLUGIN_FUSIONINVENTORY_SNMP_AUTH); searchForm(PLUGIN_FUSIONINVENTORY_SNMP_AUTH, $_GET); showList(PLUGIN_FUSIONINVENTORY_SNMP_AUTH, $_GET); } else { echo $LANG['plugin_fusioninventory']["functionalities"][19]; } } commonFooter();
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("setup", "rulesengine", "fusioninventory", "search"); define('GLPI_ROOT', '../../..'); include GLPI_ROOT . "/inc/includes.php"; PluginFusioninventoryAuth::checkRight("snmp_authentification", "r"); $plugin_fusioninventory_snmp_auth = new PluginFusioninventorySnmpauth(); $config = new PluginFusioninventoryConfig(); commonHeader($LANG['plugin_fusioninventory']["title"][0], $_SERVER["PHP_SELF"], "plugins", "fusioninventory", "snmp_auth"); PluginFusioninventoryDisplay::mini_menu(); if (isset($_POST["add"])) { PluginFusioninventoryAuth::checkRight("snmp_authentification", "w"); if ($config->getValue("authsnmp") == "file") { $new_ID = $plugin_fusioninventory_snmp_auth->add_xml(); } else { if ($config->getValue("authsnmp") == "DB") { $new_ID = $plugin_fusioninventory_snmp_auth->add($_POST); } } $_SESSION["MESSAGE_AFTER_REDIRECT"] = "Import effectué avec succès : <a href='snmp_auth.php?ID=" . $new_ID . "'>" . $_POST["name"] . "</a>"; glpi_header($_SERVER['HTTP_REFERER']); } else {
function plugin_fusioninventory_MassiveActionsFieldsDisplay($type, $table, $field, $linkfield) { global $LINK_ID_TABLE, $LANG; // Table fields //echo $table.".".$field."<br/>"; switch ($table . "." . $field) { case 'glpi_plugin_fusioninventory_snmpauths.name': Dropdown::show("PluginFusioninventorySnmpauth", array('name' => $linkfield)); return true; break; case 'glpi_plugin_fusioninventory_model_infos.name': Dropdown::show("PluginFusioninventoryModelInfos", array('name' => $linkfield, 'comments' => false)); return true; break; case 'glpi_plugin_fusioninventory_unknown_device.type': $type_list = array(); $type_list[] = COMPUTER_TYPE; $type_list[] = NETWORKING_TYPE; $type_list[] = PRINTER_TYPE; $type_list[] = PERIPHERAL_TYPE; $type_list[] = PHONE_TYPE; Device::dropdownTypes('type', $linkfield, $type_list); return true; break; case 'glpi_plugin_fusioninventory_agents.ID': Dropdown::show("PluginFusioninventoryAgents", array('name' => $linkfield, 'comments' => false)); return true; break; case 'glpi_plugin_fusioninventory_agents.nb_process_query': Dropdown::showInteger("nb_process_query", $linkfield, 1, 200); return true; break; case 'glpi_plugin_fusioninventory_agents.nb_process_discovery': Dropdown::showInteger("nb_process_discovery", $linkfield, 1, 400); return true; break; case 'glpi_plugin_fusioninventory_agents.logs': $ArrayValues[] = $LANG["choice"][0]; $ArrayValues[] = $LANG["choice"][1]; $ArrayValues[] = $LANG["setup"][137]; Dropdown::showFromArray('logs', $ArrayValues, array('value' => $linkfield)); return true; break; case 'glpi_plugin_fusioninventory_agents.core_discovery': Dropdown::showInteger("core_discovery", $linkfield, 1, 32); return true; break; case 'glpi_plugin_fusioninventory_agents.core_query': Dropdown::showInteger("core_query", $linkfield, 1, 32); return true; break; case 'glpi_plugin_fusioninventory_agents.threads_discovery': Dropdown::showInteger("threads_discovery", $linkfield, 1, 400); return true; break; case 'glpi_plugin_fusioninventory_agents.threads_query': Dropdown::showInteger("threads_query", $linkfield, 1, 400); return true; break; case 'glpi_plugin_fusioninventory_discovery.FK_snmp_connection': $plugin_fusioninventory_snmp = new PluginFusioninventorySnmpauth(); echo $plugin_fusioninventory_snmp->selectbox(); return true; break; case 'glpi_plugin_fusioninventory_model_infos.device_type': $type_list = array(); $type_list[] = COMPUTER_TYPE; $type_list[] = NETWORKING_TYPE; $type_list[] = PRINTER_TYPE; $type_list[] = PERIPHERAL_TYPE; $type_list[] = PHONE_TYPE; Device::dropdownTypes('type', $linkfield, $type_list); return true; break; } return false; }
/** * Add AUTHENTICATION string to XML node * *@param $p_sxml_node XML node to authenticate *@param $p_id Authenticate id *@return nothing **/ function addAuth($p_sxml_node, $p_id) { $ptsnmpa = new PluginFusioninventorySnmpauth(); $ptsnmpa->getFromDB($p_id); $sxml_authentication = $p_sxml_node->addChild('AUTHENTICATION'); $sxml_authentication->addAttribute('ID', $p_id); $sxml_authentication->addAttribute('COMMUNITY', $ptsnmpa->fields['community']); $sxml_authentication->addAttribute('VERSION', Dropdown::getDropdownName('glpi_plugin_fusioninventory_snmpversions', $ptsnmpa->fields['FK_snmp_version'])); $sxml_authentication->addAttribute('USERNAME', $ptsnmpa->fields['sec_name']); if ($ptsnmpa->fields['auth_protocol'] == '0') { $sxml_authentication->addAttribute('AUTHPROTOCOL', ''); } else { $sxml_authentication->addAttribute('AUTHPROTOCOL', Dropdown::getDropdownName('glpi_plugin_fusioninventory_snmpprotocolauths', $ptsnmpa->fields['auth_protocol'])); } $sxml_authentication->addAttribute('AUTHPASSPHRASE', $ptsnmpa->fields['auth_passphrase']); if ($ptsnmpa->fields['priv_protocol'] == '0') { $sxml_authentication->addAttribute('PRIVPROTOCOL', ''); } else { $sxml_authentication->addAttribute('PRIVPROTOCOL', Dropdown::getDropdownName('glpi_plugin_fusioninventory_snmpprotocolprivs', $ptsnmpa->fields['priv_protocol'])); } $sxml_authentication->addAttribute('PRIVPASSPHRASE', $ptsnmpa->fields['priv_passphrase']); }