function showForm($target, $ID = '') { global $DB, $CFG_GLPI, $LANG; PluginFusioninventoryAuth::checkRight("snmp_authentification", "r"); if ($ID != '') { $this->getFromDB($ID); } else { $this->getEmpty(); } $this->showTabs($ID, "", $_SESSION['glpi_tab']); echo "<div align='center'><form method='post' name='' id='' action=\"" . $target . "\">"; echo "<table class='tab_cadre' cellpadding='5' width='950'><tr><th colspan='2'>"; echo $ID == '' ? $LANG['plugin_fusioninventory']["model_info"][7] : $LANG['plugin_fusioninventory']["model_info"][3]; echo " :</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG["common"][16] . "</td>"; echo "<td align='center'>"; echo "<input type='text' name='name' value='" . $this->fields["name"] . "'/>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["model_info"][2] . "</td>"; echo "<td align='center'>"; Dropdown::show("PluginFusioninventorySnmpversion", array('name' => "FK_snmp_version", 'value' => $this->fields["FK_snmp_version"], 'comments' => false)); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["snmpauth"][1] . "</td>"; echo "<td align='center'>"; echo "<input type='text' name='community' value='" . $this->fields["community"] . "'/>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["snmpauth"][2] . "</td>"; echo "<td align='center'>"; echo "<input type='text' name='sec_name' value='" . $this->fields["sec_name"] . "'/>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["snmpauth"][4] . "</td>"; echo "<td align='center'>"; Dropdown::show("PluginFusioninventorySnmpprotocolauth", array('name' => "auth_protocol", 'value' => $this->fields["auth_protocol"], 'comments' => false)); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["snmpauth"][5] . "</td>"; echo "<td align='center'>"; echo "<input type='text' name='auth_passphrase'\n value='" . $this->fields["auth_passphrase"] . "'/>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["snmpauth"][6] . "</td>"; echo "<td align='center'>"; Dropdown::show("PluginFusioninventorySnmpprotocolpriv", array('name' => "priv_protocol", 'value' => $this->fields["priv_protocol"], 'comments' => false)); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["snmpauth"][7] . "</td>"; echo "<td align='center'>"; echo "<input type='text' name='priv_passphrase'\n value='" . $this->fields["priv_passphrase"] . "'/>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_2'><td colspan='2'>"; if (PluginFusioninventory::haveRight("snmp_authentification", "w")) { if ($ID == '') { echo "<div align='center'><input type='submit' name='add'\n value=\"" . $LANG["buttons"][8] . "\" class='submit' >"; } else { echo "<input type='hidden' name='ID' value='" . $ID . "'/>"; echo "<div align='center'><input type='submit' name='update'\n value=\"" . $LANG["buttons"][7] . "\" class='submit' >"; if (!$this->fields["deleted"]) { echo " \n <input type='submit' name='delete'\n value=\"" . $LANG["buttons"][6] . "\" class='submit'>"; } else { echo " \n <input type='submit' name='restore'\n value=\"" . $LANG["buttons"][21] . "\" class='submit'>"; echo " \n <input type='submit' name='purge'\n value=\"" . $LANG["buttons"][22] . "\" class='submit'>"; } } } echo "</td>"; echo "</tr>"; echo "</table></form></div>"; }
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: DURIEUX David // Purpose of file: // ---------------------------------------------------------------------- //Options for GLPI 0.71 and newer : need slave db to access the report $USEDBREPLICATE = 1; $DBCONNECTION_REQUIRED = 0; $NEEDED_ITEMS = array("search", "computer", "networking"); define('GLPI_ROOT', '../../..'); include GLPI_ROOT . "/inc/includes.php"; PluginFusioninventoryAuth::checkRight("reports", "r"); commonHeader($LANG['plugin_fusioninventory']["title"][0], $_SERVER['PHP_SELF'], "utils", "report"); if (isset($_GET["reset_search"])) { resetSearch(); } if (!isset($_GET["start"])) { $_GET["start"] = 0; } $_GET = getValues($_GET, $_POST); displaySearchForm(); manageGetValuesInSearch(PLUGIN_FUSIONINVENTORY_SNMP_NETWORKING_PORTS2); if (isset($_POST["dropdown_calendar"]) && isset($_POST["dropdown_sup_inf"])) { $_GET["field"][0] = 3; $_GET["contains"][0] = getContainsArray($_POST); $_GET["field"][1] = 2; $_GET["contains"][1] = $_POST['location'];
function showForm($target, $ID = '') { global $DB, $CFG_GLPI, $LANG; PluginFusioninventoryAuth::checkRight("snmp_models", "r"); if ($ID != '') { $this->getFromDB($ID); } else { $this->getEmpty(); } $this->showTabs($ID, "", $_SESSION['glpi_tab']); echo "<div align='center'><form method='post' name='' id='' action=\"" . $target . "\">"; echo "<table class='tab_cadre' cellpadding='5' width='950'><tr><th colspan='2'>"; echo $ID == '' ? $LANG['plugin_fusioninventory']["model_info"][7] : $LANG['plugin_fusioninventory']["model_info"][6]; echo " :</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG["common"][16] . "</td>"; echo "<td align='center'>"; echo "<input type='text' name='name' value='" . $this->fields["name"] . "' size='35'/>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG["common"][17] . "</td>"; echo "<td align='center'>"; $selected_value = $this->fields["device_type"]; echo "<select name='device_type'>\n"; if ($selected_value == "0") { $selected = 'selected'; } else { $selected = ''; } echo "<option value='0' " . $selected . ">-----</option>\n"; if ($selected_value == COMPUTER_TYPE) { $selected = 'selected'; } else { $selected = ''; } echo "<option value='" . COMPUTER_TYPE . "' " . $selected . ">" . $LANG["Menu"][0] . "</option>\n"; if ($selected_value == NETWORKING_TYPE) { $selected = 'selected'; } else { $selected = ''; } echo "<option value='" . NETWORKING_TYPE . "' " . $selected . ">" . $LANG["Menu"][1] . "</option>\n"; if ($selected_value == PRINTER_TYPE) { $selected = 'selected'; } else { $selected = ''; } echo "<option value='" . PRINTER_TYPE . "' " . $selected . ">" . $LANG["Menu"][2] . "</option>\n"; if ($selected_value == PERIPHERAL_TYPE) { $selected = 'selected'; } else { $selected = ''; } echo "<option value='" . PERIPHERAL_TYPE . "' " . $selected . ">" . $LANG["Menu"][16] . "</option>\n"; if ($selected_value == PHONE_TYPE) { $selected = 'selected'; } else { $selected = ''; } echo "<option value='" . PHONE_TYPE . "' " . $selected . ">" . $LANG["Menu"][34] . "</option>\n"; echo "</select>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_2'><td colspan='2'>"; if (PluginFusioninventory::haveRight("snmp_models", "w")) { if ($ID == '') { echo "<div align='center'><input type='submit' name='add' value=\"" . $LANG["buttons"][8] . "\" class='submit' >"; } else { echo "<input type='hidden' name='ID' value='" . $ID . "'/>"; echo "<div align='center'><input type='submit' name='update' value=\"" . $LANG["buttons"][7] . "\" class='submit' >"; if (!$this->fields["deleted"]) { echo " <input type='submit' name='delete' value=\"" . $LANG["buttons"][6] . "\" class='submit'>"; } else { echo " <input type='submit' name='restore' value=\"" . $LANG["buttons"][21] . "\" class='submit'>"; echo " <input type='submit' name='purge' value=\"" . $LANG["buttons"][22] . "\" class='submit'>"; } } } echo "</td>"; echo "</tr>"; echo "</table></form></div>"; }
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: // ---------------------------------------------------------------------- define('GLPI_ROOT', '../../..'); include GLPI_ROOT . "/inc/includes.php"; checkRight("printer", "r"); PluginFusioninventoryAuth::checkRight("snmp_printers", "r"); $printer_history = new PluginFusioninventoryPrintersHistory(); if (isset($_POST['delete'])) { PluginFusioninventoryAuth::checkRight("snmp_printers", "w"); if (isset($_POST['limit'])) { for ($i = 0; $i < $_POST['limit']; $i++) { if (isset($_POST["checked_{$i}"]) && $_POST["checked_{$i}"] == 1) { if (isset($_POST["ID_{$i}"])) { $input['ID'] = $_POST["ID_{$i}"]; } $printer_history->delete($input); } } } } glpi_header($_SERVER['HTTP_REFERER']);
function showForm($target, $ID = '') { global $DB, $CFG_GLPI, $LANG; PluginFusioninventoryAuth::checkRight("snmp_networking", "r"); $CommonItem = new CommonItem(); if ($ID != '') { $this->getFromDB($ID); } else { $this->getEmpty(); } echo "<div align='center'><form method='post' name='' id='' action=\"" . $target . "\">"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='4'>"; echo $LANG['plugin_fusioninventory']["menu"][4] . " ( " . $LANG['plugin_fusioninventory']["unknown"][3] . " "; $CommonItem->getFromDB(PLUGIN_FUSIONINVENTORY_SNMP_AGENTS, $this->fields["FK_agent"]); echo $CommonItem->getLink(1); echo ") :</th></tr>"; $datestring = $LANG["common"][26] . ": "; $date = convDateTime($this->fields["date_mod"]); echo "<tr>"; echo "<th align='center' width='450' colspan='2'>"; echo $LANG["common"][2] . " " . $this->fields["ID"]; echo "</th>"; echo "<th align='center' colspan='2' width='50'>"; echo $datestring . $date; echo "</th>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG["common"][16] . " :</td>"; echo "<td align='center'>"; echo "<input type='text' name='name' value='" . $this->fields["name"] . "' size='35'/>"; echo "</td>"; if (isMultiEntitiesMode()) { echo "<td align='center'>" . $LANG['entity'][0] . " : </td>"; echo "</td>"; echo "<td align='center'>"; Dropdown::show("Entity", array('name' => 'FK_entities', 'value' => $this->fields["FK_entities"])); echo "</td>"; echo "</tr>"; echo "</tr>"; } else { echo "<td align='center'></td>"; echo "</td>"; echo "<td align='center'></td>"; echo "</tr>"; echo "</tr>"; } echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["unknown"][0] . " :</td>"; echo "<td align='center'>"; echo "<input type='text' name='dnsname' value='" . $this->fields["dnsname"] . "' size='35'/>"; echo "</td>"; echo "<td align='center'>" . $LANG['common'][18] . " : </td>"; echo "</td>"; echo "<td align='center'>"; echo "<input type='text' name='contact' value='" . $this->fields["contact"] . "' size='35'/>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['common'][17] . " :</td>"; echo "<td align='center'>"; $type_list[] = COMPUTER_TYPE; $type_list[] = NETWORKING_TYPE; $type_list[] = PRINTER_TYPE; $type_list[] = PERIPHERAL_TYPE; $type_list[] = PHONE_TYPE; // GENERIC OBJECT : Search types in generic object $plugin = new Plugin(); if ($plugin->isActivated('genericobject')) { if (TableExists("glpi_plugin_genericobject_types")) { $query = "SELECT * FROM `glpi_plugin_genericobject_types`\n WHERE `status`='1' "; if ($result = $DB->query($query)) { while ($data = $DB->fetch_array($result)) { $type_list[] = $data['device_type']; } } } } // END GENERIC OBJECT Device::dropdownTypes('type', $this->fields["type"], $type_list); echo "</td>"; echo "<td align='center'>" . $LANG['setup'][89] . " : </td>"; echo "</td>"; echo "<td align='center'>"; Dropdown::show("Domain", array('name' => "domain", 'value' => $this->fields["domain"])); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['common'][15] . " :</td>"; echo "<td align='center'>"; Dropdown::show("Location", array('name' => "location", 'value' => $this->fields["location"])); echo "</td>"; echo "<td align='center'>" . $LANG['common'][19] . " : </td>"; echo "</td>"; echo "<td align='center'>"; echo "<input type='text' name='serial' value='" . $this->fields["serial"] . "' size='35'/>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["unknown"][2] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo("accepted", $this->fields["accepted"]); echo "</td>"; echo "<td align='center'>" . $LANG['common'][20] . " : </td>"; echo "</td>"; echo "<td align='center'>"; echo "<input type='text' name='otherserial' value='" . $this->fields["otherserial"] . "' size='35'/>"; echo "</td>"; echo "</tr>"; if (!empty($this->fields["ifaddr"]) or !empty($this->fields["ifmac"])) { echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['networking'][14] . " :</td>"; echo "<td align='center'>"; echo "<input type='text' name='otherserial' value='" . $this->fields["ifaddr"] . "' size='35'/>"; echo "</td>"; echo "<td align='center'>" . $LANG['networking'][15] . " : </td>"; echo "</td>"; echo "<td align='center'>"; echo "<input type='text' name='otherserial' value='" . $this->fields["ifmac"] . "' size='35'/>"; echo "</td>"; echo "</tr>"; } echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["functionalities"][3] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo("snmp", $this->fields["snmp"]); echo "</td>"; if ($this->fields["snmp"] == "1") { echo "<td align='center'>" . $LANG['plugin_fusioninventory']["model_info"][4] . " : </td>"; echo "</td>"; echo "<td align='center'>"; Dropdown::show("PluginFusioninventoryModelInfos", array('name' => "FK_model_infos", 'value' => $this->fields["FK_model_infos"])); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["model_info"][3] . " :</td>"; echo "<td align='center'>"; Dropdown::show("PluginFusioninventorySnmpauth", array('name' => "FK_snmp_connection", 'value' => $this->fields["FK_snmp_connection"])); echo "</td>"; } echo "<td align='center'>" . $LANG['common'][25] . " : </td>"; echo "</td>"; echo "<td align='middle'>"; echo "<textarea cols='50' rows='5' name='comments' >" . $this->fields["comments"] . "</textarea>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["unknown"][4] . " :</td>"; echo "<td align='center'>"; echo Dropdown::getYesNo($this->fields["hub"]); echo "</td>"; echo "<td align='center' colspan='2'></td>"; echo "</tr>"; echo "<tr>"; echo "<td class='tab_bg_2' align='center' colspan='4'>\n"; echo "<table width='100%'>"; echo "<tr>"; echo "<td width='33%' align='center'>"; echo "<input type='hidden' name='ID' value={$ID}>"; echo "<input type='submit' name='import' value=\"" . $LANG['buttons'][37] . "\" class='submit'>"; echo "</td>"; echo "<td width='33%' align='center'>"; echo "<input type='hidden' name='ID' value={$ID}>"; echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\" class='submit'>"; echo "</td>"; echo "<td width='33%' align='center'>"; echo "<input type='hidden' name='ID' value={$ID}>"; echo "<div class='center'>"; if (PluginFusioninventory::haveRight("unknowndevices", "w")) { if (!$this->fields["deleted"]) { echo "<input type='submit' name='delete' value=\"" . $LANG['buttons'][6] . "\" class='submit'>"; } else { echo "<input type='submit' name='restore' value=\"" . $LANG['buttons'][21] . "\" class='submit'>"; echo " <input type='submit' name='purge' value=\"" . $LANG['buttons'][22] . "\" class='submit'>"; } } echo "</div>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</td>"; echo "</tr>"; echo "</table></form></div>"; }
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: // ---------------------------------------------------------------------- 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);
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']);
} $agents->add($_POST); glpi_header($_SERVER['HTTP_REFERER']); } else { if (isset($_POST["update"])) { PluginFusioninventoryAuth::checkRight("agents", "w"); if (isset($_POST['on_device'])) { if ($_POST['on_device'] != "0" and $_POST['on_device'] != "") { $_POST['device_type'] = '1'; } } $agents->update($_POST); glpi_header($_SERVER['HTTP_REFERER']); } else { if (isset($_POST["delete"])) { PluginFusioninventoryAuth::checkRight("agents", "w"); $agents->delete($_POST); glpi_header("agents.php"); } else { if (isset($_POST["startagent"])) { $pta = new PluginFusioninventoryAgents(); $pta->RemoteStartAgent($_POST['agentID'], $_POST['ip']); glpi_header($_SERVER['HTTP_REFERER']); } } } } $ID = ""; if (isset($_GET["ID"])) { $ID = $_GET["ID"]; } else {
GLPI is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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: // ---------------------------------------------------------------------- if (!defined('GLPI_ROOT')) { define('GLPI_ROOT', '../../..'); } $NEEDED_ITEMS = array("fusioninventory", "search"); include GLPI_ROOT . "/inc/includes.php"; commonHeader($LANG['plugin_fusioninventory']["title"][0], $_SERVER["PHP_SELF"], "plugins", "fusioninventory", "rangeip"); PluginFusioninventoryAuth::checkRight("rangeip", "r"); PluginFusioninventoryDisplay::mini_menu(); manageGetValuesInSearch(PLUGIN_FUSIONINVENTORY_SNMP_RANGEIP); $_GET['target'] = "rangeip.php"; searchForm(PLUGIN_FUSIONINVENTORY_SNMP_RANGEIP, $_GET); showList(PLUGIN_FUSIONINVENTORY_SNMP_RANGEIP, $_GET); commonFooter();
function import($file, $message = 1, $installation = 0) { global $DB, $LANG; if ($installation != 1) { PluginFusioninventoryAuth::checkRight("snmp_models", "w"); } $xml = simplexml_load_file($file); // Verify same model exist $query = "SELECT ID\n FROM `glpi_plugin_fusioninventory_model_infos`\n WHERE `name`='" . $xml->name[0] . "';"; $result = $DB->query($query); if ($DB->numrows($result) > 0) { if ($message == '1') { $_SESSION["MESSAGE_AFTER_REDIRECT"] = $LANG['plugin_fusioninventory']["model_info"][8]; } return false; } else { $query = "INSERT INTO `glpi_plugin_fusioninventory_model_infos`\n (`name`,`device_type`,`discovery_key`)\n VALUES('" . $xml->name[0] . "','" . $xml->type[0] . "','" . $xml->key[0] . "');"; $DB->query($query); $FK_model = $DB->insert_id(); $i = -1; foreach ($xml->oidlist[0] as $num) { $i++; $j = 0; foreach ($xml->oidlist->oidobject[$i] as $item) { $j++; switch ($j) { case 1: $FK_mib_object = Dropdown::importExternal("PluginFusioninventoryMib_Object", $item); break; case 2: $FK_mib_oid = Dropdown::importExternal("PluginFusioninventoryMib_Oid", $item); break; case 3: $oid_port_counter = $item; break; case 4: $oid_port_dyn = $item; break; case 5: $mapping_type = $item; break; case 6: $mapping_name = $item; break; case 7: $vlan = $item; break; case 8: $activation = $item; break; } } $query = "INSERT INTO `glpi_plugin_fusioninventory_mib`\n (`FK_model_infos`,`FK_mib_oid`,`FK_mib_object`,`oid_port_counter`,\n `oid_port_dyn`,`mapping_type`,`mapping_name`,`vlan`,`activation`)\n VALUES('" . $FK_model . "','" . $FK_mib_oid . "','" . $FK_mib_object . "',\n '" . $oid_port_counter . "', '" . $oid_port_dyn . "', '" . $mapping_type . "',\n '" . $mapping_name . "', '" . $vlan . "', '" . $activation . "');"; $DB->query($query); } if ($message == '1') { $_SESSION["MESSAGE_AFTER_REDIRECT"] = $LANG['plugin_fusioninventory']["model_info"][9] . " : <a href='models.form.php?ID=" . $FK_model . "'>" . $xml->name[0] . "</a>"; } } }
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: // ---------------------------------------------------------------------- if (!defined('GLPI_ROOT')) { define('GLPI_ROOT', '../../..'); } $NEEDED_ITEMS = array("fusioninventory", "search"); include GLPI_ROOT . "/inc/includes.php"; commonHeader($LANG['plugin_fusioninventory']["title"][0], $_SERVER["PHP_SELF"], "plugins", "fusioninventory"); PluginFusioninventoryAuth::checkRight("agentsprocesses", "r"); $modif = 0; if (empty($_GET)) { $modif = 1; } PluginFusioninventoryDisplay::mini_menu(); $ptap = new PluginFusioninventoryAgentsProcesses(); $pfiae = new PluginFusioninventoryAgentsErrors(); $ptap->CleanProcesses(); $pfiae->CleanErrors(); $a_tab = array(); if (isset($_GET['process_number'])) { $_SESSION['glpi_tab'] = 3; $a_tab['process_number'] = $_GET['process_number']; } if (isset($_GET['h_process_number'])) {
function deleteMib($item_coche) { global $DB; PluginFusioninventoryAuth::checkRight("snmp_models", "w"); for ($i = 0; $i < count($item_coche); $i++) { $this->deleteFromDB($item_coche[$i], 1); } }
$importexport->importMass(); glpi_header($_SERVER['HTTP_REFERER']); } } } } } } if (isset($_POST["add_oid"])) { PluginFusioninventoryAuth::checkRight("snmp_models", "w"); $plugin_fusioninventory_mib_networking->add($_POST); glpi_header($_SERVER['HTTP_REFERER']); } if (PluginFusioninventory::HaveRight("snmp_models", "r")) { $importexport->showForm($_SERVER["PHP_SELF"]); $importexport->showFormMassImport($_SERVER["PHP_SELF"]); } $ID = ""; if (isset($_GET["ID"])) { $ID = $_GET["ID"]; } if (!empty($_POST["item_coche"])) { PluginFusioninventoryAuth::checkRight("snmp_models", "w"); $plugin_fusioninventory_mib_networking->deleteMib($_POST["item_coche"]); glpi_header($_SERVER['HTTP_REFERER']); } if (PluginFusioninventory::HaveRight("snmp_models", "r")) { $plugin_fusioninventory_model_infos->showForm($_SERVER["PHP_SELF"], $ID); $plugin_fusioninventory_mib_networking->showForm($_SERVER["PHP_SELF"], $ID); } commonFooter();
function showFormPrinter($target, $ID) { global $DB, $CFG_GLPI, $LANG, $FUSIONINVENTORY_MAPPING; PluginFusioninventoryAuth::checkRight("snmp_printers", "r"); include GLPI_ROOT . "/plugins/fusioninventory/inc_constants/snmp.mapping.constant.php"; $this->ID = $ID; $plugin_fusioninventory_printers = new PluginFusioninventoryPrinters(); // $config_snmp_printer = new PluginFusioninventoryConfigSNMPPrinter; $plugin_fusioninventory_snmp = new PluginFusioninventorySNMP(); $query = "SELECT * \n FROM `glpi_plugin_fusioninventory_printers`\n WHERE `FK_printers`=" . $ID . " "; $result = $DB->query($query); $data = $DB->fetch_assoc($result); // Add in database if not exist if ($DB->numrows($result) == "0") { $query_add = "INSERT INTO `glpi_plugin_fusioninventory_printers` (`FK_printers`)\n VALUES('" . $ID . "') "; $DB->query($query_add); } // Form printer informations // echo "<br>"; echo "<div align='center'><form method='post' name='snmp_form' id='snmp_form'\n action=\"" . $target . "\">"; echo "<table class='tab_cadre' cellpadding='5' width='950'>"; echo "<tr class='tab_bg_1'>"; echo "<th colspan='3'>"; echo $LANG['plugin_fusioninventory']["snmp"][11]; echo "</th>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["model_info"][4] . "</td>"; echo "<td align='center'>"; $query_models = "SELECT * \n FROM `glpi_plugin_fusioninventory_model_infos`\n WHERE `device_type`!=3\n AND `device_type`!=0"; $result_models = $DB->query($query_models); $exclude_models = array(); while ($data_models = $DB->fetch_array($result_models)) { $exclude_models[] = $data_models['ID']; } Dropdown::show("PluginFusioninventoryModelInfos", array('name' => "FK_model_infos", 'value' => $data["FK_model_infos"], 'comments' => false, 'used' => $exclude_models)); echo "</td>"; echo "<td align='center'>"; echo " <input type='submit' name='GetRightModel' value='" . $LANG['plugin_fusioninventory']["model_info"][13] . "' class='submit'/></td>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["functionalities"][43] . "</td>"; echo "<td align='center'>"; PluginFusioninventorySNMP::auth_dropdown($data["FK_snmp_connection"]); echo "</td>"; echo "<td>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center' colspan='2' height='30'>"; echo $LANG['plugin_fusioninventory']["snmp"][52] . ": " . convDateTime($data["last_fusioninventory_update"]); echo "</td>"; echo "<td>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='3'>"; echo "<div align='center'>"; echo "<input type='hidden' name='ID' value='" . $ID . "'>"; echo "<input type='submit' name='update' value=\"" . $LANG["buttons"][7] . "\" class='submit' >"; echo "</td>"; echo "</tr>"; echo "</table></form>"; echo "</div>"; // Remote action of agent $pfit = new PluginFusioninventoryTask(); $pfit->RemoteStateAgent($target, $ID, PRINTER_TYPE, array('INVENTORY' => 1)); // ** FORM FOR CARTRIDGES // get infos to get visible or not the counters $snmp_model_ID = $plugin_fusioninventory_snmp->GetSNMPModel($ID, PRINTER_TYPE); // ** Get link OID fields $Array_Object_TypeNameConstant = $plugin_fusioninventory_snmp->GetLinkOidToFields($ID, PRINTER_TYPE); $mapping_name = array(); foreach ($Array_Object_TypeNameConstant as $object => $mapping_type_name) { if (strstr($mapping_type_name, "cartridge") or strstr($mapping_type_name, "toner")) { switch ($mapping_type_name) { case "cartridgeblack": $mapping_name[$mapping_type_name] = "1"; break; case "cartridgeblackphoto": $mapping_name[$mapping_type_name] = "2"; break; case "tonerblack": $mapping_name[$mapping_type_name] = "3"; break; case "tonerblack2": $mapping_name[$mapping_type_name] = "4"; break; case "cartridgecyan": $mapping_name[$mapping_type_name] = "5"; break; case "cartridgecyanlight": $mapping_name[$mapping_type_name] = "6"; break; case "tonercyan": $mapping_name[$mapping_type_name] = "7"; break; case "cartridgemagenta": $mapping_name[$mapping_type_name] = "8"; break; case "cartridgemagentalight": $mapping_name[$mapping_type_name] = "9"; break; case "tonermagenta": $mapping_name[$mapping_type_name] = "10"; break; case "cartridgeyellow": $mapping_name[$mapping_type_name] = "11"; break; case "toneryellow": $mapping_name[$mapping_type_name] = "12"; break; case "drumblack": $mapping_name[$mapping_type_name] = "13"; break; case "drumcyan": $mapping_name[$mapping_type_name] = "14"; break; case "drummagenta": $mapping_name[$mapping_type_name] = "15"; break; case "drumyellow": $mapping_name[$mapping_type_name] = "16"; break; case "wastetoner": $mapping_name[$mapping_type_name] = "17"; break; case "maintenancekit": $mapping_name[$mapping_type_name] = "18"; break; default: $mapping_name[$mapping_type_name] = "19"; } } } echo "<div align='center'><form method='post' name='snmp_form' id='snmp_form'\n action=\"" . $target . "\">"; echo "<table class='tab_cadre' cellpadding='5' width='950'>"; echo "<tr class='tab_bg_1'>"; echo "<th align='center' colspan='3'>"; echo $LANG["cartridges"][16]; echo "</th>"; echo "</tr>"; asort($mapping_name); foreach ($mapping_name as $cartridge_name => $val) { $state = $plugin_fusioninventory_printers->cartridges_state($ID, $cartridge_name); echo "<tr class='tab_bg_1'>"; echo "<td align='center'>"; echo $FUSIONINVENTORY_MAPPING[PRINTER_TYPE][$cartridge_name]['shortname']; echo " : "; echo "</td>"; echo "<td align='center'>"; // if ($config_snmp_printer->getValue('manage_cartridges') == "1") { // echo "<form method='post' name='snmp_form' id='snmp_form' action=\"".$target."\">"; // dropdownValue("glpi_cartridges_type","FK_cartridges",$state['FK_cartridges'],0); // echo "<input type='hidden' name='ID' value='".$ID."' />"; // echo "<input type='hidden' name='object_name' value='".$cartridge_name."' />"; // echo "<input name='update_cartridges' value='update_cartridges' src='".GLPI_ROOT. // "/pics/actualiser.png' class='calendrier' type='image'>"; // echo "</form>"; // } echo "</td>"; echo "<td align='center'>"; PluginFusioninventoryDisplay::bar($state['state']); echo "</td>"; echo "</tr>"; } echo "</table></form>"; echo "</div>"; }
the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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: // ---------------------------------------------------------------------- if (!defined('GLPI_ROOT')) { define('GLPI_ROOT', '../../..'); } $NEEDED_ITEMS = array("fusioninventory"); include GLPI_ROOT . "/inc/includes.php"; PluginFusioninventoryAuth::checkRight("snmp_agent", "r"); $agents = new PluginFusioninventoryAgents(); header("Expires: 0"); header("Cache-control: private"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Description: File Transfer"); header('Content-type: application/xml; charset="utf-8"', true); header("Content-disposition: attachment; filename=fusioninventory_agent.conf"); echo $agents->export_config($_GET["agent"]); //commonFooter();