function exportmodels()
 {
     global $DB;
     $pfiie = new PluginFusioninventoryImportExport();
     $query_models = "SELECT * FROM glpi_plugin_fusioninventory_model_infos";
     if ($result_models = $DB->query($query_models)) {
         while ($data = $DB->fetch_array($result_models)) {
             $xml = $pfiie->plugin_fusioninventory_export($data['ID']);
             file_put_contents(GLPI_PLUGIN_DOC_DIR . "/fusioninventory/models/" . $data['name'] . ".xml", $xml);
         }
     }
 }
  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";
//commonHeader($LANG['plugin_fusioninventory']["title"][0],$_SERVER["PHP_SELF"],"plugins","fusioninventory","models");
PluginFusioninventoryAuth::checkRight("snmp_models", "r");
$importexport = new PluginFusioninventoryImportExport();
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=export.xml");
echo $importexport->plugin_fusioninventory_export($_GET["model"]);
Ejemplo n.º 3
0
  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_models", "r");
$plugin_fusioninventory_model_infos = new PluginFusioninventoryModelInfos();
$plugin_fusioninventory_mib_networking = new PluginFusioninventoryMib();
$importexport = new PluginFusioninventoryImportExport();
commonHeader($LANG['plugin_fusioninventory']["title"][0], $_SERVER["PHP_SELF"], "plugins", "fusioninventory", "models");
PluginFusioninventoryDisplay::mini_menu();
//if (isset ($_POST["add"]) && isset($_POST["ID"])) {
if (isset($_POST["add"])) {
    PluginFusioninventoryAuth::checkRight("snmp_models", "w");
    $plugin_fusioninventory_model_infos->add($_POST);
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST["update"])) {
        PluginFusioninventoryAuth::checkRight("snmp_models", "w");
        $plugin_fusioninventory_model_infos->update($_POST);
        glpi_header($_SERVER['HTTP_REFERER']);
    } else {
        if (isset($_POST["delete"])) {
            PluginFusioninventoryAuth::checkRight("snmp_models", "w");
 /**
  * Import data
  *
  *@param $p_xml XML code to import
  *@param &$p_errors errors string to be alimented if import ko
  *@return true (import ok) / false (import ko)
  **/
 function import($p_xml, &$p_errors = '')
 {
     global $LANG;
     $this->addLog('Function import().');
     // TODO : gérer l'encodage, la version
     // Do not manage <REQUEST> element (always the same)
     $this->setXML($p_xml);
     $errors = '';
     if (isset($this->sxml->CONTENT->PROCESSNUMBER)) {
         $_SESSION['glpi_plugin_fusioninventory_processnumber'] = $this->sxml->CONTENT->PROCESSNUMBER;
     }
     switch ($this->sxml->QUERY) {
         case 'SNMPQUERY':
             $errors .= $this->importContent($this->sxml->CONTENT);
             break;
         case 'NETDISCOVERY':
             $pti = new PluginFusioninventoryImportExport();
             $errors .= $pti->import_netdiscovery($this->sxml->CONTENT, $this->sxml->DEVICEID);
             break;
         case 'INVENTORY':
             $this->sendInventoryToOcsServer($p_xml);
             break;
         case 'QUERY':
             break;
         default:
             $errors .= $LANG['plugin_fusioninventory']["errors"][22] . ' QUERY : *' . $this->sxml->QUERY . "*\n";
     }
     $result = true;
     if ($errors != '') {
         if (isset($_SESSION['glpi_plugin_fusioninventory_processnumber'])) {
             $result = true;
             $ptap = new PluginFusioninventoryAgentsProcesses();
             $ptap->updateProcess($_SESSION['glpi_plugin_fusioninventory_processnumber'], array('comments' => $errors));
         } else {
             // It's PROLOG
             $result = false;
         }
     }
     return $result;
 }