function getSoftware($deviceid) { $PluginSccmSccmdb = new PluginSccmSccmdb(); $PluginSccmSccmdb->connect(); $query = "SELECT ArPd.DisplayName00 as \"ArPd-DisplayName\",\n ArPd.InstallDate00 as \"ArPd-InstallDate\",\n ArPd.Version00 as \"ArPd-Version\",\n ArPd.Publisher00 as \"ArPd-Publisher\"\n FROM Add_Remove_Programs_DATA ArPd\n INNER JOIN v_R_System VrS on VrS.ResourceID=ArPd.MachineID\n WHERE ArPd.MachineID = '" . $deviceid . "'"; $datas = array(); $result = $PluginSccmSccmdb->exec_query($query); while ($data = mssql_fetch_array($result, MSSQL_ASSOC)) { foreach ($data as $key => $value) { $data[$key] = utf8_encode($this->cleanValue($value)); } $datas[] = $data; } $PluginSccmSccmdb->disconnect(); return $datas; }
//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(); break; }
function getMedias($deviceid) { $PluginSccmSccmdb = new PluginSccmSccmdb(); $PluginSccmSccmdb->connect(); $query = "\n SELECT distinct\n Description0 as \"Med-Description\",\n Manufacturer0 as \"Med-Manufacturer\",\n Caption0 as \"Med-Model\",\n Name0 as \"Med-Name\",\n SCSITargetID0 as \"Med-SCSITargetId\",\n MediaType0 as \"Med-Type\"\n FROM v_GS_CDROM\n WHERE ResourceID = '" . $deviceid . "'"; $datas = array(); $result = $PluginSccmSccmdb->exec_query($query); $data = array(); if (function_exists('sqlsrv_fetch_array')) { $data = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC); } elseif (function_exists('mssql_fetch_array')) { $data = mssql_fetch_array($result, MSSQL_ASSOC); } while ($data) { foreach ($data as $key => $value) { $data[$key] = utf8_encode($this->cleanValue($value)); } $datas[] = $data; } $PluginSccmSccmdb->disconnect(); return $datas; }