Beispiel #1
0
function plugin_sccm_uninstall()
{
    global $DB;
    if (is_dir(GLPI_PLUGIN_DOC_DIR . '/sccm')) {
        rrmdir(GLPI_PLUGIN_DOC_DIR . '/sccm');
    }
    require 'inc/config.class.php';
    require 'inc/sccm.class.php';
    return PluginSccmConfig::uninstall();
    return PluginSccmSccm::uninstall();
    return true;
}
Beispiel #2
0
 function setDrives()
 {
     $PluginSccmSccm = new PluginSccmSccm();
     $CONTENT = $this->sxml->CONTENT[0];
     $i = 0;
     foreach ($PluginSccmSccm->getDatas('drives', $this->device_id) as $value) {
         $CONTENT->addChild('DRIVES');
         $DRIVES = $this->sxml->CONTENT[0]->DRIVES[$i];
         $DRIVES->addChild('DESCRIPTION', $value['Description00']);
         //$DRIVES->addChild('FILESYSTEM'    ,$value['attr_14807']);
         //$DRIVES->addChild('FREE'       ,$value['attr_14805']);
         $DRIVES->addChild('LABEL', $value['Caption00']);
         //$DRIVES->addChild('LETTER'        ,$value['name']);
         $DRIVES->addChild('TYPE', $value['InterfaceType00']);
         $DRIVES->addChild('TOTAL', $value['Size00']);
         $i++;
     }
 }
Beispiel #3
0
if (isset($argv)) {
    for ($i = 1; $i < count($argv); $i++) {
        //To be able to use = in search filters, enter \= instead in command line
        //Replace the \= by ° not to match the split function
        $arg = str_replace('\\=', '°', $argv[$i]);
        $it = explode("=", $arg);
        $it[0] = preg_replace('/^--/', '', $it[0]);
        //Replace the ° by = the find the good filter
        $it = str_replace('°', '=', $it);
        $_GET[$it[0]] = $it[1];
    }
}
$REP_XML = GLPI_PLUGIN_DOC_DIR . '/sccm/xml/';
$PluginSccmConfig = new PluginSccmConfig();
$PluginSccmConfig->getFromDB(1);
$PluginSccmSccm = new PluginSccmSccm();
$PluginSccmSccmdb = new PluginSccmSccmdb();
$PluginSccmSccmdb->connect();
$action = isset($_GET['task']) ? $_GET['task'] : "home";
if (!in_array($action, array('home', 'test', 'showtable'))) {
    die('Erreur');
}
switch ($action) {
    case 'test':
        include 'test.php';
        break;
    case 'showtable':
        include 'showtable.php';
        break;
    case 'home':
        $PluginSccmSccm->showHome();
Beispiel #4
0
 static function executeSync()
 {
     $REP_XML = GLPI_PLUGIN_DOC_DIR . '/sccm/xml/';
     $PluginSccmConfig = new PluginSccmConfig();
     $PluginSccmConfig->getFromDB(1);
     $PluginSccmSccm = new PluginSccmSccm();
     if ($PluginSccmConfig->getField('active_sync') == 1) {
         Toolbox::logInFile('sccm', "Inject start \n", true);
         $PluginSccmSccm->getDevices();
         Toolbox::logInFile('sccm', "getDevices OK \n", true);
         Toolbox::logInFile('sccm', "Generate XML start : " . count($PluginSccmSccm->devices) . " files\n", true);
         foreach ($PluginSccmSccm->devices as $device_values) {
             $PluginSccmSccmxml = new PluginSccmSccmxml($device_values);
             $PluginSccmSccmxml->setAccessLog();
             $PluginSccmSccmxml->setAccountInfos();
             $PluginSccmSccmxml->setHardware();
             $PluginSccmSccmxml->setOS();
             $PluginSccmSccmxml->setBios();
             $PluginSccmSccmxml->setProcessors();
             $PluginSccmSccmxml->setSoftwares();
             $PluginSccmSccmxml->setUsers();
             $PluginSccmSccmxml->setNetworks();
             $PluginSccmSccmxml->setDrives();
             $SXML = $PluginSccmSccmxml->sxml;
             $SXML->asXML($REP_XML . $PluginSccmSccmxml->device_id . ".ocs");
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $PluginSccmConfig->getField('fusioninventory_url'));
             curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
             curl_setopt($ch, CURLOPT_HEADER, 0);
             curl_setopt($ch, CURLOPT_POST, 1);
             curl_setopt($ch, CURLOPT_POSTFIELDS, $SXML->asXML());
             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
             curl_setopt($ch, CURLOPT_REFERER, $PluginSccmConfig->getField('fusioninventory_url'));
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             $ch_result = curl_exec($ch);
             curl_close($ch);
             Toolbox::logInFile('sccm', "Ajout OK - " . $PluginSccmSccmxml->device_id . " \n", true);
         }
     } else {
         echo __("Synchronization is disabled by configuration.", "sccm");
     }
 }
Beispiel #5
0
 function setStorages()
 {
     $PluginSccmSccm = new PluginSccmSccm();
     $CONTENT = $this->sxml->CONTENT[0];
     $i = 0;
     foreach ($PluginSccmSccm->getStorages($this->device_id) as $value) {
         $CONTENT->addChild('STORAGES');
         $STORAGES = $this->sxml->CONTENT[0]->STORAGES[$i];
         $STORAGES->addChild('DESCRIPTION', $value['Sto-Description']);
         $STORAGES->addChild('DISKSIZE', $value['Sto-Size']);
         $STORAGES->addChild('INTERFACE', $value['Sto-Interface']);
         $STORAGES->addChild('MANUFACTURER', $value['Stro-Manufacturer']);
         $STORAGES->addChild('MODEL', $value['Sto-Model']);
         $STORAGES->addChild('NAME', $value['Sto-Name']);
         $STORAGES->addChild('SCSI_COID', $value['Sto-SCSITargetId']);
         $STORAGES->addChild('SCSI_LUN', 0);
         $STORAGES->addChild('SCSI_UNID', 0);
         $STORAGES->addChild('TYPE', $value['Sto-Type']);
         $i++;
     }
     foreach ($PluginSccmSccm->getMedias($this->device_id) as $value) {
         $CONTENT->addChild('STORAGES');
         $STORAGES = $this->sxml->CONTENT[0]->STORAGES[$i];
         $STORAGES->addChild('DESCRIPTION', $value['Med-Description']);
         $STORAGES->addChild('MANUFACTURER', $value['Med-Manufacturer']);
         $STORAGES->addChild('MODEL', $value['Med-Model']);
         $STORAGES->addChild('NAME', $value['Med-Name']);
         $STORAGES->addChild('SCSI_COID', $value['Med-SCSITargetId']);
         $STORAGES->addChild('SCSI_LUN', 0);
         $STORAGES->addChild('SCSI_UNID', 0);
         $STORAGES->addChild('TYPE', $value['Med-Type']);
         $i++;
     }
 }