/web/acc/phpsysinfo/includes/class.CommonFunctions.inc.php |
---|
32,11 → 32,42 |
*/ |
private static $_cp = null; |
/** |
* value of checking run as administrator |
* |
* @var boolean |
*/ |
private static $_asadmin = null; |
public static function setcp($cp) |
{ |
CommonFunctions::$_cp = $cp; |
self::$_cp = $cp; |
} |
public static function getcp() |
{ |
return self::$_cp; |
} |
public static function isAdmin() |
{ |
if (self::$_asadmin == null) { |
if (PSI_OS == 'WINNT') { |
$strBuf = ''; |
self::executeProgram('sfc', '2>&1', $strBuf, false); // 'net session' for detection does not work if "Server" (LanmanServer) service is stopped |
if (preg_match('/^\/SCANNOW\s/m', preg_replace('/(\x00)/', '', $strBuf))) { // SCANNOW checking - also if Unicode |
self::$_asadmin = true; |
} else { |
self::$_asadmin = false; |
} |
} else { |
self::$_asadmin = false; |
} |
} |
return self::$_asadmin; |
} |
private static function _parse_log_file($string) |
{ |
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && ((substr(PSI_LOG, 0, 1)=="-") || (substr(PSI_LOG, 0, 1)=="+"))) { |
70,7 → 101,7 |
* |
* @return string|null complete path and name of the program |
*/ |
private static function _findProgram($strProgram) |
public static function _findProgram($strProgram) |
{ |
$path_parts = pathinfo($strProgram); |
if (empty($path_parts['basename'])) { |
84,11 → 115,11 |
$path_parts = pathinfo($strProgram); |
} |
if (PSI_OS == 'WINNT') { |
if (CommonFunctions::readenv('Path', $serverpath)) { |
if (self::readenv('Path', $serverpath)) { |
$arrPath = preg_split('/;/', $serverpath, -1, PREG_SPLIT_NO_EMPTY); |
} |
} else { |
if (CommonFunctions::readenv('PATH', $serverpath)) { |
if (self::readenv('PATH', $serverpath)) { |
$arrPath = preg_split('/:/', $serverpath, -1, PREG_SPLIT_NO_EMPTY); |
} |
} |
108,7 → 139,7 |
} |
//add some default paths if we still have no paths here |
if (empty($arrPath) && PSI_OS != 'WINNT') { |
if (empty($arrPath) && (PSI_OS != 'WINNT')) { |
if (PSI_OS == 'Android') { |
array_push($arrPath, '/system/bin'); |
} else { |
117,10 → 148,10 |
} |
$exceptPath = ""; |
if ((PSI_OS == 'WINNT') && CommonFunctions::readenv('WinDir', $windir)) { |
if ((PSI_OS == 'WINNT') && self::readenv('WinDir', $windir)) { |
foreach ($arrPath as $strPath) { |
if ((strtolower($strPath) == $windir."\\system32") && is_dir($windir."\\SysWOW64")) { |
if (is_dir($windir."\\sysnative")) { |
if ((strtolower($strPath) == strtolower($windir)."\\system32") && is_dir($windir."\\SysWOW64")) { |
if (is_dir($windir."\\sysnative\\drivers")) { // or strlen(decbin(~0)) == 32; is_dir($windir."\\sysnative") sometimes does not work |
$exceptPath = $windir."\\sysnative"; //32-bit PHP on 64-bit Windows |
} else { |
$exceptPath = $windir."\\SysWOW64"; //64-bit PHP on 64-bit Windows |
145,12 → 176,8 |
if (($strPath !== $exceptPath) && !is_dir($strPath)) { |
continue; |
} |
if (PSI_OS == 'WINNT') { |
$strProgrammpath = $strPathS.$strProgram; |
} else { |
$strProgrammpath = $strPathS.$strProgram; |
} |
if (is_executable($strProgrammpath)) { |
$strProgrammpath = $strPathS.$strProgram; |
if (is_executable($strProgrammpath) || ((PSI_OS == 'WINNT') && (strtolower($path_parts['extension']) == 'py'))) { |
return $strProgrammpath; |
} |
} |
160,7 → 187,7 |
/** |
* Execute a system program. return a trim()'d result. |
* does very crude pipe checking. you need ' | ' for it to work |
* does very crude pipe and multiple commands (on WinNT) checking. you need ' | ' or ' & ' for it to work |
* ie $program = CommonFunctions::executeProgram('netstat', '-anp | grep LIST'); |
* NOT $program = CommonFunctions::executeProgram('netstat', '-anp|grep LIST'); |
* |
189,7 → 216,7 |
} |
} |
if ((PSI_OS !== 'WINNT') && preg_match('/^([^=]+=[^ \t]+)[ \t]+(.*)$/', $strProgramname, $strmatch)) { |
if ((PSI_OS != 'WINNT') && preg_match('/^([^=]+=[^ \t]+)[ \t]+(.*)$/', $strProgramname, $strmatch)) { |
$strSet = $strmatch[1].' '; |
$strProgramname = $strmatch[2]; |
} else { |
209,7 → 236,7 |
} |
} |
if ((PSI_OS !== 'WINNT') && defined('PSI_SUDO_COMMANDS') && is_string(PSI_SUDO_COMMANDS)) { |
if ((PSI_OS != 'WINNT') && defined('PSI_SUDO_COMMANDS') && is_string(PSI_SUDO_COMMANDS)) { |
if (preg_match(ARRAY_EXP, PSI_SUDO_COMMANDS)) { |
$sudocommands = eval(PSI_SUDO_COMMANDS); |
} else { |
233,14 → 260,18 |
} |
} |
// see if we've gotten a |, if we have we need to do path checking on the cmd |
// see if we've gotten a | or &, if we have we need to do path checking on the cmd |
if ($strArgs) { |
$arrArgs = preg_split('/ /', $strArgs, -1, PREG_SPLIT_NO_EMPTY); |
for ($i = 0, $cnt_args = count($arrArgs); $i < $cnt_args; $i++) { |
if ($arrArgs[$i] == '|') { |
if (($arrArgs[$i] == '|') || ($arrArgs[$i] == '&')) { |
$strCmd = $arrArgs[$i + 1]; |
$strNewcmd = self::_findProgram($strCmd); |
$strArgs = preg_replace("/\| ".$strCmd.'/', '| "'.$strNewcmd.'"', $strArgs); |
if ($arrArgs[$i] == '|') { |
$strArgs = preg_replace('/\| '.$strCmd.'/', '| "'.$strNewcmd.'"', $strArgs); |
} else { |
$strArgs = preg_replace('/& '.$strCmd.'/', '& "'.$strNewcmd.'"', $strArgs); |
} |
} |
} |
$strArgs = ' '.$strArgs; |
307,7 → 338,7 |
public static function rolv($similarFileName, $match = "//", $replace = "") |
{ |
$filename = preg_replace($match, $replace, $similarFileName); |
if (CommonFunctions::fileexists($filename) && CommonFunctions::rfts($filename, $buf, 1, 4096, false) && (($buf=trim($buf)) != "")) { |
if (self::fileexists($filename) && self::rfts($filename, $buf, 1, 4096, false) && (($buf=trim($buf)) != "")) { |
return $buf; |
} else { |
return null; |
503,9 → 534,9 |
*/ |
public static function checkForExtensions($arrExt = array()) |
{ |
if ((strcasecmp(PSI_SYSTEM_CODEPAGE, "UTF-8") == 0) || (strcasecmp(PSI_SYSTEM_CODEPAGE, "CP437") == 0)) |
if (defined('PSI_SYSTEM_CODEPAGE') && ((strcasecmp(PSI_SYSTEM_CODEPAGE, "UTF-8") == 0) || (strcasecmp(PSI_SYSTEM_CODEPAGE, "CP437") == 0))) |
$arrReq = array('simplexml', 'pcre', 'xml', 'dom'); |
elseif (PSI_OS == "WINNT") |
elseif (PSI_OS == 'WINNT') |
$arrReq = array('simplexml', 'pcre', 'xml', 'dom', 'mbstring', 'com_dotnet'); |
else |
$arrReq = array('simplexml', 'pcre', 'xml', 'dom', 'mbstring'); |
626,6 → 657,47 |
$error->addError("getWMI()", preg_replace('/<br\/>/', "\n", preg_replace('/<b>|<\/b>/', '', $e->getMessage()))); |
} |
} |
} elseif ((gettype($wmi) === "string") && (PSI_OS == 'Linux')) { |
$delimeter = '@@@DELIM@@@'; |
if (self::executeProgram('wmic', '--delimiter="'.$delimeter.'" '.$wmi.' '.$strClass.'" 2>/dev/null', $strBuf, true) && preg_match("/^CLASS:\s/", $strBuf)) { |
if (self::$_cp) { |
if (self::$_cp == 932) { |
$codename = ' (SJIS)'; |
} elseif (self::$_cp == 949) { |
$codename = ' (EUC-KR)'; |
} elseif (self::$_cp == 950) { |
$codename = ' (BIG-5)'; |
} else { |
$codename = ''; |
} |
self::convertCP($strBuf, 'windows-'.self::$_cp.$codename); |
} |
$lines = preg_split('/\n/', $strBuf, -1, PREG_SPLIT_NO_EMPTY); |
if (count($lines) >=3) { |
unset($lines[0]); |
$names = preg_split('/'.$delimeter.'/', $lines[1], -1, PREG_SPLIT_NO_EMPTY); |
$namesc = count($names); |
unset($lines[1]); |
foreach ($lines as $line) { |
$arrInstance = array(); |
$values = preg_split('/'.$delimeter.'/', $line, -1); |
if (count($values) == $namesc) { |
foreach ($values as $id=>$value) { |
if (empty($strValue)) { |
if ($value !== "(null)") $arrInstance[$names[$id]] = trim($value); |
else $arrInstance[$names[$id]] = null; |
} else { |
if (in_array($names[$id], $strValue)) { |
if ($value !== "(null)") $arrInstance[$names[$id]] = trim($value); |
else $arrInstance[$names[$id]] = null; |
} |
} |
} |
$arrData[] = $arrInstance; |
} |
} |
} |
} |
} |
return $arrData; |
666,18 → 738,23 |
*/ |
public static function readReg($reg, $strName, &$strBuffer, $booErrorRep = true) |
{ |
$strBuffer = ''; |
$arrBuffer = array(); |
$_hkey = array('HKEY_CLASSES_ROOT'=>0x80000000, 'HKEY_CURRENT_USER'=>0x80000001, 'HKEY_LOCAL_MACHINE'=>0x80000002, 'HKEY_USERS'=>0x80000003, 'HKEY_PERFORMANCE_DATA'=>0x80000004, 'HKEY_PERFORMANCE_TEXT'=>0x80000050, 'HKEY_PERFORMANCE_NLSTEXT'=>0x80000060, 'HKEY_CURRENT_CONFIG'=>0x80000005, 'HKEY_DYN_DATA'=>0x80000006); |
if ($reg === false) { |
if (defined('PSI_EMU_HOSTNAME')) { |
return false; |
} |
$last = strrpos($strName, "\\"); |
$keyname = substr($strName, $last + 1); |
if (CommonFunctions::$_cp) { |
if (CommonFunctions::executeProgram('cmd', '/c chcp '.CommonFunctions::$_cp.' && reg query "'.substr($strName, 0, $last).'" /v '.$keyname.' 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match("/^\s*".$keyname."\s+REG_\S+\s+(.+)\s*$/mi", $strBuf, $buffer2)) { |
if (self::$_cp) { |
if (self::executeProgram('cmd', '/c chcp '.self::$_cp.' >nul & reg query "'.substr($strName, 0, $last).'" /v '.$keyname.' 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match("/^\s*".$keyname."\s+REG_\S+\s+(.+)\s*$/mi", $strBuf, $buffer2)) { |
$strBuffer = $buffer2[1]; |
} else { |
return false; |
} |
} else { |
if (CommonFunctions::executeProgram('reg', 'query "'.substr($strName, 0, $last).'" /v '.$keyname.' 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match("/^\s*".$keyname."\s+REG_\S+\s+(.+)\s*$/mi", $strBuf, $buffer2)) { |
if (self::executeProgram('reg', 'query "'.substr($strName, 0, $last).'" /v '.$keyname.' 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match("/^\s*".$keyname."\s+REG_\S+\s+(.+)\s*$/mi", $strBuf, $buffer2)) { |
$strBuffer = $buffer2[1]; |
} else { |
return false; |
684,15 → 761,28 |
} |
} |
} elseif (gettype($reg) === "object") { |
try { |
$strBuffer = $reg->RegRead($strName); |
} catch (Exception $e) { |
if ($booErrorRep) { |
$error = PSI_Error::singleton(); |
$error->addError("readReg()", preg_replace('/<br\/>/', "\n", preg_replace('/<b>|<\/b>/', '', $e->getMessage()))); |
$first = strpos($strName, "\\"); |
$last = strrpos($strName, "\\"); |
$hkey = substr($strName, 0, $first); |
if (isset($_hkey[$hkey])) { |
$sub_keys = new VARIANT(); |
try { |
$reg->Get("StdRegProv")->GetStringValue(strval($_hkey[$hkey]), substr($strName, $first+1, $last-$first-1), substr($strName, $last+1), $sub_keys); |
} catch (Exception $e) { |
if ($booErrorRep) { |
$error = PSI_Error::singleton(); |
$error->addError("GetStringValue()", preg_replace('/<br\/>/', "\n", preg_replace('/<b>|<\/b>/', '', $e->getMessage()))); |
} |
return false; |
} |
return false; |
if (variant_get_type($sub_keys) !== VT_NULL) { |
$strBuffer = strval($sub_keys); |
} else { |
return false; |
} |
} else { |
return false; |
} |
} |
699,20 → 789,22 |
return true; |
} |
/** |
* enumKey function |
* |
* @return boolean command successfull or not |
*/ |
public static function enumKey($key, $strName, &$arrBuffer, $booErrorRep = true) |
public static function enumKey($reg, $strName, &$arrBuffer, $booErrorRep = true) |
{ |
$arrBuffer = array(); |
$_hkey = array('HKEY_CLASSES_ROOT'=>0x80000000, 'HKEY_CURRENT_USER'=>0x80000001, 'HKEY_LOCAL_MACHINE'=>0x80000002, 'HKEY_USERS'=>0x80000003, 'HKEY_PERFORMANCE_DATA'=>0x80000004, 'HKEY_PERFORMANCE_TEXT'=>0x80000050, 'HKEY_PERFORMANCE_NLSTEXT'=>0x80000060, 'HKEY_CURRENT_CONFIG'=>0x80000005, 'HKEY_DYN_DATA'=>0x80000006); |
$arrBuffer = array(); |
if ($key === false) { |
if (CommonFunctions::$_cp) { |
if (CommonFunctions::executeProgram('cmd', '/c chcp '.CommonFunctions::$_cp.' && reg query "'.$strName.'" 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match_all("/^".preg_replace("/\\\\/", "\\\\\\\\", $strName)."\\\\(.*)/mi", $strBuf, $buffer2)) { |
if ($reg === false) { |
if (defined('PSI_EMU_HOSTNAME')) { |
return false; |
} |
if (self::$_cp) { |
if (self::executeProgram('cmd', '/c chcp '.self::$_cp.' >nul & reg query "'.$strName.'" 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match_all("/^".preg_replace("/\\\\/", "\\\\\\\\", $strName)."\\\\(.*)/mi", $strBuf, $buffer2)) { |
foreach ($buffer2[1] as $sub_key) { |
$arrBuffer[] = trim($sub_key); |
} |
720,7 → 812,7 |
return false; |
} |
} else { |
if (CommonFunctions::executeProgram('reg', 'query "'.$strName.'" 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match_all("/^".preg_replace("/\\\\/", "\\\\\\\\", $strName)."\\\\(.*)/mi", $strBuf, $buffer2)) { |
if (self::executeProgram('reg', 'query "'.$strName.'" 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match_all("/^".preg_replace("/\\\\/", "\\\\\\\\", $strName)."\\\\(.*)/mi", $strBuf, $buffer2)) { |
foreach ($buffer2[1] as $sub_key) { |
$arrBuffer[] = trim($sub_key); |
} |
728,13 → 820,13 |
return false; |
} |
} |
} elseif (gettype($key) === "object") { |
} elseif (gettype($reg) === "object") { |
$first = strpos($strName, "\\"); |
$hkey = substr($strName, 0, $first); |
if (isset($_hkey[$hkey])) { |
$sub_keys = new VARIANT(); |
try { |
$key->EnumKey(strval($_hkey[$hkey]), substr($strName, $first+1), $sub_keys); |
$reg->Get("StdRegProv")->EnumKey(strval($_hkey[$hkey]), substr($strName, $first+1), $sub_keys); |
} catch (Exception $e) { |
if ($booErrorRep) { |
$error = PSI_Error::singleton(); |
743,8 → 835,10 |
return false; |
} |
foreach ($sub_keys as $sub_key) { |
if (variant_get_type($sub_keys) !== VT_NULL) foreach ($sub_keys as $sub_key) { |
$arrBuffer[] = $sub_key; |
} else { |
return false; |
} |
} else { |
return false; |
753,4 → 847,62 |
return true; |
} |
/** |
* initWMI function |
* |
* @return string, object or false |
*/ |
public static function initWMI($namespace, $booErrorRep = false) |
{ |
$wmi = false; |
try { |
if (PSI_OS == 'Linux') { |
if (defined('PSI_EMU_HOSTNAME')) |
$wmi = '--namespace="'.$namespace.'" -U '.PSI_EMU_USER.'%'.PSI_EMU_PASSWORD.' //'.PSI_EMU_HOSTNAME.' "select * from'; |
} elseif (PSI_OS == 'WINNT') { |
$objLocator = new COM('WbemScripting.SWbemLocator'); |
if (defined('PSI_EMU_HOSTNAME')) |
$wmi = $objLocator->ConnectServer(PSI_EMU_HOSTNAME, $namespace, PSI_EMU_USER, PSI_EMU_PASSWORD); |
else |
$wmi = $objLocator->ConnectServer('', $namespace); |
} |
} catch (Exception $e) { |
if ($booErrorRep) { |
$error = PSI_Error::singleton(); |
$error->addError("WMI connect ".$namespace." error", "PhpSysInfo can not connect to the WMI interface for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed or credentials."); |
} |
} |
return $wmi; |
} |
/** |
* convertCP function |
* |
* @return void |
*/ |
public static function convertCP(&$strBuf, $encoding) |
{ |
if (defined('PSI_SYSTEM_CODEPAGE') && ($encoding != null) && ($encoding != PSI_SYSTEM_CODEPAGE)) { |
$systemcp = PSI_SYSTEM_CODEPAGE; |
if (preg_match("/^windows-\d+ \((.+)\)$/", $systemcp, $buf)) { |
$systemcp = $buf[1]; |
} |
if (preg_match("/^windows-\d+ \((.+)\)$/", $encoding, $buf)) { |
$encoding = $buf[1]; |
} |
$enclist = mb_list_encodings(); |
if (in_array($encoding, $enclist) && in_array($systemcp, $enclist)) { |
$strBuf = mb_convert_encoding($strBuf, $encoding, $systemcp); |
} elseif (function_exists("iconv")) { |
if (($iconvout=iconv($systemcp, $encoding.'//IGNORE', $strBuf))!==false) { |
$strBuf = $iconvout; |
} |
} elseif (function_exists("libiconv") && (($iconvout=libiconv($systemcp, $encoding, $strBuf))!==false)) { |
$strBuf = $iconvout; |
} |
} |
} |
} |
/web/acc/phpsysinfo/includes/class.Parser.inc.php |
---|
34,17 → 34,38 |
public static function lspci($debug = PSI_DEBUG) |
{ |
$arrResults = array(); |
if (CommonFunctions::executeProgram("lspci", "", $strBuf, $debug)) { |
if (CommonFunctions::executeProgram("lspci", (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS)?"-m":"", $strBuf, $debug)) { |
$arrLines = preg_split("/\n/", $strBuf, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($arrLines as $strLine) { |
$arrParams = preg_split('/ /', trim($strLine), 2); |
if (count($arrParams) == 2) |
$strName = $arrParams[1]; |
else |
$strName = "unknown"; |
$strName = preg_replace('/\(.*\)/', '', $strName); |
$dev = new HWDevice(); |
$dev->setName($strName); |
$arrParams = preg_split('/(\"? ")|(\" (?=-))/', trim($strLine)); |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS && ($cp = count($arrParams)) >= 6) { |
$arrParams[$cp-1] = trim($arrParams[$cp-1],'"'); // remove last " |
$dev->setName($arrParams[1].': '.$arrParams[2].' '.$arrParams[3]); |
if (preg_match('/^-/', $arrParams[4])) { |
if (($arrParams[5] !== "") && !preg_match('/^Unknown vendor/', $arrParams[5])) { |
$dev->setManufacturer(trim($arrParams[5])); |
} |
if (($arrParams[6] !== "") && !preg_match('/^Device /', $arrParams[6])) { |
$dev->setProduct(trim($arrParams[6])); |
} |
} else { |
if (($arrParams[4] !== "") && !preg_match('/^Unknown vendor/', $arrParams[4])) { |
$dev->setManufacturer(trim($arrParams[4])); |
} |
if (($arrParams[5] !== "") && !preg_match('/^Device /', $arrParams[5])) { |
$dev->setProduct(trim($arrParams[5])); |
} |
} |
} else { |
$strLine=trim(preg_replace('/(")|( -\S+)/', '', $strLine)); |
$arrParams = preg_split('/ /', trim($strLine), 2); |
if (count($arrParams) == 2) |
$strName = preg_replace('/\(rev\s[^\)]+\)/', '', $arrParams[1]); |
else |
$strName = "unknown"; |
$dev->setName($strName); |
} |
$arrResults[] = $dev; |
} |
} |
/web/acc/phpsysinfo/includes/error/class.PSI_Error.inc.php |
---|
229,7 → 229,9 |
if ($val == $arrTrace[count($arrTrace) - 1]) { |
break; |
} |
$strBacktrace .= str_replace(PSI_APP_ROOT, ".", $val['file']).' on line '.$val['line']; |
if (isset($val['file'])) { |
$strBacktrace .= str_replace(PSI_APP_ROOT, ".", $val['file']).' on line '.$val['line']; |
} |
if ($strFunc) { |
$strBacktrace .= ' in function '.$strFunc; |
} |
/web/acc/phpsysinfo/includes/js/class.JavaScriptPacker.inc.php |
---|
521,7 → 521,7 |
'; |
//}; |
/* |
' if (!\'\'.replace(/^/, String)) { |
' if (!\'\'.replace(/^/, String)) { |
// decode all the values we need |
while ($count--) $decode[$encode($count)] = $keywords[$count] || $encode($count); |
// global replacement function |
/web/acc/phpsysinfo/includes/mb/class.coretemp.inc.php |
---|
25,17 → 25,19 |
*/ |
public function build() |
{ |
if (PSI_OS == 'Linux') { |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$hwpaths = glob("/sys/devices/platform/coretemp.*/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) > 0)) { |
$hwpaths = array_merge($hwpaths, glob("/sys/devices/platform/coretemp.*/hwmon/hwmon*/", GLOB_NOSORT)); |
} |
if (is_array($hwpaths) && (($totalh = count($hwpaths)) > 0)) { |
$hwpaths2 = glob("/sys/devices/platform/coretemp.*/hwmon/hwmon*/", GLOB_NOSORT); |
if (is_array($hwpaths2) && (count($hwpaths2) > 0)) { |
$hwpaths = array_merge($hwpaths, $hwpaths2); |
} |
$totalh = count($hwpaths); |
for ($h = 0; $h < $totalh; $h++) { |
$this->_temperature($hwpaths[$h]); |
} |
} |
} else { |
} elseif (PSI_OS == 'FreeBSD') { |
$smp = 1; |
CommonFunctions::executeProgram('sysctl', '-n kern.smp.cpus', $smp); |
for ($i = 0; $i < $smp; $i++) { |
/web/acc/phpsysinfo/includes/mb/class.freeipmi.inc.php |
---|
27,14 → 27,14 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_FREEIPMI_ACCESS')?strtolower(PSI_SENSOR_FREEIPMI_ACCESS):'command') { |
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_FREEIPMI_ACCESS')?strtolower(PSI_SENSOR_FREEIPMI_ACCESS):'command') { |
case 'command': |
CommonFunctions::executeProgram('ipmi-sensors', '--output-sensor-thresholds', $lines); |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/freeipmi.txt', $lines)) { |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
/web/acc/phpsysinfo/includes/mb/class.hddtemp.inc.php |
---|
24,7 → 24,7 |
private function _temperature() |
{ |
$ar_buf = array(); |
switch (defined('PSI_SENSOR_HDDTEMP_ACCESS')?strtolower(PSI_SENSOR_HDDTEMP_ACCESS):'command') { |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_HDDTEMP_ACCESS')?strtolower(PSI_SENSOR_HDDTEMP_ACCESS):'command') { |
case 'tcp': |
$lines = ''; |
// Timo van Roermund: connect to the hddtemp daemon, use a 5 second timeout. |
/web/acc/phpsysinfo/includes/mb/class.healthd.inc.php |
---|
27,7 → 27,7 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_HEALTHD_ACCESS')?strtolower(PSI_SENSOR_HEALTHD_ACCESS):'command') { |
if (PSI_OS == 'FreeBSD') switch (defined('PSI_SENSOR_HEALTHD_ACCESS')?strtolower(PSI_SENSOR_HEALTHD_ACCESS):'command') { |
case 'command': |
if (CommonFunctions::executeProgram('healthdc', '-t', $lines)) { |
$lines0 = preg_split("/\n/", $lines, 1, PREG_SPLIT_NO_EMPTY); |
/web/acc/phpsysinfo/includes/mb/class.hwmon.inc.php |
---|
37,6 → 37,13 |
$dev->setName($buf.$name); |
} else { |
$labelname = trim(preg_replace("/_input$/", "", pathinfo($sensor[$i], PATHINFO_BASENAME))); |
if (($name == " (drivetemp)") && (count($buf = CommonFunctions::gdc($hwpath . "device/block", false)))) { |
$labelname = "/dev/" . $buf[0]; |
if (($buf = CommonFunctions::rolv($hwpath . "device/model"))!==null) { |
$labelname .= " (".$buf.")"; |
$name = ""; |
} |
} |
if ($labelname !== "") { |
$dev->setName($labelname.$name); |
} else { |
239,17 → 246,21 |
*/ |
public function build() |
{ |
$hwpaths = glob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) > 0)) { |
$hwpaths = array_merge($hwpaths, glob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT)); |
} |
if (is_array($hwpaths) && (($totalh = count($hwpaths)) > 0)) { |
for ($h = 0; $h < $totalh; $h++) { |
$this->_temperature($hwpaths[$h]); |
$this->_voltage($hwpaths[$h]); |
$this->_fans($hwpaths[$h]); |
$this->_power($hwpaths[$h]); |
$this->_current($hwpaths[$h]); |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$hwpaths = glob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) > 0)) { |
$hwpaths2 = glob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT); |
if (is_array($hwpaths2) && (count($hwpaths2) > 0)) { |
$hwpaths = array_merge($hwpaths, $hwpaths2); |
} |
$totalh = count($hwpaths); |
for ($h = 0; $h < $totalh; $h++) { |
$this->_temperature($hwpaths[$h]); |
$this->_voltage($hwpaths[$h]); |
$this->_fans($hwpaths[$h]); |
$this->_power($hwpaths[$h]); |
$this->_current($hwpaths[$h]); |
} |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.hwsensors.inc.php |
---|
27,10 → 27,12 |
public function __construct() |
{ |
parent::__construct(); |
$lines = ""; |
// CommonFunctions::executeProgram('sysctl', '-w hw.sensors', $lines); |
CommonFunctions::executeProgram('sysctl', 'hw.sensors', $lines); |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
if (PSI_OS == 'OpenBSD') { |
$lines = ""; |
// CommonFunctions::executeProgram('sysctl', '-w hw.sensors', $lines); |
CommonFunctions::executeProgram('sysctl', 'hw.sensors', $lines); |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
} |
/** |
/web/acc/phpsysinfo/includes/mb/class.ipmicfg.inc.php |
---|
0,0 → 1,239 |
<?php |
/** |
* ipmicfg sensor class, getting information from ipmicfg -sdr |
* |
* PHP version 5 |
* |
* @category PHP |
* @package PSI_Sensor |
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net> |
* @copyright 2021 phpSysInfo |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version |
* @version Release: 3.0 |
* @link http://phpsysinfo.sourceforge.net |
*/ |
class IPMIcfg extends Sensors |
{ |
/** |
* content to parse |
* |
* @var array |
*/ |
private $_lines = array(); |
/** |
* fill the private content var through command or data access |
*/ |
public function __construct() |
{ |
parent::__construct(); |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMICFG_ACCESS')?strtolower(PSI_SENSOR_IPMICFG_ACCESS):'command') { |
case 'command': |
if (!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) { |
CommonFunctions::executeProgram('ipmicfg', '-sdr', $lines); |
} |
if (defined('PSI_SENSOR_IPMICFG_PSFRUINFO') && (PSI_SENSOR_IPMICFG_PSFRUINFO!==false)) { |
if (CommonFunctions::executeProgram('ipmicfg', '-psfruinfo', $lines2, PSI_DEBUG)) { |
$lines.=$lines2; |
} |
} |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/ipmicfg.txt', $lines)) { |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_ipmicfg] ACCESS'); |
break; |
} |
} |
/** |
* get temperature information |
* |
* @return void |
*/ |
private function _temperature() |
{ |
foreach ($this->_lines as $line) { |
$buffer = preg_split("/\s*\|\s*/", $line); |
if ((!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) && |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*([-\d]+)C\/[-\d]+F\s*$/",$buffer[2], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
if ($valbuff[1]<-128) $valbuff[1]+=256; //+256 correction |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*([-\d]+)C\/[-\d]+F\s*$/",$buffer[3], $valbuffmin)) { |
if ($valbuffmin[1]<-128) $valbuffmin[1]+=256; //+256 correction |
} |
if (preg_match("/^\s*([-\d]+)C\/[-\d]+F\s*$/",$buffer[4], $valbuffmax)) { |
if ($valbuffmax[1]<-128) $valbuffmax[1]+=256; //+256 correction |
$dev->setMax($valbuffmax[1]); |
} |
if ((isset($valbuffmin[1]) && ($valbuff[1]<=$valbuffmin[1])) || (isset($valbuffmax[1]) && ($valbuff[1]>=$valbuffmax[1]))) { //own range test due to errors with +256 correction |
$dev->setEvent("Alarm"); |
} |
$this->mbinfo->setMbTemp($dev); |
} elseif ((defined('PSI_SENSOR_IPMICFG_PSFRUINFO') && (PSI_SENSOR_IPMICFG_PSFRUINFO!==false)) && |
(count($buffer)==2) && preg_match("/^\s*([-\d]+)C\/[-\d]+F\s*$/", $buffer[1], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName(trim($buffer[0])." (psfruinfo)"); |
$dev->setValue($valbuff[1]); |
$this->mbinfo->setMBTemp($dev); |
} |
} |
} |
/** |
* get voltage information |
* |
* @return void |
*/ |
private function _voltage() |
{ |
foreach ($this->_lines as $line) { |
$buffer = preg_split("/\s*\|\s*/", $line); |
if ((!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) && |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*([\d\.]+)\sV\s*$/",$buffer[2], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*([\d\.].+)\sV\s*$/",$buffer[3], $valbuffmin)) { |
$dev->setMin($valbuffmin[1]); |
} |
if (preg_match("/^\s*([\d\.].+)\sV\s*$/",$buffer[4], $valbuffmax)) { |
$dev->setMax($valbuffmax[1]); |
} |
if (trim($buffer[0]) != "OK") $dev->setEvent(trim($buffer[0])); |
$this->mbinfo->setMbVolt($dev); |
} |
} |
} |
/** |
* get fan information |
* |
* @return void |
*/ |
private function _fans() |
{ |
foreach ($this->_lines as $line) { |
$buffer = preg_split("/\s*\|\s*/", $line); |
if ((!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) && |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*(\d+)\sRPM\s*$/",$buffer[2], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*(\d+)\sRPM\s*$/",$buffer[3], $valbuffmin)) { |
$dev->setMin($valbuffmin[1]); |
} |
if ((trim($buffer[0]) != "OK") && isset($valbuffmin[1])) { |
$dev->setEvent(trim($buffer[0])); |
} |
$this->mbinfo->setMbFan($dev); |
} elseif ((defined('PSI_SENSOR_IPMICFG_PSFRUINFO') && (PSI_SENSOR_IPMICFG_PSFRUINFO!==false)) && |
(count($buffer)==2) && preg_match("/^\s*(\d+)\sRPM\s*$/", $buffer[1], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName(trim($buffer[0])." (psfruinfo)"); |
$dev->setValue($valbuff[1]); |
$this->mbinfo->setMBFan($dev); |
} |
} |
} |
/** |
* get power information |
* |
* @return void |
*/ |
private function _power() |
{ |
foreach ($this->_lines as $line) { |
$buffer = preg_split("/\s*\|\s*/", $line); |
if ((!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) && |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*(\d+)\sWatts\s*$/",$buffer[2], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*(\d+)\sWatts\s*$/",$buffer[4], $valbuffmax)) { |
$dev->setMax($valbuffmax[1]); |
} |
if (trim($buffer[0]) != "OK") $dev->setEvent(trim($buffer[0])); |
$this->mbinfo->setMbPower($dev); |
} |
} |
} |
/** |
* get current information |
* |
* @return void |
*/ |
private function _current() |
{ |
foreach ($this->_lines as $line) { |
$buffer = preg_split("/\s*\|\s*/", $line); |
if ((!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) && |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*([\d\.]+)\sAmps\s*$/",$buffer[2], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*([\d\.].+)\sAmps\s*$/",$buffer[3], $valbuffmin)) { |
$dev->setMin($valbuffmin[1]); |
} |
if (preg_match("/^\s*([\d\.].+)\sAmps\s*$/",$buffer[4], $valbuffmax)) { |
$dev->setMax($valbuffmax[1]); |
} |
if (trim($buffer[0]) != "OK") $dev->setEvent(trim($buffer[0])); |
$this->mbinfo->setMbCurrent($dev); |
} |
} |
} |
/** |
* get other information |
* |
* @return void |
*/ |
private function _other() |
{ |
foreach ($this->_lines as $line) { |
$buffer = preg_split("/\s*\|\s*/", $line); |
if ((!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) && |
(count($buffer)==4) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && |
($buffer[2]!=="Correctable ECC / other correctable memory error") && |
($buffer[2]!=="N/A")) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($buffer[2]); |
if (trim($buffer[0]) != "OK") $dev->setEvent(trim($buffer[0])); |
$this->mbinfo->setMbOther($dev); |
} elseif ((defined('PSI_SENSOR_IPMICFG_PSFRUINFO') && (PSI_SENSOR_IPMICFG_PSFRUINFO!==false)) && |
(count($buffer)==2) && (trim($buffer[0])=="Status")) { |
$dev = new SensorDevice(); |
$dev->setName(trim($buffer[0])." (psfruinfo)"); |
$dev->setValue($buffer[1]); |
$this->mbinfo->setMbOther($dev); |
} |
} |
} |
/** |
* get the information |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
*/ |
public function build() |
{ |
$this->_temperature(); |
$this->_voltage(); |
$this->_fans(); |
$this->_power(); |
$this->_current(); |
$this->_other(); |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.ipmitool.inc.php |
---|
28,7 → 28,7 |
{ |
parent::__construct(); |
$lines = ""; |
switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') { |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') { |
case 'command': |
CommonFunctions::executeProgram('ipmitool', 'sensor -v', $lines); |
break; |
/web/acc/phpsysinfo/includes/mb/class.ipmiutil.inc.php |
---|
27,7 → 27,7 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_IPMIUTIL_ACCESS')?strtolower(PSI_SENSOR_IPMIUTIL_ACCESS):'command') { |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMIUTIL_ACCESS')?strtolower(PSI_SENSOR_IPMIUTIL_ACCESS):'command') { |
case 'command': |
CommonFunctions::executeProgram('ipmiutil', 'sensor -stw', $lines); |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
/web/acc/phpsysinfo/includes/mb/class.k8temp.inc.php |
---|
27,7 → 27,7 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_K8TEMP_ACCESS')?strtolower(PSI_SENSOR_K8TEMP_ACCESS):'command') { |
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_K8TEMP_ACCESS')?strtolower(PSI_SENSOR_K8TEMP_ACCESS):'command') { |
case 'command': |
$lines = ""; |
CommonFunctions::executeProgram('k8temp', '', $lines); |
/web/acc/phpsysinfo/includes/mb/class.lmsensors.inc.php |
---|
28,7 → 28,7 |
{ |
parent::__construct(); |
$lines = ""; |
switch (defined('PSI_SENSOR_LMSENSORS_ACCESS')?strtolower(PSI_SENSOR_LMSENSORS_ACCESS):'command') { |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_LMSENSORS_ACCESS')?strtolower(PSI_SENSOR_LMSENSORS_ACCESS):'command') { |
case 'command': |
CommonFunctions::executeProgram("sensors", "", $lines); |
break; |
/web/acc/phpsysinfo/includes/mb/class.mbm5.inc.php |
---|
34,14 → 34,16 |
public function __construct() |
{ |
parent::__construct(); |
$delim = "/;/"; |
CommonFunctions::rfts(PSI_APP_ROOT."/data/MBM5.csv", $buffer); |
if (strpos($buffer, ";") === false) { |
$delim = "/,/"; |
if ((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) { |
$delim = "/;/"; |
CommonFunctions::rfts(PSI_APP_ROOT."/data/MBM5.csv", $buffer); |
if (strpos($buffer, ";") === false) { |
$delim = "/,/"; |
} |
$buffer = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
$this->_buf_label = preg_split($delim, substr($buffer[0], 0, -2), -1, PREG_SPLIT_NO_EMPTY); |
$this->_buf_value = preg_split($delim, substr($buffer[1], 0, -2), -1, PREG_SPLIT_NO_EMPTY); |
} |
$buffer = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
$this->_buf_label = preg_split($delim, substr($buffer[0], 0, -2), -1, PREG_SPLIT_NO_EMPTY); |
$this->_buf_value = preg_split($delim, substr($buffer[1], 0, -2), -1, PREG_SPLIT_NO_EMPTY); |
} |
/** |
/web/acc/phpsysinfo/includes/mb/class.mbmon.inc.php |
---|
27,7 → 27,7 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_MBMON_ACCESS')?strtolower(PSI_SENSOR_MBMON_ACCESS):'command') { |
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_MBMON_ACCESS')?strtolower(PSI_SENSOR_MBMON_ACCESS):'command') { |
case 'tcp': |
$fp = fsockopen("localhost", 411, $errno, $errstr, 5); |
if ($fp) { |
/web/acc/phpsysinfo/includes/mb/class.nvidiasmi.inc.php |
---|
0,0 → 1,138 |
<?php |
/** |
* nvidiasmi sensor class, getting hardware temperature information and fan speed from nvidia-smi utility |
* |
* PHP version 5 |
* |
* @category PHP |
* @package PSI_Sensor |
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net> |
* @copyright 2020 phpSysInfo |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version |
* @version Release: 3.0 |
* @link http://phpsysinfo.sourceforge.net |
*/ |
class NvidiaSMI extends Sensors |
{ |
/** |
* content to parse |
* |
* @var array |
*/ |
private $_gpus = array(); |
/** |
* fill the private array |
*/ |
public function __construct() |
{ |
parent::__construct(); |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_NVIDIASMI_ACCESS')?strtolower(PSI_SENSOR_NVIDIASMI_ACCESS):'command') { |
case 'command': |
if (PSI_OS == 'WINNT') { |
$winnt_exe = (defined('PSI_SENSOR_NVIDIASMI_EXE_PATH') && is_string(PSI_SENSOR_NVIDIASMI_EXE_PATH))?strtolower(PSI_SENSOR_NVIDIASMI_EXE_PATH):"c:\\Program Files\\NVIDIA Corporation\\NVSMI\\nvidia-smi.exe"; |
if (($_exe=realpath(trim($winnt_exe))) && preg_match("/^([a-zA-Z]:\\\\[^\\\\]+)/", $_exe, $out)) { |
CommonFunctions::executeProgram('cmd', "/c set ProgramFiles=".$out[1]."^&\"".$_exe."\" -q", $lines); |
} else { |
$this->error->addConfigError('__construct()', '[sensor_nvidiasmi] EXE_PATH="'.$winnt_exe.'"'); |
} |
} else { |
CommonFunctions::executeProgram('nvidia-smi', '-q', $lines); |
} |
$this->_gpus = preg_split("/^(?=GPU )/m", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/nvidiasmi.txt', $lines)) { |
$this->_gpus = preg_split("/^(?=GPU )/m", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_nvidiasmi] ACCESS'); |
break; |
} |
} |
/** |
* get the information |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
*/ |
public function build() |
{ |
$gpuc=count($this->_gpus); |
switch ($gpuc) { |
case 0: |
$this->error->addError("nvidia-smi", "No values"); |
break; |
case 1: |
$this->error->addError("nvidia-smi", "Error: ".$this->_gpus[0]); |
break; |
default: |
for ($c = 0; $c < $gpuc; $c++) { |
if (preg_match("/^\s+GPU Current Temp\s+:\s*(\d+)\s*C\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." (nvidiasmi)"); |
$dev->setValue($out[1]); |
if (preg_match("/^\s+GPU Shutdown Temp\s+:\s*(\d+)\s*C\s*$/m", $this->_gpus[$c], $out)) { |
$dev->setMax($out[1]); |
} |
$this->mbinfo->setMbTemp($dev); |
} |
if (preg_match("/^\s+Power Draw\s+:\s*([\d\.]+)\s*W\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." (nvidiasmi)"); |
$dev->setValue($out[1]); |
if (preg_match("/^\s+Power Limit\s+:\s*([\d\.]+)\s*W\s*$/m", $this->_gpus[$c], $out)) { |
$dev->setMax($out[1]); |
} |
$this->mbinfo->setMbPower($dev); |
} |
if (preg_match("/^\s+Fan Speed\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbFan($dev); |
} |
if (preg_match("/^\s+Performance State\s+:\s*(\S+)\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Performance State (nvidiasmi)"); |
$dev->setValue($out[1]); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Gpu\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Memory\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Memory Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Encoder\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Encoder Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Decoder\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Decoder Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
} |
break; |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.ohm.inc.php |
---|
27,19 → 27,14 |
public function __construct() |
{ |
parent::__construct(); |
$_wmi = null; |
try { |
// initialize the wmi object |
$objLocator = new COM('WbemScripting.SWbemLocator'); |
$_wmi = $objLocator->ConnectServer('', 'root\OpenHardwareMonitor'); |
} catch (Exception $e) { |
$this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for OpenHardwareMonitor data."); |
} |
if ($_wmi) { |
$tmpbuf = CommonFunctions::getWMI($_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value')); |
if ($tmpbuf) foreach ($tmpbuf as $buffer) { |
if (!isset($this->_buf[$buffer['SensorType']]) || !isset($this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']])) { // avoid duplicates |
$this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']] = $buffer['Value']; |
if ((PSI_OS == 'WINNT') || defined('PSI_EMU_HOSTNAME')) { |
$_wmi = CommonFunctions::initWMI('root\OpenHardwareMonitor', true); |
if ($_wmi) { |
$tmpbuf = CommonFunctions::getWMI($_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value')); |
if ($tmpbuf) foreach ($tmpbuf as $buffer) { |
if (!isset($this->_buf[$buffer['SensorType']]) || !isset($this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']])) { // avoid duplicates |
$this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']] = $buffer['Value']; |
} |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.pitemp.inc.php |
---|
57,8 → 57,10 |
public function build() |
{ |
$this->_temperature(); |
$this->_voltage(); |
$this->_current(); |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$this->_temperature(); |
$this->_voltage(); |
$this->_current(); |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.qtssnmp.inc.php |
---|
75,7 → 75,9 |
*/ |
public function build() |
{ |
$this->_temperature(); |
$this->_fans(); |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$this->_temperature(); |
$this->_fans(); |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.speedfan.inc.php |
---|
23,7 → 23,7 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_SPEEDFAN_ACCESS')?strtolower(PSI_SENSOR_SPEEDFAN_ACCESS):'command') { |
if ((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_SPEEDFAN_ACCESS')?strtolower(PSI_SENSOR_SPEEDFAN_ACCESS):'command') { |
case 'command': |
if (CommonFunctions::executeProgram("SpeedFanGet.exe", "", $buffer, PSI_DEBUG) && (strlen($buffer) > 0)) { |
if (preg_match("/^Temperatures:\s+(.+)$/m", $buffer, $out)) { |
/web/acc/phpsysinfo/includes/mb/class.thermalzone.inc.php |
---|
27,18 → 27,34 |
public function __construct() |
{ |
parent::__construct(); |
if (PSI_OS == 'WINNT') { |
$_wmi = null; |
try { |
// initialize the wmi object |
$objLocator = new COM('WbemScripting.SWbemLocator'); |
$_wmi = $objLocator->ConnectServer('', 'root\WMI'); |
} catch (Exception $e) { |
$this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for ThermalZone data."); |
switch (defined('PSI_SENSOR_THERMALZONE_ACCESS')?strtolower(PSI_SENSOR_THERMALZONE_ACCESS):'command') { |
case 'command': |
if ((PSI_OS == 'WINNT') || defined('PSI_EMU_HOSTNAME')) { |
if (defined('PSI_EMU_HOSTNAME') || CommonFunctions::isAdmin()) { |
$_wmi = CommonFunctions::initWMI('root\WMI', true); |
if ($_wmi) { |
$this->_buf = CommonFunctions::getWMI($_wmi, 'MSAcpi_ThermalZoneTemperature', array('InstanceName', 'CriticalTripPoint', 'CurrentTemperature')); |
} |
} else { |
$this->error->addError("Error reading data from thermalzone sensor", "Allowed only for systems with administrator privileges (run as administrator)"); |
} |
} |
if ($_wmi) { |
$this->_buf = CommonFunctions::getWMI($_wmi, 'MSAcpi_ThermalZoneTemperature', array('InstanceName', 'CriticalTripPoint', 'CurrentTemperature')); |
break; |
case 'data': |
if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::rfts(PSI_APP_ROOT.'/data/thermalzone.txt', $lines, 0, 4096, false)) { //output of "wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CriticalTripPoint,CurrentTemperature,InstanceName" |
$lines = trim(preg_replace('/[\x00-\x09\x0b-\x1F]/', '', $lines)); |
$lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
if ((($clines=count($lines)) > 1) && preg_match("/CriticalTripPoint\s+CurrentTemperature\s+InstanceName/i", $lines[0])) for ($i = 1; $i < $clines; $i++) { |
$values = preg_split("/\s+/", trim($lines[$i]), -1, PREG_SPLIT_NO_EMPTY); |
if (count($values)==3) { |
$this->_buf[] = array('CriticalTripPoint'=>trim($values[0]), 'CurrentTemperature'=>trim($values[1]), 'InstanceName'=>trim($values[2])); |
} |
} |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_thermalzone] ACCESS'); |
break; |
} |
} |
49,7 → 65,9 |
*/ |
private function _temperature() |
{ |
if (PSI_OS == 'WINNT') { |
$mode = defined('PSI_SENSOR_THERMALZONE_ACCESS')?strtolower(PSI_SENSOR_THERMALZONE_ACCESS):'command'; |
if ((($mode == 'command') && ((PSI_OS == 'WINNT') || defined('PSI_EMU_HOSTNAME'))) |
|| (($mode == 'data') && !defined('PSI_EMU_HOSTNAME'))) { |
if ($this->_buf) foreach ($this->_buf as $buffer) { |
if (isset($buffer['CurrentTemperature']) && (($value = ($buffer['CurrentTemperature'] - 2732)/10) > -100)) { |
$dev = new SensorDevice(); |
65,7 → 83,7 |
$this->mbinfo->setMbTemp($dev); |
} |
} |
} else { |
} elseif (($mode == 'command') && (PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) { |
$notwas = true; |
$thermalzones = glob('/sys/class/thermal/thermal_zone*/'); |
if (is_array($thermalzones) && (count($thermalzones) > 0)) foreach ($thermalzones as $thermalzone) { |
/web/acc/phpsysinfo/includes/mb/class.thinkpad.inc.php |
---|
23,11 → 23,18 |
*/ |
public function build() |
{ |
if (PSI_OS == 'Linux') { |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$hwpaths = glob("/sys/devices/platform/thinkpad_hwmon/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) == 1)) { |
$this->_temperature($hwpaths[0]); |
$this->_fans($hwpaths[0]); |
$hwpaths2 = glob("/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon*/", GLOB_NOSORT); |
if (is_array($hwpaths2) && (count($hwpaths2) > 0)) { |
$hwpaths = array_merge($hwpaths, $hwpaths2); |
} |
$totalh = count($hwpaths); |
for ($h = 0; $h < $totalh; $h++) { |
$this->_temperature($hwpaths[$h]); |
$this->_fans($hwpaths[$h]); |
} |
} |
} |
} |
/web/acc/phpsysinfo/includes/os/class.BSDCommon.inc.php |
---|
175,7 → 175,7 |
protected function readdmesg() |
{ |
if ($this->_dmesg === null) { |
if ((PSI_OS != "Darwin") && (CommonFunctions::rfts('/var/run/dmesg.boot', $buf, 0, 4096, false) || CommonFunctions::rfts('/var/log/dmesg.boot', $buf, 0, 4096, false) || CommonFunctions::rfts('/var/run/dmesg.boot', $buf))) { // Once again but with debug |
if ((PSI_OS != 'Darwin') && (CommonFunctions::rfts('/var/run/dmesg.boot', $buf, 0, 4096, false) || CommonFunctions::rfts('/var/log/dmesg.boot', $buf, 0, 4096, false) || CommonFunctions::rfts('/var/run/dmesg.boot', $buf))) { // Once again but with debug |
$parts = preg_split("/rebooting|Uptime/", $buf, -1, PREG_SPLIT_NO_EMPTY); |
$this->_dmesg = preg_split("/\n/", $parts[count($parts) - 1], -1, PREG_SPLIT_NO_EMPTY); |
} else { |
247,21 → 247,38 |
$s = preg_replace('/{ /', '', $s); |
$s = preg_replace('/ }/', '', $s); |
$this->sys->setLoad($s); |
if (PSI_LOAD_BAR && (PSI_OS != "Darwin")) { |
if ($fd = $this->grabkey('kern.cp_time')) { |
// Find out the CPU load |
// user + sys = load |
// total = total |
preg_match($this->_CPURegExp2, $fd, $res); |
$load = $res[2] + $res[3] + $res[4]; // cpu.user + cpu.sys |
$total = $res[2] + $res[3] + $res[4] + $res[5]; // cpu.total |
// we need a second value, wait 1 second befor getting (< 1 second no good value will occour) |
sleep(1); |
$fd = $this->grabkey('kern.cp_time'); |
preg_match($this->_CPURegExp2, $fd, $res); |
$load2 = $res[2] + $res[3] + $res[4]; |
$total2 = $res[2] + $res[3] + $res[4] + $res[5]; |
$this->sys->setLoadPercent((100 * ($load2 - $load)) / ($total2 - $total)); |
if (PSI_LOAD_BAR) { |
if (PSI_OS != 'Darwin') { |
if ($fd = $this->grabkey('kern.cp_time')) { |
// Find out the CPU load |
// user + sys = load |
// total = total |
if (preg_match($this->_CPURegExp2, $fd, $res) && (sizeof($res) > 4)) { |
$load = $res[2] + $res[3] + $res[4]; // cpu.user + cpu.sys |
$total = $res[2] + $res[3] + $res[4] + $res[5]; // cpu.total |
// we need a second value, wait 1 second befor getting (< 1 second no good value will occour) |
sleep(1); |
$fd = $this->grabkey('kern.cp_time'); |
if (preg_match($this->_CPURegExp2, $fd, $res) && (sizeof($res) > 4)) { |
$load2 = $res[2] + $res[3] + $res[4]; |
$total2 = $res[2] + $res[3] + $res[4] + $res[5]; |
$this->sys->setLoadPercent((100 * ($load2 - $load)) / ($total2 - $total)); |
} |
} |
} |
} else { |
$ncpu = $this->grabkey('hw.ncpu'); |
if (!is_null($ncpu) && (trim($ncpu) != "") && ($ncpu >= 1) && CommonFunctions::executeProgram('ps', "-A -o %cpu", $pstable, false) && !empty($pstable)) { |
$pslines = preg_split("/\n/", $pstable, -1, PREG_SPLIT_NO_EMPTY); |
if (!empty($pslines) && (count($pslines)>1) && (trim($pslines[0])==="%CPU")) { |
array_shift($pslines); |
$sum = 0; |
foreach ($pslines as $psline) { |
$sum+=trim($psline); |
} |
$this->sys->setLoadPercent(min($sum/$ncpu, 100)); |
} |
} |
} |
} |
} |
275,7 → 292,7 |
{ |
$dev = new CpuDevice(); |
if (PSI_OS == "NetBSD") { |
if (PSI_OS == 'NetBSD') { |
if ($model = $this->grabkey('machdep.cpu_brand')) { |
$dev->setModel($model); |
} |
290,7 → 307,7 |
$notwas = true; |
foreach ($this->readdmesg() as $line) { |
if ($notwas) { |
if (preg_match($this->_CPURegExp1, $line, $ar_buf)) { |
if (preg_match($this->_CPURegExp1, $line, $ar_buf) && (sizeof($ar_buf) > 2)) { |
if ($dev->getCpuSpeed() === 0) { |
$dev->setCpuSpeed(round($ar_buf[2])); |
} |
329,11 → 346,11 |
protected function scsi() |
{ |
foreach ($this->readdmesg() as $line) { |
if (preg_match($this->_SCSIRegExp1, $line, $ar_buf)) { |
if (preg_match($this->_SCSIRegExp1, $line, $ar_buf) && (sizeof($ar_buf) > 2)) { |
$dev = new HWDevice(); |
$dev->setName($ar_buf[1].": ".trim($ar_buf[2])); |
$this->sys->setScsiDevices($dev); |
} elseif (preg_match($this->_SCSIRegExp2, $line, $ar_buf)) { |
} elseif (preg_match($this->_SCSIRegExp2, $line, $ar_buf) && (sizeof($ar_buf) > 1)) { |
/* duplication security */ |
$notwas = true; |
foreach ($this->sys->getScsiDevices() as $finddev) { |
341,7 → 358,7 |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) { |
if (isset($ar_buf[3]) && ($ar_buf[3]==="G")) { |
$finddev->setCapacity($ar_buf[2] * 1024 * 1024 * 1024); |
} else { |
} elseif (isset($ar_buf[2])) { |
$finddev->setCapacity($ar_buf[2] * 1024 * 1024); |
} |
} |
355,13 → 372,13 |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) { |
if (isset($ar_buf[3]) && ($ar_buf[3]==="G")) { |
$dev->setCapacity($ar_buf[2] * 1024 * 1024 * 1024); |
} else { |
} elseif (isset($ar_buf[2])) { |
$dev->setCapacity($ar_buf[2] * 1024 * 1024); |
} |
} |
$this->sys->setScsiDevices($dev); |
} |
} elseif (preg_match($this->_SCSIRegExp3, $line, $ar_buf)) { |
} elseif (preg_match($this->_SCSIRegExp3, $line, $ar_buf) && (sizeof($ar_buf) > 1)) { |
/* duplication security */ |
$notwas = true; |
foreach ($this->sys->getScsiDevices() as $finddev) { |
368,7 → 385,7 |
if ($notwas && (substr($finddev->getName(), 0, strpos($finddev->getName(), ': ')) == $ar_buf[1])) { |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS |
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) { |
$finddev->setSerial(trim($ar_buf[2])); |
if (isset($ar_buf[2])) $finddev->setSerial(trim($ar_buf[2])); |
} |
$notwas = false; |
break; |
379,7 → 396,7 |
$dev->setName($ar_buf[1]); |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS |
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) { |
$dev->setSerial(trim($ar_buf[2])); |
if (isset($ar_buf[2])) $dev->setSerial(trim($ar_buf[2])); |
} |
$this->sys->setScsiDevices($dev); |
} |
448,11 → 465,11 |
{ |
if ((!$results = Parser::lspci(false)) && (!$results = $this->pciconf())) { |
foreach ($this->readdmesg() as $line) { |
if (preg_match($this->_PCIRegExp1, $line, $ar_buf)) { |
if (preg_match($this->_PCIRegExp1, $line, $ar_buf) && (sizeof($ar_buf) > 2)) { |
$dev = new HWDevice(); |
$dev->setName($ar_buf[1].": ".$ar_buf[2]); |
$results[] = $dev; |
} elseif (preg_match($this->_PCIRegExp2, $line, $ar_buf)) { |
} elseif (preg_match($this->_PCIRegExp2, $line, $ar_buf) && (sizeof($ar_buf) > 2)) { |
$dev = new HWDevice(); |
$dev->setName($ar_buf[1].": ".$ar_buf[2]); |
$results[] = $dev; |
592,7 → 609,19 |
*/ |
protected function usb() |
{ |
foreach ($this->readdmesg() as $line) { |
$notwas = true; |
if ((PSI_OS == 'FreeBSD') && CommonFunctions::executeProgram('usbconfig', '', $bufr, false)) { |
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($lines as $line) { |
if (preg_match('/^(ugen[0-9]+\.[0-9]+): <([^,]*)(.*)> at (usbus[0-9]+)/', $line, $ar_buf)) { |
$notwas = false; |
$dev = new HWDevice(); |
$dev->setName($ar_buf[2]); |
$this->sys->setUSBDevices($dev); |
} |
} |
} |
if ($notwas) foreach ($this->readdmesg() as $line) { |
// if (preg_match('/^(ugen[0-9\.]+): <(.*)> (.*) (.*)/', $line, $ar_buf)) { |
// $dev->setName($ar_buf[1].": ".$ar_buf[2]); |
if (preg_match('/^(u[a-z]+[0-9]+): <([^,]*)(.*)> on (usbus[0-9]+)/', $line, $ar_buf)) { |
/web/acc/phpsysinfo/includes/os/class.Darwin.inc.php |
---|
325,14 → 325,16 |
$swap1 = preg_split('/M/', $swapBuff); |
$swap2 = preg_split('/=/', $swap1[1]); |
$swap3 = preg_split('/=/', $swap1[2]); |
$dev = new DiskDevice(); |
$dev->setName('SWAP'); |
$dev->setMountPoint('SWAP'); |
$dev->setFsType('swap'); |
$dev->setTotal($swap1[0] * 1024 * 1024); |
$dev->setUsed($swap2[1] * 1024 * 1024); |
$dev->setFree($swap3[1] * 1024 * 1024); |
$this->sys->setSwapDevices($dev); |
if (($swap=trim($swap1[0])) > 0) { |
$dev = new DiskDevice(); |
$dev->setName('SWAP'); |
$dev->setMountPoint('SWAP'); |
$dev->setFsType('swap'); |
$dev->setTotal($swap * 1024 * 1024); |
$dev->setUsed(trim($swap2[1]) * 1024 * 1024); |
$dev->setFree(trim($swap3[1]) * 1024 * 1024); |
$this->sys->setSwapDevices($dev); |
} |
} |
} |
} |
413,28 → 415,37 |
protected function distro() |
{ |
$this->sys->setDistributionIcon('Darwin.png'); |
if (!CommonFunctions::executeProgram('system_profiler', 'SPSoftwareDataType', $buffer, PSI_DEBUG)) { |
if ((!CommonFunctions::executeProgram('system_profiler', 'SPSoftwareDataType', $buffer, PSI_DEBUG) || !preg_match('/\n\s*System Version:/', $buffer)) |
&& (!CommonFunctions::executeProgram('sw_vers', '', $buffer, PSI_DEBUG) || !preg_match('/^ProductName:/', $buffer))) { |
parent::distro(); |
} else { |
$arrBuff = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($arrBuff as $line) { |
$arrLine = preg_split("/:/", $line, -1, PREG_SPLIT_NO_EMPTY); |
if (trim($arrLine[0]) === "System Version") { |
$distro = trim($arrLine[1]); |
if (preg_match('/^Mac OS|^OS X|^macOS/', $distro)) { |
$this->sys->setDistributionIcon('Apple.png'); |
if (preg_match('/(^Mac OS X Server|^Mac OS X|^OS X Server|^OS X|^macOS Server|^macOS) (\d+\.\d+)/', $distro, $ver) |
&& ($list = @parse_ini_file(PSI_APP_ROOT."/data/osnames.ini", true)) |
&& isset($list['OS X'][$ver[2]])) { |
$distro.=' '.$list['OS X'][$ver[2]]; |
$distro_tmp = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($distro_tmp as $info) { |
$info_tmp = preg_split('/:/', $info, 2); |
if (isset($distro_tmp[0]) && !is_null($distro_tmp[0]) && (trim($distro_tmp[0]) != "") && |
isset($distro_tmp[1]) && !is_null($distro_tmp[1]) && (trim($distro_tmp[1]) != "")) { |
$distro_arr[trim($info_tmp[0])] = trim($info_tmp[1]); |
} |
} |
if (isset($distro_arr['ProductName']) && isset($distro_arr['ProductVersion']) && isset($distro_arr['BuildVersion'])) { |
$distro_arr['System Version'] = $distro_arr['ProductName'].' '.$distro_arr['ProductVersion'].' ('.$distro_arr['BuildVersion'].')'; |
} |
if (isset($distro_arr['System Version'])) { |
$distro = $distro_arr['System Version']; |
if (preg_match('/^Mac OS|^OS X|^macOS/', $distro)) { |
$this->sys->setDistributionIcon('Apple.png'); |
if (preg_match('/(^Mac OS X Server|^Mac OS X|^OS X Server|^OS X|^macOS Server|^macOS) ((\d+)\.\d+)/', $distro, $ver) |
&& ($list = @parse_ini_file(PSI_APP_ROOT."/data/osnames.ini", true))) { |
if (isset($list['macOS'][$ver[2]])) { |
$distro.=' '.$list['macOS'][$ver[2]]; |
} elseif (isset($list['macOS'][$ver[3]])) { |
$distro.=' '.$list['macOS'][$ver[3]]; |
} |
} |
$this->sys->setDistribution($distro); |
return; |
} |
$this->sys->setDistribution($distro); |
} else { |
parent::distro(); |
} |
} |
} |
/web/acc/phpsysinfo/includes/os/class.FreeBSD.inc.php |
---|
133,9 → 133,16 |
*/ |
private function _distroicon() |
{ |
if (extension_loaded('pfSense') && CommonFunctions::rfts('/etc/version', $version, 1, 4096, false) && (trim($version) != '')) { // pfSense detection |
$this->sys->setDistribution('pfSense '. trim($version)); |
$this->sys->setDistributionIcon('pfSense.png'); |
if (CommonFunctions::rfts('/etc/version', $version, 1, 4096, false) && (($version=trim($version)) != '')) { |
if (extension_loaded('pfSense')) { // pfSense detection |
$this->sys->setDistribution('pfSense '. $version); |
$this->sys->setDistributionIcon('pfSense.png'); |
} elseif (preg_match('/^FreeNAS/i', $version)) { // FreeNAS detection |
$this->sys->setDistribution($version); |
$this->sys->setDistributionIcon('FreeNAS.png'); |
} else { |
$this->sys->setDistributionIcon('FreeBSD.png'); |
} |
} else { |
$this->sys->setDistributionIcon('FreeBSD.png'); |
} |
/web/acc/phpsysinfo/includes/os/class.Haiku.inc.php |
---|
45,12 → 45,12 |
$dev->setModel($ar_buf[1]); |
$arrLines = preg_split("/\n/", $cpu, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($arrLines as $Line) { |
if (preg_match("/^\s+Data TLB:\s+(.*)K-byte/", $Line, $Line_buf)) { |
$dev->setCache(max($Line_buf[1]*1024, $dev->getCache())); |
} elseif (preg_match("/^\s+Data TLB:\s+(.*)M-byte/", $Line, $Line_buf)) { |
$dev->setCache(max($Line_buf[1]*1024*1024, $dev->getCache())); |
} elseif (preg_match("/^\s+Data TLB:\s+(.*)G-byte/", $Line, $Line_buf)) { |
$dev->setCache(max($Line_buf[1]*1024*1024*1024, $dev->getCache())); |
if (preg_match("/^\s+Data TLB:\s+(.*)K-byte/", $Line, $Line_buf) || preg_match("/^\s+L0 Data TLB:\s+(.*)K-byte/", $Line, $Line_buf)) { |
$dev->setCache(max(intval($Line_buf[1])*1024, $dev->getCache())); |
} elseif (preg_match("/^\s+Data TLB:\s+(.*)M-byte/", $Line, $Line_buf) || preg_match("/^\s+L0 Data TLB:\s+(.*)M-byte/", $Line, $Line_buf)) { |
$dev->setCache(max(intval($Line_buf[1])*1024*1024, $dev->getCache())); |
} elseif (preg_match("/^\s+Data TLB:\s+(.*)G-byte/", $Line, $Line_buf) || preg_match("/^\s+L0 Data TLB:\s+(.*)G-byte/", $Line, $Line_buf)) { |
$dev->setCache(max(intval($Line_buf[1])*1024*1024*1024, $dev->getCache())); |
} elseif (preg_match("/\s+VMX/", $Line, $Line_buf)) { |
$dev->setVirt("vmx"); |
} elseif (preg_match("/\s+SVM/", $Line, $Line_buf)) { |
156,19 → 156,28 |
*/ |
private function _uptime() |
{ |
if (CommonFunctions::executeProgram('uptime', '-u', $buf)) { |
if (preg_match("/^up (\d+) minute[s]?/", $buf, $ar_buf)) { |
$min = $ar_buf[1]; |
$this->sys->setUptime($min * 60); |
} elseif (preg_match("/^up (\d+) hour[s]?, (\d+) minute[s]?/", $buf, $ar_buf)) { |
if (CommonFunctions::executeProgram('uptime', '', $buf)) { |
if (preg_match("/up (\d+) day[s]?,[ ]+(\d+):(\d+),/", $buf, $ar_buf)) { |
$min = $ar_buf[3]; |
$hours = $ar_buf[2]; |
$days = $ar_buf[1]; |
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60); |
} elseif (preg_match("/up[ ]+(\d+):(\d+),/", $buf, $ar_buf)) { |
$min = $ar_buf[2]; |
$hours = $ar_buf[1]; |
$this->sys->setUptime($hours * 3600 + $min * 60); |
} elseif (preg_match("/^up (\d+) day[s]?, (\d+) hour[s]?, (\d+) minute[s]?/", $buf, $ar_buf)) { |
} elseif (preg_match("/up (\d+) day[s]?, (\d+) hour[s]?, (\d+) minute[s]?$/", $buf, $ar_buf)) { |
$min = $ar_buf[3]; |
$hours = $ar_buf[2]; |
$days = $ar_buf[1]; |
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60); |
} elseif (preg_match("/up (\d+) hour[s]?, (\d+) minute[s]?$/", $buf, $ar_buf)) { |
$min = $ar_buf[2]; |
$hours = $ar_buf[1]; |
$this->sys->setUptime($hours * 3600 + $min * 60); |
} elseif (preg_match("/up (\d+) minute[s]?$/", $buf, $ar_buf)) { |
$min = $ar_buf[1]; |
$this->sys->setUptime($min * 60); |
} |
} |
} |
231,7 → 240,7 |
if (preg_match("/(.*)bytes free\s+\(used\/max\s+(.*)\s+\/\s+(.*)\)\s*\n\s+\(cached\s+(.*)\)/", $bufr, $ar_buf)) { |
$this->sys->setMemTotal($ar_buf[3]); |
$this->sys->setMemFree($ar_buf[1]); |
$this->sys->setMemCache($ar_buf[4]); |
$this->sys->setMemCache(min($ar_buf[4], $ar_buf[2])); |
$this->sys->setMemUsed($ar_buf[2]); |
} |
} |
/web/acc/phpsysinfo/includes/os/class.Linux.inc.php |
---|
29,7 → 29,7 |
/** |
* Assoc array of all CPUs loads. |
*/ |
protected $_cpu_loads; |
private $_cpu_loads = null; |
/** |
* Machine |
75,7 → 75,7 |
} |
if ($machine != "") { |
$machine = trim(preg_replace("/^\/,?/", "", preg_replace("/ ?(To be filled by O\.E\.M\.|System manufacturer|System Product Name|Not Specified) ?/i", "", $machine))); |
$machine = trim(preg_replace("/^\/,?/", "", preg_replace("/ ?(To be filled by O\.E\.M\.|System manufacturer|System Product Name|Not Specified|Default string) ?/i", "", $machine))); |
} |
if (CommonFunctions::fileexists($filename="/etc/config/uLinux.conf") // QNAP detection |
138,7 → 138,7 |
if (CommonFunctions::executeProgram($uname, '-m', $strBuf, PSI_DEBUG)) { |
$result .= ' '.$strBuf; |
} |
} elseif (CommonFunctions::rfts('/proc/version', $strBuf, 1) && preg_match('/version\s+(\S+)/', $strBuf, $ar_buf)) { |
} elseif (CommonFunctions::rfts('/proc/version', $strBuf, 1) && preg_match('/version\s+(\S+)/', $strBuf, $ar_buf)) { |
$result = $ar_buf[1]; |
if (preg_match('/SMP/', $strBuf)) { |
$result .= ' (SMP)'; |
154,9 → 154,12 |
$result .= ' [docker]'; |
} |
} |
if (CommonFunctions::rfts('/proc/version', $strBuf2, 1, 4096, false) |
&& preg_match('/^Linux version [\d\.-]+-Microsoft/', $strBuf2)) { |
$result .= ' [lxss]'; |
if (CommonFunctions::rfts('/proc/version', $strBuf2, 1, 4096, false)) { |
if (preg_match('/^Linux version [\d\.-]+-Microsoft/', $strBuf2)) { |
$result .= ' [wsl]'; |
} elseif (preg_match('/^Linux version [\d\.-]+-microsoft-standard/', $strBuf2)) { |
$result .= ' [wsl2]'; |
} |
} |
$this->sys->setKernel($result); |
} |
228,7 → 231,7 |
$this->_cpu_loads = array(); |
$cpu_tmp = array(); |
if (CommonFunctions::rfts('/proc/stat', $buf)) { |
if (CommonFunctions::rfts('/proc/stat', $buf, 0, 4096, PSI_DEBUG && (PSI_OS != 'Android'))) { |
if (preg_match_all('/^(cpu[0-9]*) (.*)/m', $buf, $matches, PREG_SET_ORDER)) { |
foreach ($matches as $line) { |
$cpu = $line[1]; |
249,7 → 252,7 |
// we need a second value, wait 1 second befor getting (< 1 second no good value will occour) |
sleep(1); |
if (CommonFunctions::rfts('/proc/stat', $buf)) { |
if (CommonFunctions::rfts('/proc/stat', $buf, 0, 4096, PSI_DEBUG)) { |
if (preg_match_all('/^(cpu[0-9]*) (.*)/m', $buf, $matches, PREG_SET_ORDER)) { |
foreach ($matches as $line) { |
$cpu = $line[1]; |
279,7 → 282,7 |
if (isset($this->_cpu_loads[$cpuline])) { |
return $this->_cpu_loads[$cpuline]; |
} else { |
return 0; |
return null; |
} |
} |
612,13 → 615,13 |
} |
if ($booDevice) { |
$dev = new HWDevice(); |
$dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($strLine))); |
$dev->setName(preg_replace('/\(rev\s[^\)]+\)\.$/', '', trim($strLine))); |
$this->sys->setPciDevices($dev); |
/* |
list($strKey, $strValue) = preg_split('/: /', $strLine, 2); |
if (!preg_match('/bridge/i', $strKey) && !preg_match('/USB/i ', $strKey)) { |
$dev = new HWDevice(); |
$dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($strValue))); |
$dev->setName(preg_replace('/\(rev\s[^\)]+\)\.$/', '', trim($strValue))); |
$this->sys->setPciDevices($dev); |
} |
*/ |
773,6 → 776,10 |
if ($product!==null) { |
$usbarray[$usbid]['product'] = $product; |
} |
$speed = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/speed'); |
if ($product!==null) { |
$usbarray[$usbid]['speed'] = $speed; |
} |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS |
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) { |
$serial = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/serial'); |
785,12 → 792,16 |
} |
} |
if ((count($usbarray) == 0) && CommonFunctions::rfts('/proc/bus/usb/devices', $bufr, 0, 4096, false)) { |
if ((count($usbarray) == 0) && CommonFunctions::rfts('/proc/bus/usb/devices', $bufr, 0, 4096, false)) { //usb-devices |
$devnum = -1; |
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($bufe as $buf) { |
if (preg_match('/^T/', $buf)) { |
$devnum++; |
if (preg_match('/\sSpd=([\d\.]+)/', $buf, $bufr) |
&& isset($bufr[1]) && ($bufr[1]!=="")) { |
$usbarray[$devnum]['speed'] = $bufr[1]; |
} |
} elseif (preg_match('/^S:/', $buf)) { |
list($key, $value) = preg_split('/: /', $buf, 2); |
list($key, $value2) = preg_split('/=/', $value, 2); |
859,10 → 870,14 |
$product = ''; |
} |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS |
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL |
&& isset($usbdev['serial'])) { |
$dev->setSerial($usbdev['serial']); |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) { |
if (isset($usbdev['speed'])) { |
$dev->setSpeed($usbdev['speed']); |
} |
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL |
&& isset($usbdev['serial'])) { |
$dev->setSerial($usbdev['serial']); |
} |
} |
if (isset($usbdev['name']) && (($name=$usbdev['name']) !== 'unknown')) { |
1007,9 → 1022,8 |
if (preg_match('/\s+encap:Ethernet\s+HWaddr\s(\S+)/i', $buf2, $ar_buf2) |
|| preg_match('/\s+encap:UNSPEC\s+HWaddr\s(\S+)-00-00-00-00-00-00-00-00-00-00\s*$/i', $buf2, $ar_buf2) |
|| preg_match('/^\s+ether\s+(\S+)\s+txqueuelen/i', $buf2, $ar_buf2) |
|| preg_match('/^\s+link\/ether\s+(\S+)\s+brd/i', $buf2, $ar_buf2) |
|| preg_match('/^\s+link\/ether\s+(\S+)$/i', $buf2, $ar_buf2) |
|| preg_match('/^\s+link\/ieee802.11\s+(\S+)$/i', $buf2, $ar_buf2)) { |
|| preg_match('/^\s+link\/\S+\s+(\S+)\s+brd/i', $buf2, $ar_buf2) |
|| preg_match('/^\s+link\/\S+\s+(\S+)$/i', $buf2, $ar_buf2)) { |
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) { |
$macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1])); |
if ($macaddr === '00-00-00-00-00-00') { // empty |
1038,7 → 1052,8 |
if ($macaddr != "") { |
$dev->setInfo($macaddr.($dev->getInfo()?';'.$dev->getInfo():'')); |
} |
if (CommonFunctions::rfts('/sys/class/net/'.trim($dev_name).'/speed', $buf, 1, 4096, false) && (($speed=trim($buf))!="") && ($buf > 0) && ($buf < 65535)) { |
if ((!CommonFunctions::rfts('/sys/class/net/'.trim($dev_name).'/operstate', $buf, 1, 4096, false) || (($down=strtolower(trim($buf)))=="") || ($down!=="down")) && |
(CommonFunctions::rfts('/sys/class/net/'.trim($dev_name).'/speed', $buf, 1, 4096, false) && (($speed=trim($buf))!="") && ($buf > 0) && ($buf < 65535))) { |
if ($speed > 1000) { |
$speed = $speed/1000; |
$unit = "G"; |
1085,8 → 1100,8 |
} |
$was = true; |
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) { |
if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/speed', $buf, 1, 4096, false) && (trim($buf)!="")) { |
$speed = trim($buf); |
if ((!CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/operstate', $buf, 1, 4096, false) || (($down=strtolower(trim($buf)))=="") || ($down!=="down")) && |
(CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/speed', $buf, 1, 4096, false) && (($speed=trim($buf))!="") && ($buf > 0) && ($buf < 65535))) { |
if ($speed > 1000) { |
$speed = $speed/1000; |
$unit = "G"; |
1093,8 → 1108,8 |
} else { |
$unit = "M"; |
} |
if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/duplex', $buf, 1, 4096, false) && (trim($buf)!="")) { |
$speedinfo = $speed.$unit.'b/s '.strtolower(trim($buf)); |
if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/duplex', $buf, 1, 4096, false) && (($duplex=strtolower(trim($buf)))!="") && ($duplex!='unknown')) { |
$speedinfo = $speed.$unit.'b/s '.$duplex; |
} else { |
$speedinfo = $speed.$unit.'b/s'; |
} |
1103,7 → 1118,8 |
} else { |
if ($was) { |
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) { |
if (preg_match('/^\s+link\/ether\s+(\S+)\s+brd/i', $line, $ar_buf2)) { |
if (preg_match('/^\s+link\/\S+\s+(\S+)\s+brd/i', $line, $ar_buf2) |
|| preg_match('/^\s+link\/\S+\s+(\S+)$/i', $line, $ar_buf2)) { |
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1])); |
} elseif (preg_match('/^\s+inet\s+([^\/\s]+).*peer\s+([^\/\s]+).*\s+scope\s((global)|(host))/i', $line, $ar_buf2)) { |
if ($ar_buf2[1] != $ar_buf2[2]) { |
1157,8 → 1173,8 |
$dev->setName($ar_buf[1]); |
$was = true; |
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) { |
if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/speed', $buf, 1, 4096, false) && (trim($buf)!="")) { |
$speed = trim($buf); |
if ((!CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/operstate', $buf, 1, 4096, false) || (($down=strtolower(trim($buf)))=="") || ($down!=="down")) && |
(CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/speed', $buf, 1, 4096, false) && (($speed=trim($buf))!="") && ($buf > 0) && ($buf < 65535))) { |
if ($speed > 1000) { |
$speed = $speed/1000; |
$unit = "G"; |
1165,15 → 1181,21 |
} else { |
$unit = "M"; |
} |
if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/duplex', $buf, 1, 4096, false) && (trim($buf)!="")) { |
$speedinfo = $speed.$unit.'b/s '.strtolower(trim($buf)); |
if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/duplex', $buf, 1, 4096, false) && (($duplex=strtolower(trim($buf)))!="") && ($duplex!='unknown')) { |
$speedinfo = $speed.$unit.'b/s '.$duplex; |
} else { |
$speedinfo = $speed.$unit.'b/s'; |
} |
} |
if (preg_match('/^'.$ar_buf[1].'\s+Link\sencap:Ethernet\s+HWaddr\s(\S+)/i', $line, $ar_buf2)) |
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1])); |
elseif (preg_match('/^'.$ar_buf[1].':\s+ip\s+(\S+)\s+mask/i', $line, $ar_buf2)) |
if (preg_match('/^'.$ar_buf[1].'\s+Link\sencap:Ethernet\s+HWaddr\s(\S+)/i', $line, $ar_buf2) |
|| preg_match('/^'.$ar_buf[1].'\s+Link\s+encap:UNSPEC\s+HWaddr\s(\S+)-00-00-00-00-00-00-00-00-00-00\s*$/i', $line, $ar_buf2)) { |
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) { |
$macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1])); |
if ($macaddr === '00-00-00-00-00-00') { // empty |
$macaddr = ""; |
} |
} |
} elseif (preg_match('/^'.$ar_buf[1].':\s+ip\s+(\S+)\s+mask/i', $line, $ar_buf2)) |
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]); |
} |
} else { |
1195,8 → 1217,14 |
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) { |
if (preg_match('/\s+encap:Ethernet\s+HWaddr\s(\S+)/i', $line, $ar_buf2) |
|| preg_match('/\s+encap:UNSPEC\s+HWaddr\s(\S+)-00-00-00-00-00-00-00-00-00-00\s*$/i', $line, $ar_buf2) |
|| preg_match('/^\s+ether\s+(\S+)\s+txqueuelen/i', $line, $ar_buf2)) { |
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1])); |
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) { |
$macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1])); |
if ($macaddr === '00-00-00-00-00-00') { // empty |
$macaddr = ""; |
} |
} |
} elseif (preg_match('/^\s+inet\saddr:(\S+)\s+P-t-P:(\S+)/i', $line, $ar_buf2) |
|| preg_match('/^\s+inet\s+(\S+)\s+netmask.+destination\s+(\S+)/i', $line, $ar_buf2)) { |
if ($ar_buf2[1] != $ar_buf2[2]) { |
/web/acc/phpsysinfo/includes/os/class.OS.inc.php |
---|
132,9 → 132,9 |
*/ |
protected function _ip() |
{ |
if (PSI_USE_VHOST === true) { |
if ((PSI_USE_VHOST === true) && !defined('PSI_EMU_HOSTNAME')) { |
if ((CommonFunctions::readenv('SERVER_ADDR', $result) || CommonFunctions::readenv('LOCAL_ADDR', $result)) //is server address defined |
&& !strstr($result, '.') && strstr($result, ':')) { //is IPv6, quick version of preg_match('/\(([[0-9A-Fa-f\:]+)\)/', $result) |
&& !strstr($result, '.') && strstr($result, ':')) { //is IPv6, quick version of preg_match('/\(([[0-9A-Fa-f\:]+)\)/', $result) |
$dnsrec = dns_get_record($this->sys->getHostname(), DNS_AAAA); |
if (isset($dnsrec[0]['ipv6'])) { //is DNS IPv6 record |
$this->sys->setIp($dnsrec[0]['ipv6']); //from DNS (avoid IPv6 NAT translation) |
144,16 → 144,131 |
} else { |
$this->sys->setIp(gethostbyname($this->sys->getHostname())); //IPv4 only |
} |
} elseif (((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) && (CommonFunctions::readenv('SERVER_ADDR', $result) || CommonFunctions::readenv('LOCAL_ADDR', $result))) { |
$this->sys->setIp(preg_replace('/^::ffff:/i', '', $result)); |
} else { |
if (CommonFunctions::readenv('SERVER_ADDR', $result) || CommonFunctions::readenv('LOCAL_ADDR', $result)) { |
$this->sys->setIp(preg_replace('/^::ffff:/i', '', $result)); |
//$this->sys->setIp(gethostbyname($this->sys->getHostname())); |
$hn = $this->sys->getHostname(); |
$ghbn = gethostbyname($hn); |
if (defined('PSI_EMU_HOSTNAME') && ($hn === $ghbn)) { |
$this->sys->setIp(PSI_EMU_HOSTNAME); |
} else { |
$this->sys->setIp(gethostbyname($this->sys->getHostname())); |
$this->sys->setIp($ghbn); |
} |
} |
} |
/** |
* MEM information from dmidecode |
* |
* @return void |
*/ |
protected function _dmimeminfo() |
{ |
$banks = array(); |
$buffer = ''; |
if (defined('PSI_DMIDECODE_ACCESS') && (strtolower(PSI_DMIDECODE_ACCESS)=="data")) { |
CommonFunctions::rfts(PSI_APP_ROOT.'/data/dmidecode.txt', $buffer); |
} elseif (CommonFunctions::_findProgram('dmidecode')) { |
CommonFunctions::executeProgram('dmidecode', '-t 17', $buffer, PSI_DEBUG); |
} |
if (!empty($buffer)) { |
$banks = preg_split('/^(?=Handle\s)/m', $buffer, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($banks as $bank) if (preg_match('/^Handle\s/', $bank)) { |
$lines = preg_split("/\n/", $bank, -1, PREG_SPLIT_NO_EMPTY); |
$mem = array(); |
foreach ($lines as $line) if (preg_match('/^\s+([^:]+):(.+)/' ,$line, $params)) { |
if (preg_match('/^0x([A-F\d]+)/', $params2 = trim($params[2]), $buff)) { |
$mem[trim($params[1])] = trim($buff[1]); |
} elseif ($params2 != '') { |
$mem[trim($params[1])] = $params2; |
} |
} |
if (isset($mem['Size']) && preg_match('/^(\d+)\s(M|G)B$/', $mem['Size'], $size) && ($size[1] > 0)) { |
$dev = new HWDevice(); |
$name = ''; |
if (isset($mem['Part Number']) && !preg_match("/^PartNum\d+$/", $part = $mem['Part Number']) && ($part != 'None') && ($part != 'N/A') && ($part != 'Not Specified') && ($part != 'NOT AVAILABLE')) { |
$name = $part; |
} |
if (isset($mem['Locator']) && (($dloc = $mem['Locator']) != 'None') && ($dloc != 'N/A') && ($dloc != 'Not Specified')) { |
if ($name != '') { |
$name .= ' - '.$dloc; |
} else { |
$name = $dloc; |
} |
} |
if (isset($mem['Bank Locator']) && (($bank = $mem['Bank Locator']) != 'None') && ($bank != 'N/A') && ($bank != 'Not Specified')) { |
if ($name != '') { |
$name .= ' in '.$bank; |
} else { |
$name = 'Physical Memory in '.$bank; |
} |
} |
if ($name != '') { |
$dev->setName(trim($name)); |
} else { |
$dev->setName('Physical Memory'); |
} |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) { |
if (isset($mem['Manufacturer']) && !preg_match("/^([A-F\d]{4}|[A-F\d]{12}|[A-F\d]{16})$/", $manufacturer = $mem['Manufacturer']) && !preg_match("/^Manufacturer\d+$/", $manufacturer) && !preg_match("/^Mfg \d+$/", $manufacturer) && !preg_match("/^JEDEC ID:/", $manufacturer) && ($manufacturer != 'None') && ($manufacturer != 'N/A') && ($manufacturer != 'Not Specified') && ($manufacturer != 'UNKNOWN')) { |
$dev->setManufacturer($manufacturer); |
} |
if ($size[2] == 'G') { |
$dev->setCapacity($size[1]*1024*1024*1024); |
} else { |
$dev->setCapacity($size[1]*1024*1024); |
} |
$memtype = ''; |
if (isset($mem['Type']) && (($type = $mem['Type']) != 'None') && ($type != 'N/A') && ($type != 'Not Specified') && ($type != 'Other') && ($type != 'Unknown') && ($type != '<OUT OF SPEC>')) { |
if (isset($mem['Speed']) && preg_match('/^(\d+)\s(MHz|MT\/s)/', $mem['Speed'], $speed) && ($speed[1] > 0) && (preg_match('/^(DDR\d*)(.*)/', $type, $dr) || preg_match('/^(SDR)AM(.*)/', $type, $dr))) { |
if (isset($mem['Minimum Voltage']) && isset($mem['Total Width']) && |
preg_match('/^([\d\.]+)\sV$/', $mem['Minimum Voltage'], $minv) && preg_match('/^([\d\.]+)\sV$/', $mem['Maximum Voltage'], $maxv) && |
($minv[1] > 0) && ($maxv[1] >0) && ($minv[1] < $maxv[1])) { |
$lv = 'L'; |
} else { |
$lv = ''; |
} |
if (isset($dr[2])) { |
$memtype = $dr[1].$lv.'-'.$speed[1].' '.$dr[2]; |
} else { |
$memtype = $dr[1].$lv.'-'.$speed[1]; |
} |
} else { |
$memtype = $type; |
} |
} |
if (isset($mem['Form Factor']) && (($form = $mem['Form Factor']) != 'None') && ($form != 'N/A') && ($form != 'Not Specified') && ($form != 'Other') && ($form != 'Unknown') && !preg_match('/ '.$form.'$/', $memtype)) { |
$memtype .= ' '.$form; |
} |
if (isset($mem['Data Width']) && isset($mem['Total Width']) && |
preg_match('/^(\d+)\sbits$/', $mem['Data Width'], $dataw) && preg_match('/^(\d+)\sbits$/', $mem['Total Width'], $totalw) && |
($dataw[1] > 0) && ($totalw[1] >0) && ($dataw[1] < $totalw[1])) { |
$memtype .= ' ECC'; |
} |
if (isset($mem['Type Detail']) && preg_match('/Registered/', $mem['Type Detail'])) { |
$memtype .= ' REG'; |
} |
if (($memtype = trim($memtype)) != '') { |
$dev->setProduct($memtype); |
} |
if (isset($mem['Configured Clock Speed']) && preg_match('/^(\d+)\s(MHz|MT\/s)$/', $mem['Configured Clock Speed'], $clock) && ($clock[1] > 0)) { |
$dev->setSpeed($clock[1]); |
} |
if (isset($mem['Configured Voltage']) && preg_match('/^([\d\.]+)\sV$/', $mem['Configured Voltage'], $voltage) && ($voltage[1] > 0)) { |
$dev->setVoltage($voltage[1]); |
} |
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && |
isset($mem['Serial Number']) && !preg_match("/^SerNum\d+$/", $serial = $mem['Serial Number']) && ($serial != 'None') && ($serial != 'Not Specified')) { |
$dev->setSerial($serial); |
} |
} |
$this->sys->setMemDevices($dev); |
} |
} |
} |
} |
/** |
* get the filled or unfilled (with default values) System object |
* |
* @see PSI_Interface_OS::getSys() |
166,6 → 281,9 |
if (!$this->blockname || $this->blockname==='vitals') { |
$this->_ip(); |
} |
if ((!$this->blockname || $this->blockname==='hardware') && (PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) { |
$this->_dmimeminfo(); |
} |
return $this->sys; |
} |
/web/acc/phpsysinfo/includes/os/class.OpenBSD.inc.php |
---|
71,8 → 71,12 |
$dev->setName($ar_buf_b[0]); |
$dev->setTxBytes($ar_buf_b[4]); |
$dev->setRxBytes($ar_buf_b[3]); |
$dev->setErrors($ar_buf_n[4] + $ar_buf_n[6]); |
$dev->setDrops($ar_buf_n[8]); |
if (sizeof($ar_buf_n) == 9) { |
$dev->setErrors($ar_buf_n[4] + $ar_buf_n[6]); |
$dev->setDrops($ar_buf_n[8]); |
} elseif (sizeof($ar_buf_n) == 8) { |
$dev->setDrops($ar_buf_n[4] + $ar_buf_n[6]); |
} |
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS) && (CommonFunctions::executeProgram('ifconfig', $ar_buf_b[0].' 2>/dev/null', $bufr2, PSI_DEBUG))) { |
$speedinfo = ""; |
$bufe2 = preg_split("/\n/", $bufr2, -1, PREG_SPLIT_NO_EMPTY); |
/web/acc/phpsysinfo/includes/os/class.SunOS.inc.php |
---|
147,17 → 147,17 |
*/ |
private function _kernel() |
{ |
if (CommonFunctions::executeProgram('uname', '-s', $os, PSI_DEBUG) && ($os!="")) { |
if (CommonFunctions::executeProgram('uname', '-r', $version, PSI_DEBUG) && ($version!="")) { |
$os.=' '.$version; |
if (CommonFunctions::executeProgram('uname', '-s', $kernel, PSI_DEBUG) && ($kernel != "")) { |
if (CommonFunctions::executeProgram('uname', '-r', $version, PSI_DEBUG) && ($version != "")) { |
$kernel.=' '.$version; |
} |
if (CommonFunctions::executeProgram('uname', '-v', $subversion, PSI_DEBUG) && ($subversion!="")) { |
$os.=' ('.$subversion.')'; |
if (CommonFunctions::executeProgram('uname', '-v', $subversion, PSI_DEBUG) && ($subversion != "")) { |
$kernel.=' ('.$subversion.')'; |
} |
if (CommonFunctions::executeProgram('uname', '-i', $platform, PSI_DEBUG) && ($platform!="")) { |
$os.=' '.$platform; |
if (CommonFunctions::executeProgram('uname', '-i', $platform, PSI_DEBUG) && ($platform != "")) { |
$kernel.=' '.$platform; |
} |
$this->sys->setKernel($os); |
$this->sys->setKernel($kernel); |
} |
} |
338,14 → 338,16 |
$this->sys->setMemTotal($this->_kstat('unix:0:system_pages:pagestotal') * $pagesize); |
$this->sys->setMemUsed($this->_kstat('unix:0:system_pages:pageslocked') * $pagesize); |
$this->sys->setMemFree($this->_kstat('unix:0:system_pages:pagesfree') * $pagesize); |
$dev = new DiskDevice(); |
$dev->setName('SWAP'); |
$dev->setFsType('swap'); |
$dev->setMountPoint('SWAP'); |
$dev->setTotal($this->_kstat('unix:0:vminfo:swap_avail') / 1024); |
$dev->setUsed($this->_kstat('unix:0:vminfo:swap_alloc') / 1024); |
$dev->setFree($this->_kstat('unix:0:vminfo:swap_free') / 1024); |
$this->sys->setSwapDevices($dev); |
if (($swap=$this->_kstat('unix:0:vminfo:swap_avail')) > 0) { |
$dev = new DiskDevice(); |
$dev->setName('SWAP'); |
$dev->setFsType('swap'); |
$dev->setMountPoint('SWAP'); |
$dev->setTotal($swap / 1024); |
$dev->setUsed($this->_kstat('unix:0:vminfo:swap_alloc') / 1024); |
$dev->setFree($this->_kstat('unix:0:vminfo:swap_free') / 1024); |
$this->sys->setSwapDevices($dev); |
} |
} |
/** |
/web/acc/phpsysinfo/includes/os/class.WINNT.inc.php |
---|
63,7 → 63,7 |
private $_systeminfo = null; |
/** |
* holds the COM object that we pull all the WMI data from |
* holds the COM object that we pull WMI root\CIMv2 data from |
* |
* @var Object |
*/ |
70,7 → 70,7 |
private $_wmi = null; |
/** |
* holds the COM object that we pull all the RegRead data from |
* holds the COM object that we pull all the EnumKey and RegRead data from |
* |
* @var Object |
*/ |
77,11 → 77,11 |
private $_reg = null; |
/** |
* holds the COM object that we pull all the EnumKey data from |
* holds result of 'cmd /c ver' |
* |
* @var Object |
* @var string |
*/ |
private $_key = null; |
private $_ver = ""; |
/** |
* holds all devices, which are in the system |
88,7 → 88,7 |
* |
* @var array |
*/ |
private $_wmidevices; |
private $_wmidevices = array(); |
/** |
* holds all disks, which are in the system |
95,7 → 95,7 |
* |
* @var array |
*/ |
private $_wmidisks; |
private $_wmidisks = array(); |
/** |
* store language encoding of the system to convert some output to utf-8 |
129,7 → 129,7 |
*/ |
private function _get_Win32_ComputerSystem() |
{ |
if ($this->_Win32_ComputerSystem === null) $this->_Win32_ComputerSystem = CommonFunctions::getWMI($this->_wmi, 'Win32_ComputerSystem', array('Name', 'Manufacturer', 'Model')); |
if ($this->_Win32_ComputerSystem === null) $this->_Win32_ComputerSystem = CommonFunctions::getWMI($this->_wmi, 'Win32_ComputerSystem', array('Name', 'Manufacturer', 'Model', 'SystemFamily')); |
return $this->_Win32_ComputerSystem; |
} |
174,8 → 174,12 |
*/ |
private function _get_systeminfo() |
{ |
if ($this->_systeminfo === null) CommonFunctions::executeProgram('systeminfo', '', $this->_systeminfo, false); |
return $this->_systeminfo; |
if (!defined('PSI_EMU_HOSTNAME')) { |
if ($this->_systeminfo === null) CommonFunctions::executeProgram('systeminfo', '', $this->_systeminfo, false); |
return $this->_systeminfo; |
} else { |
return ''; |
} |
} |
/** |
184,27 → 188,60 |
public function __construct($blockname = false) |
{ |
parent::__construct($blockname); |
try { |
// initialize the wmi object |
$objLocator = new COM('WbemScripting.SWbemLocator'); |
$this->_wmi = $objLocator->ConnectServer('', 'root\CIMv2'); |
} catch (Exception $e) { |
$this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed."); |
if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::executeProgram('cmd', '/c ver 2>nul', $ver_value, false) && (($ver_value = trim($ver_value)) !== "")) { |
$this->_ver = $ver_value; |
} |
try { |
// initialize the RegRead object |
$this->_reg = new COM("WScript.Shell"); |
} catch (Exception $e) { |
//$this->error->addError("Windows Scripting Host error", "PhpSysInfo can not initialize Windows Scripting Host for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed."); |
$this->_reg = false; |
if (($this->_ver !== "") && preg_match("/ReactOS\r?\n\S+\s+.+/", $this->_ver)) { |
$this->_wmi = false; // No WMI info on ReactOS yet |
$this->_reg = false; // No EnumKey and ReadReg on ReactOS yet |
} else { |
if (PSI_OS == 'WINNT') { |
if (defined('PSI_EMU_HOSTNAME')) { |
try { |
$objLocator = new COM('WbemScripting.SWbemLocator'); |
$wmi = $objLocator->ConnectServer('', 'root\CIMv2'); |
$buffer = CommonFunctions::getWMI($wmi, 'Win32_OperatingSystem', array('CodeSet')); |
if (!$buffer) { |
$reg = $objLocator->ConnectServer('', 'root\default'); |
if (CommonFunctions::readReg($reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP", $strBuf, false)) { |
$buffer[0]['CodeSet'] = $strBuf; |
} |
} |
if ($buffer && isset($buffer[0])) { |
if (isset($buffer[0]['CodeSet'])) { |
$codeset = $buffer[0]['CodeSet']; |
if ($codeset == 932) { |
$codename = ' (SJIS)'; |
} elseif ($codeset == 949) { |
$codename = ' (EUC-KR)'; |
} elseif ($codeset == 950) { |
$codename = ' (BIG-5)'; |
} else { |
$codename = ''; |
} |
define('PSI_SYSTEM_CODEPAGE', 'windows-'.$codeset.$codename); |
} |
} |
} catch (Exception $e) { |
define('PSI_SYSTEM_CODEPAGE', null); |
if (PSI_DEBUG) { |
$this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed"); |
} |
} |
} else { |
define('PSI_SYSTEM_CODEPAGE', null); |
} |
} |
$this->_wmi = CommonFunctions::initWMI('root\CIMv2', true); |
if (PSI_OS == 'WINNT') { |
$this->_reg = CommonFunctions::initWMI('root\default', PSI_DEBUG); |
if (gettype($this->_reg) === "object") { |
$this->_reg->Security_->ImpersonationLevel = 3; |
} |
} else { |
$this->_reg = false; // No EnumKey and ReadReg on Linux |
} |
} |
try { |
// initialize the EnumKey object |
$this->_key = new COM("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\default:StdRegProv"); |
} catch (Exception $e) { |
//$this->error->addError("WWinmgmts Impersonationlevel Script Error", "PhpSysInfo can not initialize Winmgmts Impersonationlevel Script for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed."); |
$this->_key = false; |
} |
$this->_getCodeSet(); |
} |
274,9 → 311,44 |
} |
} else { |
$this->_wmidevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID')); |
$this->_wmidisks = array(); |
} |
if (empty($this->_wmidevices)) { |
$hkey = "HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\Scsi"; |
$id = 0; |
if (CommonFunctions::enumKey($this->_reg, $hkey, $portBuf, false)) { |
foreach ($portBuf as $scsiport) { |
if (CommonFunctions::enumKey($this->_reg, $hkey."\\".$scsiport, $busBuf, false)) { |
foreach ($busBuf as $scsibus) { |
if (CommonFunctions::enumKey($this->_reg, $hkey."\\".$scsiport."\\".$scsibus, $tarBuf, false)) { |
foreach ($tarBuf as $scsitar) if (!strncasecmp($scsitar, "Target Id ", strlen("Target Id "))) { |
if (CommonFunctions::enumKey($this->_reg, $hkey."\\".$scsiport."\\".$scsibus."\\".$scsitar, $logBuf, false)) { |
foreach ($logBuf as $scsilog) if (!strncasecmp($scsilog, "Logical Unit Id ", strlen("Logical Unit Id "))) { |
$hkey2 = $hkey."\\".$scsiport."\\".$scsibus."\\".$scsitar."\\".$scsilog."\\"; |
if ((CommonFunctions::readReg($this->_reg, $hkey2."DeviceType", $typeBuf, false) || CommonFunctions::readReg($this->_reg, $hkey2."Type", $typeBuf, false)) |
&& (($typeBuf=strtolower(trim($typeBuf))) !== "")) { |
if ((($typeBuf == 'diskperipheral') || ($typeBuf == 'cdromperipheral')) |
&& CommonFunctions::readReg($this->_reg, $hkey2."Identifier", $ideBuf, false)) { |
$this->_wmidevices[] = array('Name'=>$ideBuf, 'PNPDeviceID'=>'SCSI\\'.$id); |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS && defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL |
&& (CommonFunctions::readReg($this->_reg, $hkey2."SerialNumber", $serBuf, false)) |
&& (($serBuf=trim($serBuf)) !== "")) { |
$this->_wmidisks[] = array('PNPDeviceID'=>'SCSI\\'.$id, 'SerialNumber'=>$serBuf); |
} |
$id++; |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
$list = array(); |
foreach ($this->_wmidevices as $device) { |
if (substr($device['PNPDeviceID'], 0, strpos($device['PNPDeviceID'], "\\") + 1) == ($strType."\\")) { |
284,7 → 356,7 |
if (!isset($device['PNPClass']) || ($device['PNPClass']===$strType) || ($device['PNPClass']==='System')) { |
$device['PNPClass'] = null; |
} |
if (preg_match('/^\(.*\)$/', $device['Manufacturer'])) { |
if (!isset($device['Manufacturer']) || preg_match('/^\(.*\)$/', $device['Manufacturer']) || (($device['PNPClass']==='USB') && preg_match('/\sUSB\s/', $device['Manufacturer']))) { |
$device['Manufacturer'] = null; |
} |
$device['Capacity'] = null; |
328,7 → 400,7 |
*/ |
private function _hostname() |
{ |
if (PSI_USE_VHOST === true) { |
if ((PSI_USE_VHOST === true) && !defined('PSI_EMU_HOSTNAME')) { |
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm); |
} else { |
$buffer = $this->_get_Win32_ComputerSystem(); |
347,11 → 419,19 |
(version_compare("255.255.255.255", $ip, "=="))) { |
$this->sys->setHostname($result); // internal ip |
} else { |
$this->sys->setHostname(gethostbyaddr($ip)); |
$hostname = gethostbyaddr($ip); |
if ($hostname !== false) |
$this->sys->setHostname($hostname); |
else |
$this->sys->setHostname($result); |
} |
} else { |
$this->sys->setHostname($result); |
} |
} else { |
if (CommonFunctions::readenv('COMPUTERNAME', $hnm)) $this->sys->setHostname($hnm); |
} elseif (defined('PSI_EMU_HOSTNAME')) { |
$this->sys->setHostname(PSI_EMU_HOSTNAME); |
} elseif (CommonFunctions::readenv('COMPUTERNAME', $hnm)) { |
$this->sys->setHostname($hnm); |
} |
} |
} |
413,7 → 493,7 |
*/ |
protected function _users() |
{ |
if (CommonFunctions::executeProgram('quser', '', $strBuf, false) && (strlen($strBuf) > 0)) { |
if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::executeProgram('quser', '', $strBuf, false) && (strlen($strBuf) > 0)) { |
$lines = preg_split('/\n/', $strBuf); |
$users = count($lines)-1; |
} else { |
460,13 → 540,17 |
else |
$icon = 'Win8.png'; |
$this->sys->setDistributionIcon($icon); |
} elseif (CommonFunctions::executeProgram('cmd', '/c ver 2>nul', $ver_value, false)) { |
if (preg_match("/ReactOS\r?\nVersion\s+(.+)/", $ver_value, $ar_temp)) { |
$this->sys->setDistribution("ReactOS"); |
$this->sys->setKernel($ar_temp[1]); |
} elseif ($this->_ver !== "") { |
if (preg_match("/ReactOS\r?\n\S+\s+(.+)/", $this->_ver, $ar_temp)) { |
if (preg_match("/^(\d+\.\d+\.\d+[\S]*)(.+)$/", trim($ar_temp[1]), $ver_temp)) { |
$this->sys->setDistribution("ReactOS ".trim($ver_temp[1])); |
$this->sys->setKernel(trim($ver_temp[2])); |
} else { |
$this->sys->setDistribution("ReactOS"); |
$this->sys->setKernel($ar_temp[1]); |
} |
$this->sys->setDistributionIcon('ReactOS.png'); |
$this->_wmi = false; // No WMI info on ReactOS yet |
} elseif (preg_match("/^(Microsoft [^\[]*)\s*\[\D*\s*(.+)\]/", $ver_value, $ar_temp)) { |
} elseif (preg_match("/^(Microsoft [^\[]*)\s*\[\D*\s*(.+)\]/", $this->_ver, $ar_temp)) { |
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName", $strBuf, false) && (strlen($strBuf) > 0)) { |
if (preg_match("/^Microsoft /", $strBuf)) { |
$this->sys->setDistribution($strBuf); |
488,12 → 572,12 |
$icon = 'WinXP.png'; |
$this->sys->setDistributionIcon($icon); |
} else { |
$this->sys->setDistribution("WinNT"); |
$this->sys->setDistributionIcon('Win2000.png'); |
$this->sys->setDistribution("WINNT"); |
$this->sys->setDistributionIcon('WINNT.png'); |
} |
} else { |
$this->sys->setDistribution("WinNT"); |
$this->sys->setDistributionIcon('Win2000.png'); |
$this->sys->setDistribution("WINNT"); |
$this->sys->setDistributionIcon('WINNT.png'); |
} |
} |
542,7 → 626,7 |
$allCpus = $this->_get_Win32_Processor(); |
if (!$allCpus) { |
$hkey = "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor"; |
if (CommonFunctions::enumKey($this->_key, $hkey, $arrBuf, false)) { |
if (CommonFunctions::enumKey($this->_reg, $hkey, $arrBuf, false)) { |
foreach ($arrBuf as $coreCount) { |
if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\ProcessorNameString", $strBuf, false)) { |
$allCpus[$coreCount]['Name'] = $strBuf; |
611,19 → 695,75 |
private function _machine() |
{ |
$buffer = $this->_get_Win32_ComputerSystem(); |
if ($buffer) { |
$buf = ""; |
if (isset($buffer[0]['Manufacturer']) && !preg_match("/^To be filled by O\.E\.M\.$|^System manufacturer$|^Not Specified$/i", $buf2=$buffer[0]['Manufacturer'])) { |
$bufferp = CommonFunctions::getWMI($this->_wmi, 'Win32_BaseBoard', array('Product')); |
$bufferb = CommonFunctions::getWMI($this->_wmi, 'Win32_BIOS', array('SMBIOSBIOSVersion', 'ReleaseDate')); |
if (!$buffer) { |
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\systemManufacturer", $strBuf, false)) { |
$buffer[0]['Manufacturer'] = $strBuf; |
} |
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\SystemProductName", $strBuf, false)) { |
$buffer[0]['Model'] = $strBuf; |
} |
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\SystemFamily", $strBuf, false)) { |
$buffer[0]['SystemFamily'] = $strBuf; |
} |
} |
if (!$bufferp) { |
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BaseBoardProduct", $strBuf, false)) { |
$bufferp[0]['Product'] = $strBuf; |
} |
} |
if (!$bufferb) { |
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BIOSVersion", $strBuf, false)) { |
$bufferb[0]['SMBIOSBIOSVersion'] = $strBuf; |
} |
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BIOSReleaseDate", $strBuf, false)) { |
$bufferb[0]['ReleaseDate'] = $strBuf; |
} |
} |
$buf = ""; |
$model = ""; |
if ($buffer && isset($buffer[0])) { |
if (isset($buffer[0]['Manufacturer']) && !preg_match("/^To be filled by O\.E\.M\.$|^System manufacturer$|^Not Specified$/i", $buf2=trim($buffer[0]['Manufacturer'])) && ($buf2 !== "")) { |
$buf .= ' '.$buf2; |
} |
if (isset($buffer[0]['Model']) && !preg_match("/^To be filled by O\.E\.M\.$|^System Product Name$|^Not Specified$/i", $buf2=$buffer[0]['Model'])) { |
if (isset($buffer[0]['Model']) && !preg_match("/^To be filled by O\.E\.M\.$|^System Product Name$|^Not Specified$/i", $buf2=trim($buffer[0]['Model'])) && ($buf2 !== "")) { |
$model = $buf2; |
$buf .= ' '.$buf2; |
} |
if (trim($buf) != "") { |
$this->sys->setMachine(trim($buf)); |
} |
if ($bufferp && isset($bufferp[0])) { |
if (isset($bufferp[0]['Product']) && !preg_match("/^To be filled by O\.E\.M\.$|^BaseBoard Product Name$|^Not Specified$|^Default string$/i", $buf2=trim($bufferp[0]['Product'])) && ($buf2 !== "")) { |
if ($buf2 !== $model) { |
$buf .= '/'.$buf2; |
} elseif (isset($buffer[0]['SystemFamily']) && !preg_match("/^To be filled by O\.E\.M\.$|^System Family$|^Not Specified$/i", $buf2=trim($buffer[0]['SystemFamily'])) && ($buf2 !== "")) { |
$buf .= '/'.$buf2; |
} |
} |
} |
if ($bufferb && isset($bufferb[0])) { |
$bver = ""; |
$brel = ""; |
if (isset($bufferb[0]['SMBIOSBIOSVersion']) && (($buf2=trim($bufferb[0]['SMBIOSBIOSVersion'])) !== "")) { |
$bver .= ' '.$buf2; |
} |
if (isset($bufferb[0]['ReleaseDate'])) { |
if (preg_match("/^(\d{4})(\d{2})(\d{2})\d{6}\.\d{6}\+\d{3}$/", $bufferb[0]['ReleaseDate'], $dateout)) { |
$brel .= ' '.$dateout[2].'/'.$dateout[3].'/'.$dateout[1]; |
} elseif (preg_match("/^\d{2}\/\d{2}\/\d{4}$/", $bufferb[0]['ReleaseDate'])) { |
$brel .= ' '.$bufferb[0]['ReleaseDate']; |
} |
} |
if ((trim($bver) !== "") || (trim($brel) !== "")) { |
$buf .= ', BIOS'.$bver.$brel; |
} |
} |
if (trim($buf) != "") { |
$this->sys->setMachine(trim($buf)); |
} |
} |
/** |
637,7 → 777,11 |
$dev = new HWDevice(); |
$dev->setName($pciDev['Name']); |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) { |
$dev->setManufacturer($pciDev['Manufacturer']); |
if (($pciDev['Manufacturer'] !== null) && preg_match("/^@[^\.]+\.inf,%([^%]+)%$/i", trim($pciDev['Manufacturer']), $mbuff)) { |
$dev->setManufacturer($mbuff[1]); |
} else { |
$dev->setManufacturer($pciDev['Manufacturer']); |
} |
$dev->setProduct($pciDev['Product']); |
} |
$this->sys->setPciDevices($dev); |
698,16 → 842,16 |
if ($allDevices) { |
$aliases = array(); |
$hkey = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"; |
if (CommonFunctions::enumKey($this->_key, $hkey, $arrBuf, false)) { |
if (CommonFunctions::enumKey($this->_reg, $hkey, $arrBuf, false)) { |
foreach ($arrBuf as $netID) { |
if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\PnPInstanceId", $strInstanceID, false)) { //a w Name jest net alias |
if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\PnPInstanceId", $strInstanceID, false)) { |
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\".$strInstanceID."\\FriendlyName", $strName, false)) { |
$cname = str_replace(array('(', ')', '#'), array('[', ']', '_'), $strName); //convert to canonical |
$cname = str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strName); //convert to canonical |
if (!isset($aliases[$cname])) { // duplicate checking |
$aliases[$cname]['id'] = $netID; |
$aliases[$cname]['name'] = $strName; |
if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\Name", $strCName, false) |
&& (str_replace(array('(', ')', '#'), array('[', ']', '_'), $strCName) !== $cname)) { |
&& (str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strCName) !== $cname)) { |
$aliases[$cname]['netname'] = $strCName; |
} |
} else { |
720,11 → 864,11 |
$aliases2 = array(); |
$hkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards"; |
if (CommonFunctions::enumKey($this->_key, $hkey, $arrBuf, false)) { |
if (CommonFunctions::enumKey($this->_reg, $hkey, $arrBuf, false)) { |
foreach ($arrBuf as $netCount) { |
if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netCount."\\Description", $strName, false) |
&& CommonFunctions::readReg($this->_reg, $hkey."\\".$netCount."\\ServiceName", $strGUID, false)) { |
$cname = str_replace(array('(', ')', '#'), array('[', ']', '_'), $strName); //convert to canonical |
$cname = str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strName); //convert to canonical |
if (!isset($aliases2[$cname])) { // duplicate checking |
$aliases2[$cname]['id'] = $strGUID; |
$aliases2[$cname]['name'] = $strName; |
965,7 → 1109,7 |
public function _processes() |
{ |
$processes['*'] = 0; |
if (CommonFunctions::executeProgram('qprocess', '*', $strBuf, false) && (strlen($strBuf) > 0)) { |
if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::executeProgram('qprocess', '*', $strBuf, false) && (strlen($strBuf) > 0)) { |
$lines = preg_split('/\n/', $strBuf); |
$processes['*'] = (count($lines)-1) - 3 ; //correction for process "qprocess *" |
} |
978,6 → 1122,184 |
} |
/** |
* MEM information |
* |
* @return void |
*/ |
private function _meminfo() |
{ |
$allMems = CommonFunctions::getWMI($this->_wmi, 'Win32_PhysicalMemory', array('PartNumber', 'DeviceLocator', 'Capacity', 'Manufacturer', 'SerialNumber', 'Speed', 'ConfiguredClockSpeed', 'ConfiguredVoltage', 'MemoryType', 'SMBIOSMemoryType', 'FormFactor', 'DataWidth', 'TotalWidth', 'BankLabel', 'MinVoltage', 'MaxVoltage')); |
if ($allMems) { |
$reg = false; |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) { |
$arrMems = CommonFunctions::getWMI($this->_wmi, 'Win32_PhysicalMemoryArray', array('MemoryErrorCorrection')); |
$reg = (count($arrMems) == 1) && isset($arrMems[0]['MemoryErrorCorrection']) && ($arrMems[0]['MemoryErrorCorrection'] == 6); |
} |
foreach ($allMems as $mem) { |
$dev = new HWDevice(); |
$name = ''; |
if (isset($mem['PartNumber']) && !preg_match("/^PartNum\d+$/", $part = $mem['PartNumber']) && ($part != '') && ($part != 'None') && ($part != 'N/A') && ($part != 'NOT AVAILABLE')) { |
$name = $part; |
} |
if (isset($mem['DeviceLocator']) && (($dloc = $mem['DeviceLocator']) != '') && ($dloc != 'None') && ($dloc != 'N/A')) { |
if ($name != '') { |
$name .= ' - '.$dloc; |
} else { |
$name = $dloc; |
} |
} |
if (isset($mem['BankLabel']) && (($bank = $mem['BankLabel']) != '') && ($bank != 'None') && ($bank != 'N/A')) { |
if ($name != '') { |
$name .= ' in '.$bank; |
} else { |
$name = 'Physical Memory in '.$bank; |
} |
} |
if ($name != '') { |
$dev->setName(trim($name)); |
} else { |
$dev->setName('Physical Memory'); |
} |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) { |
if (isset($mem['Manufacturer']) && !preg_match("/^([A-F\d]{4}|[A-F\d]{12}|[A-F\d]{16})$/", $manufacturer = $mem['Manufacturer']) && !preg_match("/^Manufacturer\d+$/", $manufacturer) && !preg_match("/^Mfg \d+$/", $manufacturer) && ($manufacturer != '') && ($manufacturer != 'None') && ($manufacturer != 'N/A') && ($manufacturer != 'UNKNOWN')) { |
$dev->setManufacturer($manufacturer); |
} |
if (isset($mem['Capacity'])) { |
$dev->setCapacity($mem['Capacity']); |
} |
$memtype = ''; |
if (isset($mem['MemoryType']) && (($memval = $mem['MemoryType']) != 0)) { |
switch ($memval) { |
// case 0: $memtype = 'Unknown'; break; |
// case 1: $memtype = 'Other'; break; |
case 2: $memtype = 'DRAM'; break; |
case 3: $memtype = 'Synchronous DRAM'; break; |
case 4: $memtype = 'Cache DRAM'; break; |
case 5: $memtype = 'EDO'; break; |
case 6: $memtype = 'EDRAM'; break; |
case 7: $memtype = 'VRAM'; break; |
case 8: $memtype = 'SRAM'; break; |
case 9: $memtype = 'RAM'; break; |
case 10: $memtype = 'ROM'; break; |
case 11: $memtype = 'Flash'; break; |
case 12: $memtype = 'EEPROM'; break; |
case 13: $memtype = 'FEPROM'; break; |
case 14: $memtype = 'EPROM'; break; |
case 15: $memtype = 'CDRAM'; break; |
case 16: $memtype = '3DRAM'; break; |
case 17: $memtype = 'SDRAM'; break; |
case 18: $memtype = 'SGRAM'; break; |
case 19: $memtype = 'RDRAM'; break; |
case 20: $memtype = 'DDR'; break; |
case 21: $memtype = 'DDR2'; break; |
case 22: $memtype = 'DDR2 FB-DIMM'; break; |
case 24: $memtype = 'DDR3'; break; |
case 25: $memtype = 'FBD2'; break; |
case 26: $memtype = 'DDR4'; break; |
} |
} elseif (isset($mem['SMBIOSMemoryType'])) { |
switch ($mem['SMBIOSMemoryType']) { |
// case 0: $memtype = 'Invalid'; break; |
// case 1: $memtype = 'Other'; break; |
// case 2: $memtype = 'Unknown'; break; |
case 3: $memtype = 'DRAM'; break; |
case 4: $memtype = 'EDRAM'; break; |
case 5: $memtype = 'VRAM'; break; |
case 6: $memtype = 'SRAM'; break; |
case 7: $memtype = 'RAM'; break; |
case 8: $memtype = 'ROM'; break; |
case 9: $memtype = 'FLASH'; break; |
case 10: $memtype = 'EEPROM'; break; |
case 11: $memtype = 'FEPROM'; break; |
case 12: $memtype = 'EPROM'; break; |
case 13: $memtype = 'CDRAM'; break; |
case 14: $memtype = '3DRAM'; break; |
case 15: $memtype = 'SDRAM'; break; |
case 16: $memtype = 'SGRAM'; break; |
case 17: $memtype = 'RDRAM'; break; |
case 18: $memtype = 'DDR'; break; |
case 19: $memtype = 'DDR2'; break; |
case 20: $memtype = 'DDR2 FB-DIMM'; break; |
case 24: $memtype = 'DDR3'; break; |
case 25: $memtype = 'FBD2'; break; |
case 26: $memtype = 'DDR4'; break; |
case 27: $memtype = 'LPDDR'; break; |
case 28: $memtype = 'LPDDR2'; break; |
case 29: $memtype = 'LPDDR3'; break; |
case 30: $memtype = 'DDR3'; break; |
case 31: $memtype = 'FBD2'; break; |
case 32: $memtype = 'Logical non-volatile device'; break; |
case 33: $memtype = 'HBM2'; break; |
case 34: $memtype = 'DDR5'; break; |
case 35: $memtype = 'LPDDR5'; break; |
} |
} |
if (isset($mem['Speed']) && (($speed = $mem['Speed']) > 0) && (preg_match('/^(DDR\d*)(.*)/', $memtype, $dr) || preg_match('/^(SDR)AM(.*)/', $memtype, $dr))) { |
if (isset($mem['MinVoltage']) && isset($mem['MaxVoltage']) && (($minv = $mem['MinVoltage']) > 0) && (($maxv = $mem['MaxVoltage']) > 0) && ($minv < $maxv)) { |
$lv = 'L'; |
} else { |
$lv = ''; |
} |
if (isset($dr[2])) { |
$memtype = $dr[1].$lv.'-'.$speed.' '.$dr[2]; |
} else { |
$memtype = $dr[1].$lv.'-'.$speed; |
} |
} |
if (isset($mem['FormFactor'])) { |
switch ($mem['FormFactor']) { |
// case 0: $memtype .= ' Unknown'; break; |
// case 1: $memtype .= ' Other'; break; |
case 2: $memtype .= ' SIP'; break; |
case 3: $memtype .= ' DIP'; break; |
case 4: $memtype .= ' ZIP'; break; |
case 5: $memtype .= ' SOJ'; break; |
case 6: $memtype .= ' Proprietary'; break; |
case 7: $memtype .= ' SIMM'; break; |
case 8: $memtype .= ' DIMM'; break; |
case 9: $memtype .= ' TSOPO'; break; |
case 10: $memtype .= ' PGA'; break; |
case 11: $memtype .= ' RIM'; break; |
case 12: $memtype .= ' SODIMM'; break; |
case 13: $memtype .= ' SRIMM'; break; |
case 14: $memtype .= ' SMD'; break; |
case 15: $memtype .= ' SSMP'; break; |
case 16: $memtype .= ' QFP'; break; |
case 17: $memtype .= ' TQFP'; break; |
case 18: $memtype .= ' SOIC'; break; |
case 19: $memtype .= ' LCC'; break; |
case 20: $memtype .= ' PLCC'; break; |
case 21: $memtype .= ' BGA'; break; |
case 22: $memtype .= ' FPBGA'; break; |
case 23: $memtype .= ' LGA'; break; |
} |
} |
if (isset($mem['DataWidth']) && isset($mem['TotalWidth']) && (($dataw = $mem['DataWidth']) > 0) && (($totalw = $mem['TotalWidth']) > 0) && ($dataw < $totalw)) { |
$memtype .= ' ECC'; |
} |
if ($reg) { |
$memtype .= ' REG'; |
} |
if (($memtype = trim($memtype)) != '') { |
$dev->setProduct($memtype); |
} |
if (isset($mem['ConfiguredClockSpeed']) && (($clock = $mem['ConfiguredClockSpeed']) > 0)) { |
$dev->setSpeed($clock); |
} |
if (isset($mem['ConfiguredVoltage']) && (($voltage = $mem['ConfiguredVoltage']) > 0)) { |
$dev->setVoltage($voltage/1000); |
} |
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && |
isset($mem['SerialNumber']) && !preg_match("/^SerNum\d+$/", $serial = $mem['SerialNumber']) && ($serial != '') && ($serial != 'None')) { |
$dev->setSerial($serial); |
} |
} |
$this->sys->setMemDevices($dev); |
} |
} |
} |
/** |
* get the information |
* |
* @see PSI_Interface_OS::build() |
1003,6 → 1325,7 |
if (!$this->blockname || $this->blockname==='hardware') { |
$this->_machine(); |
$this->_cpuinfo(); |
$this->_meminfo(); |
$this->_hardware(); |
} |
if (!$this->blockname || $this->blockname==='filesystem') { |
/web/acc/phpsysinfo/includes/output/class.Webpage.inc.php |
---|
188,6 → 188,8 |
$tpl->set("showNetworkActiveSpeed", defined('PSI_SHOW_NETWORK_ACTIVE_SPEED') ? (PSI_SHOW_NETWORK_ACTIVE_SPEED ? ((strtolower(PSI_SHOW_NETWORK_ACTIVE_SPEED) === 'bps') ? 'bps' :'true') : 'false') : 'false'); |
$tpl->set("showCPULoadCompact", defined('PSI_LOAD_BAR') ? ((strtolower(PSI_LOAD_BAR) === 'compact') ? 'true' :'false') : 'false'); |
$tpl->set("hideBootstrapLoader", defined('PSI_HIDE_BOOTSTRAP_LOADER') ? (PSI_HIDE_BOOTSTRAP_LOADER ? 'true' : 'false') : 'false'); |
$tpl->set("increaseWidth", defined('PSI_INCREASE_WIDTH') ? ((intval(PSI_INCREASE_WIDTH)>0) ? intval(PSI_INCREASE_WIDTH) : 0) : 0); |
$tpl->set("hideTotals", defined('PSI_HIDE_TOTALS') ? (PSI_HIDE_TOTALS ? 'true' : 'false') : 'false'); |
if (defined('PSI_BLOCKS')) { |
if (is_string(PSI_BLOCKS)) { |
if (preg_match(ARRAY_EXP, PSI_BLOCKS)) { |
/web/acc/phpsysinfo/includes/output/class.WebpageXML.inc.php |
---|
61,9 → 61,23 |
private function _prepare() |
{ |
if ($this->_pluginName === null) { |
// Figure out which OS we are running on, and detect support |
if (!file_exists(PSI_APP_ROOT.'/includes/os/class.'.PSI_OS.'.inc.php')) { |
$this->error->addError("file_exists(class.".PSI_OS.".inc.php)", PSI_OS." is not currently supported"); |
if (((PSI_OS == 'WINNT') || (PSI_OS == 'Linux')) && defined('PSI_WMI_HOSTNAME')) { |
define('PSI_EMU_HOSTNAME', PSI_WMI_HOSTNAME); |
if (defined('PSI_WMI_USER') && defined('PSI_WMI_PASSWORD')) { |
define('PSI_EMU_USER', PSI_WMI_USER); |
define('PSI_EMU_PASSWORD', PSI_WMI_PASSWORD); |
} else { |
define('PSI_EMU_USER', null); |
define('PSI_EMU_PASSWORD', null); |
} |
if (!file_exists(PSI_APP_ROOT.'/includes/os/class.WINNT.inc.php')) { |
$this->error->addError("file_exists(class.WINNT.inc.php)", "WINNT is not currently supported"); |
} |
} else { |
// Figure out which OS we are running on, and detect support |
if (!file_exists(PSI_APP_ROOT.'/includes/os/class.'.PSI_OS.'.inc.php')) { |
$this->error->addError("file_exists(class.".PSI_OS.".inc.php)", PSI_OS." is not currently supported"); |
} |
} |
if (!defined('PSI_MBINFO') && (!$this->_blockName || in_array($this->_blockName, array('voltage','current','temperature','fans','power','other')))) { |
125,6 → 139,29 |
// Create the XML |
$this->_xml = new XML($this->_completeXML, '', $this->_blockName); |
} else { |
if ((PSI_OS == 'WINNT') || (PSI_OS == 'Linux')) { |
$plugname = strtoupper(trim($this->_pluginName)); |
if (defined('PSI_PLUGIN_'.$plugname.'_WMI_HOSTNAME')) { |
define('PSI_EMU_HOSTNAME', constant('PSI_PLUGIN_'.$plugname.'_WMI_HOSTNAME')); |
if (defined('PSI_PLUGIN_'.$plugname.'_WMI_USER') && defined('PSI_PLUGIN_'.$plugname.'_WMI_PASSWORD')) { |
define('PSI_EMU_USER', constant('PSI_PLUGIN_'.$plugname.'_WMI_USER')); |
define('PSI_EMU_PASSWORD', constant('PSI_PLUGIN_'.$plugname.'_WMI_PASSWORD')); |
} else { |
define('PSI_EMU_USER', null); |
define('PSI_EMU_PASSWORD', null); |
} |
} elseif (defined('PSI_WMI_HOSTNAME')) { |
define('PSI_EMU_HOSTNAME', PSI_WMI_HOSTNAME); |
if (defined('PSI_WMI_USER') && defined('PSI_WMI_PASSWORD')) { |
define('PSI_EMU_USER', PSI_WMI_USER); |
define('PSI_EMU_PASSWORD', PSI_WMI_PASSWORD); |
} else { |
define('PSI_EMU_USER', null); |
define('PSI_EMU_PASSWORD', null); |
} |
} |
} |
// Create the XML |
$this->_xml = new XML(false, $this->_pluginName); |
} |
/web/acc/phpsysinfo/includes/plugin/class.PSI_Plugin.inc.php |
---|
130,5 → 130,11 |
$root = $dom->createElement("Plugin_".$this->_plugin_name); |
$dom->appendChild($root); |
$this->xml = new SimpleXMLExtended(simplexml_import_dom($dom), $enc); |
$plugname = strtoupper($this->_plugin_name); |
if (((PSI_OS == 'WINNT') || (PSI_OS == 'Linux')) && |
defined('PSI_PLUGIN_'.$plugname.'_WMI_HOSTNAME') && |
(!defined('PSI_WMI_HOSTNAME') || (PSI_WMI_HOSTNAME != constant('PSI_PLUGIN_'.strtoupper($this->_plugin_name).'_WMI_HOSTNAME')))) { |
$this->xml->addAttribute('Hostname', constant('PSI_PLUGIN_'.strtoupper($this->_plugin_name).'_WMI_HOSTNAME')); |
} |
} |
} |
/web/acc/phpsysinfo/includes/to/class.System.inc.php |
---|
177,6 → 177,15 |
private $_nvmeDevices = array(); |
/** |
* array with Mem devices |
* |
* @see HWDevice |
* |
* @var array |
*/ |
private $_memDevices = array(); |
/** |
* array with disk devices |
* |
* @see DiskDevice |
965,6 → 974,33 |
} |
/** |
* Returns $_memDevices. |
* |
* @see System::$_memDevices |
* |
* @return array |
*/ |
public function getMemDevices() |
{ |
return $this->_memDevices; |
} |
/** |
* Sets $_memDevices. |
* |
* @param HWDevice $memDevices mem device |
* |
* @see System::$_memDevices |
* @see HWDevice |
* |
* @return Void |
*/ |
public function setMemDevices($memDevices) |
{ |
array_push($this->_memDevices, $memDevices); |
} |
/** |
* Returns $_diskDevices. |
* |
* @see System::$_diskDevices |
/web/acc/phpsysinfo/includes/to/device/class.DiskDevice.inc.php |
---|
77,7 → 77,7 |
/** |
* inodes usage in percent if available |
* |
* @var |
* @var Integer |
*/ |
private $_percentInodesUsed = null; |
84,7 → 84,7 |
/** |
* ignore mode |
* |
* @var Ignore |
* @var Integer |
*/ |
private $_ignore = 0; |
99,7 → 99,7 |
public function getPercentUsed() |
{ |
if ($this->_total > 0) { |
return round($this->_used / $this->_total * 100); |
return 100 - min(floor($this->_free / $this->_total * 100), 100); |
} else { |
return 0; |
} |
/web/acc/phpsysinfo/includes/to/device/class.HWDevice.inc.php |
---|
56,11 → 56,25 |
/** |
* serial number of the device, if not available it will be null |
* |
* @var Integer |
* @var String |
*/ |
private $_serial = null; |
/** |
* speed of the device, if not available it will be null |
* |
* @var Float |
*/ |
private $_speed = null; |
/** |
* voltage of the device, if not available it will be null |
* |
* @var Float |
*/ |
private $_voltage = null; |
/** |
* count of the device |
* |
* @var Integer |
80,7 → 94,8 |
&& $dev->getCapacity() === $this->_capacity |
&& $dev->getManufacturer() === $this->_manufacturer |
&& $dev->getProduct() === $this->_product |
&& $dev->getSerial() === $this->_serial) { |
&& $dev->getSerial() === $this->_serial |
&& $dev->getSpeed() === $this->_speed) { |
return true; |
} else { |
return false; |
192,6 → 207,58 |
} |
/** |
* Returns $_speed. |
* |
* @see HWDevice::$_speed |
* |
* @return Float |
*/ |
public function getSpeed() |
{ |
return $this->_speed; |
} |
/** |
* Sets $_speed. |
* |
* @param Float $speed speed |
* |
* @see HWDevice::$_speed |
* |
* @return Void |
*/ |
public function setSpeed($speed) |
{ |
$this->_speed = $speed; |
} |
/** |
* Returns $_voltage. |
* |
* @see HWDevice::$_voltage |
* |
* @return Float |
*/ |
public function getVoltage() |
{ |
return $this->_voltage; |
} |
/** |
* Sets $_voltage. |
* |
* @param Float $voltage voltage |
* |
* @see HWDevice::$_voltage |
* |
* @return Void |
*/ |
public function setVoltage($voltage) |
{ |
$this->_voltage = $voltage; |
} |
/** |
* Returns $_capacity. |
* |
* @see HWDevice::$_capacity |
/web/acc/phpsysinfo/includes/to/device/class.SensorDevice.inc.php |
---|
61,6 → 61,13 |
private $_event = ""; |
/** |
* unit of values of the sensor |
* |
* @var String |
*/ |
private $_unit = ""; |
/** |
* Returns $_max. |
* |
* @see Sensor::$_max |
189,4 → 196,30 |
{ |
$this->_event = $event; |
} |
/** |
* Returns $_unit. |
* |
* @see Sensor::$_unit |
* |
* @return String |
*/ |
public function getUnit() |
{ |
return $this->_unit; |
} |
/** |
* Sets $_unit. |
* |
* @param String $unit sensor unit |
* |
* @see Sensor::$_unit |
* |
* @return Void |
*/ |
public function setUnit($unit) |
{ |
$this->_unit = $unit; |
} |
} |
/web/acc/phpsysinfo/includes/ups/class.apcupsd.inc.php |
---|
52,7 → 52,11 |
} |
} |
} else { //use default if address and port not defined |
CommonFunctions::executeProgram('apcaccess', 'status', $temp); |
if (!defined('PSI_EMU_HOSTNAME')) { |
CommonFunctions::executeProgram('apcaccess', 'status', $temp); |
} else { |
CommonFunctions::executeProgram('apcaccess', 'status '.PSI_EMU_HOSTNAME, $temp); |
} |
if (! empty($temp)) { |
$this->_output[] = $temp; |
} |
/web/acc/phpsysinfo/includes/ups/class.nut.inc.php |
---|
57,7 → 57,11 |
} |
} |
} else { //use default if address and port not defined |
CommonFunctions::executeProgram('upsc', '-l', $output, PSI_DEBUG); |
if (!defined('PSI_EMU_HOSTNAME')) { |
CommonFunctions::executeProgram('upsc', '-l', $output, PSI_DEBUG); |
} else { |
CommonFunctions::executeProgram('upsc', '-l '.PSI_EMU_HOSTNAME, $output, PSI_DEBUG); |
} |
$ups_names = preg_split("/\n/", $output, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($ups_names as $ups_name) { |
CommonFunctions::executeProgram('upsc', trim($ups_name), $temp, PSI_DEBUG); |
/web/acc/phpsysinfo/includes/ups/class.pmset.inc.php |
---|
38,9 → 38,11 |
public function __construct() |
{ |
parent::__construct(); |
$temp = ""; |
if (CommonFunctions::executeProgram('pmset', '-g batt', $temp) && !empty($temp)) { |
$this->_output[] = $temp; |
if (PSI_OS == 'Darwin') { |
$temp = ""; |
if (CommonFunctions::executeProgram('pmset', '-g batt', $temp) && !empty($temp)) { |
$this->_output[] = $temp; |
} |
} |
} |
/web/acc/phpsysinfo/includes/ups/class.powersoftplus.inc.php |
---|
38,9 → 38,11 |
public function __construct() |
{ |
parent::__construct(); |
CommonFunctions::executeProgram('powersoftplus', '-p', $temp); |
if (! empty($temp)) { |
$this->_output[] = $temp; |
if (PSI_OS == 'Linux') { |
CommonFunctions::executeProgram('powersoftplus', '-p', $temp); |
if (! empty($temp)) { |
$this->_output[] = $temp; |
} |
} |
} |
/web/acc/phpsysinfo/includes/xml/class.XML.inc.php |
---|
66,13 → 66,6 |
private $_plugin = ''; |
/** |
* generate a xml for a plugin or for the main app |
* |
* @var boolean |
*/ |
private $_plugin_request = false; |
/** |
* generate the entire xml with all plugins or only a part of the xml (main or plugin) |
* |
* @var boolean |
93,19 → 86,17 |
public function __construct($complete = false, $pluginname = "", $blockname = false) |
{ |
$this->_errors = PSI_Error::singleton(); |
if ($pluginname == "") { |
$this->_plugin_request = false; |
$this->_plugin = ''; |
} else { |
$this->_plugin_request = true; |
$this->_plugin = $pluginname; |
} |
$this->_plugin = $pluginname; |
if ($complete) { |
$this->_complete_request = true; |
} else { |
$this->_complete_request = false; |
} |
$os = PSI_OS; |
if (defined('PSI_EMU_HOSTNAME')) { |
$os = 'WINNT'; |
} else { |
$os = PSI_OS; |
} |
$this->_sysinfo = new $os($blockname); |
$this->_plugins = CommonFunctions::getPlugins(); |
$this->_xmlbody(); |
169,8 → 160,12 |
} |
} |
} |
// $vitals->addAttribute('OS', PSI_OS); |
$vitals->addAttribute('OS', (PSI_OS=='Android')?'Linux':PSI_OS); |
if (defined('PSI_EMU_HOSTNAME')) { |
$vitals->addAttribute('OS', 'WINNT'); |
} else { |
$vitals->addAttribute('OS', (PSI_OS=='Android')?'Linux':PSI_OS); |
} |
} |
/** |
218,12 → 213,58 |
if ($this->_sys->getMachine() != "") { |
$hardware->addAttribute('Name', $this->_sys->getMachine()); |
} |
$pci = null; |
foreach (System::removeDupsAndCount($this->_sys->getPciDevices()) as $dev) { |
if ($pci === null) $pci = $hardware->addChild('PCI'); |
$tmp = $pci->addChild('Device'); |
$cpu = null; |
$vendortab = null; |
foreach ($this->_sys->getCpus() as $oneCpu) { |
if ($cpu === null) $cpu = $hardware->addChild('CPU'); |
$tmp = $cpu->addChild('CpuCore'); |
$tmp->addAttribute('Model', $oneCpu->getModel()); |
if ($oneCpu->getCpuSpeed() !== 0) { |
$tmp->addAttribute('CpuSpeed', max($oneCpu->getCpuSpeed(), 0)); |
} |
if ($oneCpu->getCpuSpeedMax() !== 0) { |
$tmp->addAttribute('CpuSpeedMax', $oneCpu->getCpuSpeedMax()); |
} |
if ($oneCpu->getCpuSpeedMin() !== 0) { |
$tmp->addAttribute('CpuSpeedMin', $oneCpu->getCpuSpeedMin()); |
} |
/* |
if ($oneCpu->getTemp() !== null) { |
$tmp->addAttribute('CpuTemp', $oneCpu->getTemp()); |
} |
*/ |
if ($oneCpu->getBusSpeed() !== null) { |
$tmp->addAttribute('BusSpeed', $oneCpu->getBusSpeed()); |
} |
if ($oneCpu->getCache() !== null) { |
$tmp->addAttribute('Cache', $oneCpu->getCache()); |
} |
if ($oneCpu->getVirt() !== null) { |
$tmp->addAttribute('Virt', $oneCpu->getVirt()); |
} |
if ($oneCpu->getVendorId() !== null) { |
if ($vendortab === null) $vendortab = @parse_ini_file(PSI_APP_ROOT."/data/cpus.ini", true); |
$shortvendorid = preg_replace('/[\s!]/', '', $oneCpu->getVendorId()); |
if ($vendortab && ($shortvendorid != "") && isset($vendortab['manufacturer'][$shortvendorid])) { |
$tmp->addAttribute('Manufacturer', $vendortab['manufacturer'][$shortvendorid]); |
} |
} |
if ($oneCpu->getBogomips() !== null) { |
$tmp->addAttribute('Bogomips', $oneCpu->getBogomips()); |
} |
if ($oneCpu->getLoad() !== null) { |
$tmp->addAttribute('Load', $oneCpu->getLoad()); |
} |
} |
$mem = null; |
foreach (System::removeDupsAndCount($this->_sys->getMemDevices()) as $dev) { |
if ($mem === null) $mem = $hardware->addChild('MEM'); |
$tmp = $mem->addChild('Chip'); |
$tmp->addAttribute('Name', $dev->getName()); |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) { |
if ($dev->getCapacity() !== null) { |
$tmp->addAttribute('Capacity', $dev->getCapacity()); |
} |
if ($dev->getManufacturer() !== null) { |
$tmp->addAttribute('Manufacturer', $dev->getManufacturer()); |
} |
230,15 → 271,24 |
if ($dev->getProduct() !== null) { |
$tmp->addAttribute('Product', $dev->getProduct()); |
} |
if ($dev->getSpeed() !== null) { |
$tmp->addAttribute('Speed', $dev->getSpeed()); |
} |
if ($dev->getVoltage() !== null) { |
$tmp->addAttribute('Voltage', $dev->getVoltage()); |
} |
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) { |
$tmp->addAttribute('Serial', $dev->getSerial()); |
} |
} |
if ($dev->getCount() > 1) { |
$tmp->addAttribute('Count', $dev->getCount()); |
} |
} |
$usb = null; |
foreach (System::removeDupsAndCount($this->_sys->getUsbDevices()) as $dev) { |
if ($usb === null) $usb = $hardware->addChild('USB'); |
$tmp = $usb->addChild('Device'); |
$pci = null; |
foreach (System::removeDupsAndCount($this->_sys->getPciDevices()) as $dev) { |
if ($pci === null) $pci = $hardware->addChild('PCI'); |
$tmp = $pci->addChild('Device'); |
$tmp->addAttribute('Name', $dev->getName()); |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) { |
if ($dev->getManufacturer() !== null) { |
247,9 → 297,6 |
if ($dev->getProduct() !== null) { |
$tmp->addAttribute('Product', $dev->getProduct()); |
} |
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) { |
$tmp->addAttribute('Serial', $dev->getSerial()); |
} |
} |
if ($dev->getCount() > 1) { |
$tmp->addAttribute('Count', $dev->getCount()); |
306,6 → 353,29 |
$tmp->addAttribute('Count', $dev->getCount()); |
} |
} |
$usb = null; |
foreach (System::removeDupsAndCount($this->_sys->getUsbDevices()) as $dev) { |
if ($usb === null) $usb = $hardware->addChild('USB'); |
$tmp = $usb->addChild('Device'); |
$tmp->addAttribute('Name', $dev->getName()); |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) { |
if ($dev->getManufacturer() !== null) { |
$tmp->addAttribute('Manufacturer', $dev->getManufacturer()); |
} |
if ($dev->getProduct() !== null) { |
$tmp->addAttribute('Product', $dev->getProduct()); |
} |
if ($dev->getSpeed() !== null) { |
$tmp->addAttribute('Speed', $dev->getSpeed()); |
} |
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) { |
$tmp->addAttribute('Serial', $dev->getSerial()); |
} |
} |
if ($dev->getCount() > 1) { |
$tmp->addAttribute('Count', $dev->getCount()); |
} |
} |
$tb = null; |
foreach (System::removeDupsAndCount($this->_sys->getTbDevices()) as $dev) { |
if ($tb === null) $tb = $hardware->addChild('TB'); |
324,50 → 394,6 |
$tmp->addAttribute('Count', $dev->getCount()); |
} |
} |
$cpu = null; |
$vendortab = null; |
foreach ($this->_sys->getCpus() as $oneCpu) { |
if ($cpu === null) $cpu = $hardware->addChild('CPU'); |
$tmp = $cpu->addChild('CpuCore'); |
$tmp->addAttribute('Model', $oneCpu->getModel()); |
if ($oneCpu->getCpuSpeed() !== 0) { |
$tmp->addAttribute('CpuSpeed', max($oneCpu->getCpuSpeed(), 0)); |
} |
if ($oneCpu->getCpuSpeedMax() !== 0) { |
$tmp->addAttribute('CpuSpeedMax', $oneCpu->getCpuSpeedMax()); |
} |
if ($oneCpu->getCpuSpeedMin() !== 0) { |
$tmp->addAttribute('CpuSpeedMin', $oneCpu->getCpuSpeedMin()); |
} |
/* |
if ($oneCpu->getTemp() !== null) { |
$tmp->addAttribute('CpuTemp', $oneCpu->getTemp()); |
} |
*/ |
if ($oneCpu->getBusSpeed() !== null) { |
$tmp->addAttribute('BusSpeed', $oneCpu->getBusSpeed()); |
} |
if ($oneCpu->getCache() !== null) { |
$tmp->addAttribute('Cache', $oneCpu->getCache()); |
} |
if ($oneCpu->getVirt() !== null) { |
$tmp->addAttribute('Virt', $oneCpu->getVirt()); |
} |
if ($oneCpu->getVendorId() !== null) { |
if ($vendortab === null) $vendortab = @parse_ini_file(PSI_APP_ROOT."/data/cpus.ini", true); |
$shortvendorid = preg_replace('/[\s!]/', '', $oneCpu->getVendorId()); |
if ($vendortab && ($shortvendorid != "") && isset($vendortab['manufacturer'][$shortvendorid])) { |
$tmp->addAttribute('Manufacturer', $vendortab['manufacturer'][$shortvendorid]); |
} |
} |
if ($oneCpu->getBogomips() !== null) { |
$tmp->addAttribute('Bogomips', $oneCpu->getBogomips()); |
} |
if ($oneCpu->getLoad() !== null) { |
$tmp->addAttribute('Load', $oneCpu->getLoad()); |
} |
} |
} |
/** |
423,12 → 449,18 |
private function _fillDevice(SimpleXMLExtended $mount, DiskDevice $dev, $i) |
{ |
$mount->addAttribute('MountPointID', $i); |
if ($dev->getFsType()!=="") $mount->addAttribute('FSType', $dev->getFsType()); |
if ($dev->getFsType()!=="") { |
$mount->addAttribute('FSType', $dev->getFsType()); |
} |
$mount->addAttribute('Name', $dev->getName()); |
$mount->addAttribute('Free', sprintf("%.0f", $dev->getFree())); |
$mount->addAttribute('Used', sprintf("%.0f", $dev->getUsed())); |
$mount->addAttribute('Total', sprintf("%.0f", $dev->getTotal())); |
$mount->addAttribute('Percent', $dev->getPercentUsed()); |
$percentUsed = $dev->getPercentUsed(); |
$mount->addAttribute('Percent', $percentUsed); |
if ($dev->getPercentInodesUsed() !== null) { |
$mount->addAttribute('Inodes', $dev->getPercentInodesUsed()); |
} |
if ($dev->getIgnore() > 0) $mount->addAttribute('Ignore', $dev->getIgnore()); |
if (PSI_SHOW_MOUNT_OPTION === true) { |
if ($dev->getOptions() !== null) { |
435,9 → 467,6 |
$mount->addAttribute('MountOptions', preg_replace("/,/", ", ", $dev->getOptions())); |
} |
} |
if ($dev->getPercentInodesUsed() !== null) { |
$mount->addAttribute('Inodes', $dev->getPercentInodesUsed()); |
} |
if (PSI_SHOW_MOUNT_POINT === true) { |
$mount->addAttribute('MountPoint', $dev->getMountPoint()); |
} |
450,7 → 479,7 |
*/ |
private function _buildFilesystems() |
{ |
$hideMounts = $hideFstypes = $hideDisks = $ignoreFree = $ignoreUsage = $ignoreThreshold = array(); |
$hideMounts = $hideFstypes = $hideDisks = $ignoreFree = $ignoreTotal = $ignoreUsage = $ignoreThreshold = array(); |
$i = 1; |
if (defined('PSI_HIDE_MOUNTS') && is_string(PSI_HIDE_MOUNTS)) { |
if (preg_match(ARRAY_EXP, PSI_HIDE_MOUNTS)) { |
484,6 → 513,13 |
$ignoreFree = array(PSI_IGNORE_FREE); |
} |
} |
if (defined('PSI_IGNORE_TOTAL') && is_string(PSI_IGNORE_TOTAL)) { |
if (preg_match(ARRAY_EXP, PSI_IGNORE_TOTAL)) { |
$ignoreTotal = eval(PSI_IGNORE_TOTAL); |
} else { |
$ignoreTotal = array(PSI_IGNORE_TOTAL); |
} |
} |
if (defined('PSI_IGNORE_USAGE') && is_string(PSI_IGNORE_USAGE)) { |
if (preg_match(ARRAY_EXP, PSI_IGNORE_USAGE)) { |
$ignoreUsage = eval(PSI_IGNORE_USAGE); |
503,8 → 539,10 |
if (!in_array($disk->getMountPoint(), $hideMounts, true) && !in_array($disk->getFsType(), $hideFstypes, true) && !in_array($disk->getName(), $hideDisks, true)) { |
$mount = $fs->addChild('Mount'); |
if (in_array($disk->getFsType(), $ignoreThreshold, true)) { |
$disk->setIgnore(4); |
} elseif (in_array($disk->getMountPoint(), $ignoreUsage, true)) { |
$disk->setIgnore(3); |
} elseif (in_array($disk->getMountPoint(), $ignoreUsage, true)) { |
} elseif (in_array($disk->getMountPoint(), $ignoreTotal, true)) { |
$disk->setIgnore(2); |
} elseif (in_array($disk->getMountPoint(), $ignoreFree, true)) { |
$disk->setIgnore(1); |
554,6 → 592,9 |
if ($dev->getMin() !== null) { |
$item->addAttribute('Min', $dev->getMin()); |
} |
if ($dev->getUnit() !== "") { |
$item->addAttribute('Unit', $dev->getUnit()); |
} |
if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") { |
$item->addAttribute('Event', $dev->getEvent()); |
} |
566,12 → 607,14 |
$item = $volt->addChild('Item'); |
$item->addAttribute('Label', $dev->getName()); |
$item->addAttribute('Value', $dev->getValue()); |
if ($dev->getMin() !== null) { |
$item->addAttribute('Min', $dev->getMin()); |
if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) { |
if ($dev->getMin() !== null) { |
$item->addAttribute('Min', $dev->getMin()); |
} |
if ($dev->getMax() !== null) { |
$item->addAttribute('Max', $dev->getMax()); |
} |
} |
if ($dev->getMax() !== null) { |
$item->addAttribute('Max', $dev->getMax()); |
} |
if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") { |
$item->addAttribute('Event', $dev->getEvent()); |
} |
599,12 → 642,14 |
$item = $current->addChild('Item'); |
$item->addAttribute('Label', $dev->getName()); |
$item->addAttribute('Value', $dev->getValue()); |
if ($dev->getMin() !== null) { |
$item->addAttribute('Min', $dev->getMin()); |
if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) { |
if ($dev->getMin() !== null) { |
$item->addAttribute('Min', $dev->getMin()); |
} |
if ($dev->getMax() !== null) { |
$item->addAttribute('Max', $dev->getMax()); |
} |
} |
if ($dev->getMax() !== null) { |
$item->addAttribute('Max', $dev->getMax()); |
} |
if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") { |
$item->addAttribute('Event', $dev->getEvent()); |
} |
617,6 → 662,9 |
$item = $other->addChild('Item'); |
$item->addAttribute('Label', $dev->getName()); |
$item->addAttribute('Value', $dev->getValue()); |
if ($dev->getUnit() !== "") { |
$item->addAttribute('Unit', $dev->getUnit()); |
} |
if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") { |
$item->addAttribute('Event', $dev->getEvent()); |
} |
698,7 → 746,7 |
*/ |
private function _buildXml() |
{ |
if (!$this->_plugin_request || $this->_complete_request) { |
if (($this->_plugin == '') || $this->_complete_request) { |
if ($this->_sys === null) { |
if (PSI_DEBUG === true) { |
// unstable version check |
761,20 → 809,23 |
private function _buildPlugins() |
{ |
$pluginroot = $this->_xml->addChild("Plugins"); |
if (($this->_plugin_request || $this->_complete_request) && count($this->_plugins) > 0) { |
if ((($this->_plugin != '') || $this->_complete_request) && count($this->_plugins) > 0) { |
$plugins = array(); |
if ($this->_complete_request) { |
$plugins = $this->_plugins; |
} |
if ($this->_plugin_request) { |
if (($this->_plugin != '')) { |
$plugins = array($this->_plugin); |
} |
foreach ($plugins as $plugin) { |
$object = new $plugin($this->_sysinfo->getEncoding()); |
$object->execute(); |
$oxml = $object->xml(); |
if (sizeof($oxml) > 0) { |
$pluginroot->combinexml($oxml); |
if (!$this->_complete_request || !defined('PSI_PLUGIN_'.strtoupper($plugin).'_WMI_HOSTNAME') || |
(defined('PSI_WMI_HOSTNAME') && (PSI_WMI_HOSTNAME == constant('PSI_PLUGIN_'.strtoupper($plugin).'_WMI_HOSTNAME')))) { |
$object = new $plugin($this->_sysinfo->getEncoding()); |
$object->execute(); |
$oxml = $object->xml(); |
if (sizeof($oxml) > 0) { |
$pluginroot->combinexml($oxml); |
} |
} |
} |
} |
815,7 → 866,7 |
$options->addAttribute('threshold', 90); |
} |
if (count($this->_plugins) > 0) { |
if ($this->_plugin_request) { |
if (($this->_plugin != '')) { |
$plug = $this->_xml->addChild('UsedPlugins'); |
$plug->addChild('Plugin')->addAttribute('name', $this->_plugin); |
} elseif ($this->_complete_request) { |