[Phpsysinfo-subversion] SF.net SVN: phpsysinfo:[697] branches/namiltd-ini
Brought to you by:
namiltd
|
From: <na...@us...> - 2012-09-10 18:04:04
|
Revision: 697
http://phpsysinfo.svn.sourceforge.net/phpsysinfo/?rev=697&view=rev
Author: namiltd
Date: 2012-09-10 18:03:58 +0000 (Mon, 10 Sep 2012)
Log Message:
-----------
ReactOS minor support
Modified Paths:
--------------
branches/namiltd-ini/ChangeLog
branches/namiltd-ini/README
branches/namiltd-ini/includes/os/class.WINNT.inc.php
Modified: branches/namiltd-ini/ChangeLog
===================================================================
--- branches/namiltd-ini/ChangeLog 2012-09-09 11:24:04 UTC (rev 696)
+++ branches/namiltd-ini/ChangeLog 2012-09-10 18:03:58 UTC (rev 697)
@@ -4,6 +4,7 @@
- [ADD] Turbolinux to detected distros
- [ADD] Show System Language and Charmap on Linux and WINNT
+ - [ADD] Minor support of ReactOS
- [UPD] Configuration moved from config.php and subdirs of "plugins" to one file phpsysinfo.ini
- [UPD] Plugin ipmi ranamed to IPMIInfo and Update-Notifier to UpdateNotifier (to avoid name conflicts)
Modified: branches/namiltd-ini/README
===================================================================
--- branches/namiltd-ini/README 2012-09-09 11:24:04 UTC (rev 696)
+++ branches/namiltd-ini/README 2012-09-10 18:03:58 UTC (rev 697)
@@ -25,6 +25,7 @@
- Haiku
- Minix
- SunOS
+ - ReactOS
If your platform is not here try checking out the mailing list archives or
the message boards on SourceForge.
Modified: branches/namiltd-ini/includes/os/class.WINNT.inc.php
===================================================================
--- branches/namiltd-ini/includes/os/class.WINNT.inc.php 2012-09-09 11:24:04 UTC (rev 696)
+++ branches/namiltd-ini/includes/os/class.WINNT.inc.php 2012-09-10 18:03:58 UTC (rev 697)
@@ -180,7 +180,7 @@
private function _hostname()
{
if (PSI_USE_VHOST === true) {
- $this->sys->setHostname(getenv('SERVER_NAME'));
+ if ($hnm = getenv('SERVER_NAME')) $this->sys->setHostname($hnm);
} else {
$buffer = $this->_getWMI('Win32_ComputerSystem', array('Name'));
if ($buffer) {
@@ -189,6 +189,8 @@
if ($ip != $result) {
$this->sys->setHostname(gethostbyaddr($ip));
}
+ } else {
+ if ($hnm = getenv('COMPUTERNAME')) $this->sys->setHostname($hnm);
}
}
}
@@ -201,12 +203,16 @@
private function _ip()
{
if (PSI_USE_VHOST === true) {
- $this->sys->setIp(gethostbyname($this->sys->getHostname()));
+ if ( (($hnm=$this->sys->getHostname()) != 'localhost') &&
+ (($hip=gethostbyname($hnm)) != $hnm) ) $this->sys->setIp($hip);
} else {
$buffer = $this->_getWMI('Win32_ComputerSystem', array('Name'));
if ($buffer) {
$result = $buffer[0]['Name'];
$this->sys->setIp(gethostbyname($result));
+ } else {
+ if ( (($hnm=$this->sys->getHostname()) != 'localhost') &&
+ (($hip=gethostbyname($hnm)) != $hnm) ) $this->sys->setIp($hip);
}
}
}
@@ -284,12 +290,12 @@
else
$icon = 'WinXP.png';
$this->sys->setDistributionIcon($icon);
- } else if (CommonFunctions::executeProgram("cmd", "/c ver", $ver_value)) {
+ } else if (CommonFunctions::executeProgram("cmd", "/c ver 2>nul", $ver_value, false)) {
if (preg_match("/ReactOS\nVersion\s+(.+)/", $ver_value, $ar_temp)){
$this->sys->setDistribution("ReactOS");
$this->sys->setKernel($ar_temp[1]);
$this->sys->setDistributionIcon('ReactOS.png');
- }else if (preg_match("/^(Microsoft [^\[]*)\s*\[(.+)\]/", $ver_value, $ar_temp)){
+ } else if (preg_match("/^(Microsoft [^\[]*)\s*\[\D*\s*(.+)\]/", $ver_value, $ar_temp)){
$this->sys->setDistribution($ar_temp[1]);
$this->sys->setKernel($ar_temp[2]);
$this->sys->setDistributionIcon('Win2000.png');
@@ -494,6 +500,27 @@
}
$this->sys->setDiskDevices($dev);
}
+ if ((!$buffer) && ($this->sys->getDistribution()=="ReactOS")){
+ // test for command 'free' on current disk
+ if (CommonFunctions::executeProgram("cmd", "/c free 2>nul", $out_value, true)) {
+ for ($letter='A'; $letter!='AA'; $letter++) if (CommonFunctions::executeProgram("cmd", "/c free ".$letter.": 2>nul", $out_value, false)){
+ if (preg_match('/\n\s*([\d\.\,]+).*\n\s*([\d\.\,]+).*\n\s*([\d\.\,]+).*$/',$out_value, $out_dig )) {
+ $size = preg_replace('/(\.)|(\,)/', '', $out_dig[1]);
+ $used = preg_replace('/(\.)|(\,)/', '', $out_dig[2]);
+ $free = preg_replace('/(\.)|(\,)/', '', $out_dig[3]);
+ if ($used + $free == $size ) {
+ $dev = new DiskDevice();
+ $dev->setMountPoint($letter.":");
+ $dev->setFsType('Unknown');
+ $dev->setTotal($size);
+ $dev->setFree($free);
+ $dev->setUsed($used);
+ $this->sys->setDiskDevices($dev);
+ }
+ }
+ }
+ }
+ }
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|