function xml_hardware() { global $sysinfo; global $text; $strPcidevices = ""; $strIdedevices = ""; $strUsbdevices = ""; $strScsidevices = ""; $arrSys = $sysinfo->cpu_info(); $arrBuf = finddups($sysinfo->pci()); if (count($arrBuf)) { for ($i = 0, $max = sizeof($arrBuf); $i < $max; $i++) { if ($arrBuf[$i]) { $strPcidevices .= " <Device><Name>" . htmlspecialchars(chop($arrBuf[$i]), ENT_QUOTES) . "</Name></Device>\n"; } } } $arrBuf = $sysinfo->ide(); if (count($arrBuf)) { foreach ($arrBuf as $strKey => $arrValue) { $strIdedevices .= " <Device>\n<Name>" . htmlspecialchars($strKey . ': ' . $arrValue['model'], ENT_QUOTES) . "</Name>\n"; if (isset($arrValue['capacity'])) { $strIdedevices .= '<Capacity>' . htmlspecialchars($arrValue['capacity'], ENT_QUOTES) . '</Capacity>'; } $strIdedevices .= "</Device>\n"; } } $arrBuf = $sysinfo->scsi(); if (count($arrBuf)) { foreach ($arrBuf as $strKey => $arrValue) { $strScsidevices .= "<Device>\n"; if ($strKey >= '0' && $strKey <= '9') { $strScsidevices .= " <Name>" . htmlspecialchars($arrValue['model'], ENT_QUOTES) . "</Name>\n"; } else { $strScsidevices .= " <Name>" . htmlspecialchars($strKey . ': ' . $arrValue['model'], ENT_QUOTES) . "</Name>\n"; } if (isset($arrrValue['capacity'])) { $strScsidevices .= '<Capacity>' . htmlspecialchars($arrValue['capacity'], ENT_QUOTES) . '</Capacity>'; } $strScsidevices .= "</Device>\n"; } } $arrBuf = finddups($sysinfo->usb()); if (count($arrBuf)) { for ($i = 0, $max = sizeof($arrBuf); $i < $max; $i++) { if ($arrBuf[$i]) { $strUsbdevices .= " <Device><Name>" . htmlspecialchars(chop($arrBuf[$i]), ENT_QUOTES) . "</Name></Device>\n"; } } } $_text = " <Hardware>\n"; $_text .= " <CPU>\n"; if (isset($arrSys['cpus'])) { $_text .= " <Number>" . htmlspecialchars($arrSys['cpus'], ENT_QUOTES) . "</Number>\n"; } if (isset($arrSys['model'])) { $_text .= " <Model>" . htmlspecialchars($arrSys['model'], ENT_QUOTES) . "</Model>\n"; } if (isset($arrSys['temp'])) { $_text .= " <Cputemp>" . htmlspecialchars($arrSys['temp'], ENT_QUOTES) . "</Cputemp>\n"; } if (isset($arrSys['cpuspeed'])) { $_text .= " <Cpuspeed>" . htmlspecialchars($arrSys['cpuspeed'], ENT_QUOTES) . "</Cpuspeed>\n"; } if (isset($arrSys['busspeed'])) { $_text .= " <Busspeed>" . htmlspecialchars($arrSys['busspeed'], ENT_QUOTES) . "</Busspeed>\n"; } if (isset($arrSys['cache'])) { $_text .= " <Cache>" . htmlspecialchars($arrSys['cache'], ENT_QUOTES) . "</Cache>\n"; } if (isset($arrSys['bogomips'])) { $_text .= " <Bogomips>" . htmlspecialchars($arrSys['bogomips'], ENT_QUOTES) . "</Bogomips>\n"; } $_text .= " </CPU>\n"; $_text .= " <PCI>\n"; if ($strPcidevices) { $_text .= $strPcidevices; } $_text .= " </PCI>\n"; $_text .= " <IDE>\n"; if ($strIdedevices) { $_text .= $strIdedevices; } $_text .= " </IDE>\n"; $_text .= " <SCSI>\n"; if ($strScsidevices) { $_text .= $strScsidevices; } $_text .= " </SCSI>\n"; $_text .= " <USB>\n"; if ($strUsbdevices) { $_text .= $strUsbdevices; } $_text .= " </USB>\n"; $_text .= " </Hardware>\n"; return $_text; }
function xml_hardware(&$hddtemp_devices) { global $sysinfo; global $text; $pci_devices = ""; $ide_devices = ""; $usb_devices = ""; $scsi_devices = ""; $sys = $sysinfo->cpu_info(); $ar_buf = finddups($sysinfo->pci()); if (count($ar_buf)) { for ($i = 0, $max = sizeof($ar_buf); $i < $max; $i++) { if ($ar_buf[$i]) { $pci_devices .= " <Device><Name>" . htmlspecialchars(chop($ar_buf[$i]), ENT_QUOTES) . "</Name></Device>\n"; } } } $ar_buf = $sysinfo->ide(); ksort($ar_buf); if (count($ar_buf)) { while (list($key, $value) = each($ar_buf)) { $ide_devices .= " <Device>\n<Name>" . htmlspecialchars($key . ': ' . $ar_buf[$key]['model'], ENT_QUOTES) . "</Name>\n"; if (isset($ar_buf[$key]['capacity'])) { $ide_devices .= '<Capacity>' . htmlspecialchars($ar_buf[$key]['capacity'], ENT_QUOTES) . '</Capacity>'; } $hddtemp_devices[] = $key; $ide_devices .= "</Device>\n"; } } $ar_buf = $sysinfo->scsi(); ksort($ar_buf); if (count($ar_buf)) { while (list($key, $value) = each($ar_buf)) { $scsi_devices .= "<Device>\n"; if ($key >= '0' && $key <= '9') { $scsi_devices .= " <Name>" . htmlspecialchars($ar_buf[$key]['model'], ENT_QUOTES) . "</Name>\n"; } else { $scsi_devices .= " <Name>" . htmlspecialchars($key . ': ' . $ar_buf[$key]['model'], ENT_QUOTES) . "</Name>\n"; } if (isset($ar_buf[$key]['capacity'])) { $scsi_devices .= '<Capacity>' . htmlspecialchars($ar_buf[$key]['capacity'], ENT_QUOTES) . '</Capacity>'; } $scsi_devices .= "</Device>\n"; } } $ar_buf = finddups($sysinfo->usb()); if (count($ar_buf)) { for ($i = 0, $max = sizeof($ar_buf); $i < $max; $i++) { if ($ar_buf[$i]) { $usb_devices .= " <Device><Name>" . htmlspecialchars(chop($ar_buf[$i]), ENT_QUOTES) . "</Name></Device>\n"; } } } /* disabled since we output this information $ar_buf = $sysinfo->sbus(); if (count($ar_buf)) { for ($i = 0, $max = sizeof($ar_buf); $i < $max; $i++) { if ($ar_buf[$i]) { $sbus_devices .= " <Device>" . htmlspecialchars(chop($ar_buf[$i]), ENT_QUOTES) . "</Device>\n"; } } } */ $_text = " <Hardware>\n"; $_text .= " <CPU>\n"; if (isset($sys['cpus'])) { $_text .= " <Number>" . htmlspecialchars($sys['cpus'], ENT_QUOTES) . "</Number>\n"; } if (isset($sys['model'])) { $_text .= " <Model>" . htmlspecialchars($sys['model'], ENT_QUOTES) . "</Model>\n"; } if (isset($sys['cpuspeed'])) { $_text .= " <Cpuspeed>" . htmlspecialchars($sys['cpuspeed'], ENT_QUOTES) . "</Cpuspeed>\n"; } if (isset($sys['busspeed'])) { $_text .= " <Busspeed>" . htmlspecialchars($sys['busspeed'], ENT_QUOTES) . "</Busspeed>\n"; } if (isset($sys['cache'])) { $_text .= " <Cache>" . htmlspecialchars($sys['cache'], ENT_QUOTES) . "</Cache>\n"; } if (isset($sys['bogomips'])) { $_text .= " <Bogomips>" . htmlspecialchars($sys['bogomips'], ENT_QUOTES) . "</Bogomips>\n"; } $_text .= " </CPU>\n"; $_text .= " <PCI>\n"; if ($pci_devices) { $_text .= $pci_devices; } $_text .= " </PCI>\n"; $_text .= " <IDE>\n"; if ($ide_devices) { $_text .= $ide_devices; } $_text .= " </IDE>\n"; $_text .= " <SCSI>\n"; if ($scsi_devices) { $_text .= $scsi_devices; } $_text .= " </SCSI>\n"; $_text .= " <USB>\n"; if ($usb_devices) { $_text .= $usb_devices; } $_text .= " </USB>\n"; /* $_text .= " <SBUS>\n"; if ($sbus_devices) { $_text .= $sbus_devices; } $_text .= " </SBUS>\n"; */ $_text .= " </Hardware>\n"; return $_text; }
private function buildHardware() { $hardware = $this->xml->addChild('Hardware'); $cpu = $hardware->addChild('CPU'); $pci = $hardware->addChild('PCI'); $ide = $hardware->addChild('IDE'); $scsi = $hardware->addChild('SCSI'); $usb = $hardware->addChild('USB'); $arrSys = $this->sysinfo->cpu_info(); $arrBuf = finddups($this->sysinfo->pci()); if (count($arrBuf)) { for ($i = 0, $max = sizeof($arrBuf); $i < $max; $i++) { if ($arrBuf[$i]) { $tmp = $pci->addChild('Device'); $tmp->addChild('Name', utf8_encode(trim(htmlspecialchars($arrBuf[$i])))); } } } $arrBuf = $this->sysinfo->ide(); if (count($arrBuf)) { foreach ($arrBuf as $strKey => $arrValue) { $tmp = $ide->addChild('Device'); $tmp->addChild('Name', $strKey . ': ' . utf8_encode(trim(htmlspecialchars($arrValue['model'])))); if (isset($arrValue['capacity'])) { $tmp->addChild('Capacity', $arrValue['capacity']); } } } $arrBuf = $this->sysinfo->scsi(); if (count($arrBuf)) { foreach ($arrBuf as $strKey => $arrValue) { $tmp = $scsi->addChild('Device'); if ($strKey >= '0' && $strKey <= '9') { $tmp->addChild('Name', utf8_encode(trim(htmlspecialchars($arrValue['model'])))); } else { $tmp->addChild('Name', $strKey . ': ' . utf8_encode(trim(htmlspecialchars($arrValue['model'])))); } if (isset($arrrValue['capacity'])) { $tmp->addChild('Capacity', $arrValue['capacity']); } } } $arrBuf = finddups($this->sysinfo->usb()); if (count($arrBuf)) { for ($i = 0, $max = sizeof($arrBuf); $i < $max; $i++) { if (trim($arrBuf[$i]) != "") { $tmp = $usb->addChild('Device'); $tmp->addChild('Name', utf8_encode(trim(htmlspecialchars($arrBuf[$i])))); } } } if (isset($arrSys['cpus'])) { $cpu->addChild('Number', $arrSys['cpus']); } if (isset($arrSys['model'])) { $cpu->addChild('Model', utf8_encode(trim(htmlspecialchars($arrSys['model'])))); } if (isset($arrSys['temp'])) { $cpu->addChild('Cputemp', $arrSys['temp']); } if (isset($arrSys['cpuspeed'])) { $cpu->addChild('Cpuspeed', $arrSys['cpuspeed']); } if (isset($arrSys['busspeed'])) { $cpu->addChild('Busspeed', $arrSys['busspeed']); } if (isset($arrSys['cache'])) { $cpu->addChild('Cache', $arrSys['cache']); } if (isset($arrSys['bogomips'])) { $cpu->addChild('Bogomips', $arrSys['bogomips']); } }