Subversion Repositories ALCASAR

Rev

Rev 325 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log

Rev 325 Rev 2770
Line 1... Line 1...
1
<?php 
1
<?php
-
 
2
/**
-
 
3
 * WINNT System Class
-
 
4
 *
-
 
5
 * PHP version 5
-
 
6
 *
-
 
7
 * @category  PHP
2
// phpSysInfo - A PHP System Information Script
8
 * @package   PSI WINNT OS class
-
 
9
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
-
 
10
 * @copyright 2009 phpSysInfo
-
 
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
-
 
12
 * @version   SVN: $Id: class.WINNT.inc.php 699 2012-09-15 11:57:13Z namiltd $
3
// http://phpsysinfo.sourceforge.net/
13
 * @link      http://phpsysinfo.sourceforge.net
-
 
14
 */
-
 
15
 /**
-
 
16
 * WINNT sysinfo class
4
// This program is free software; you can redistribute it and/or
17
 * get all the required information from WINNT systems
5
// modify it under the terms of the GNU General Public License
18
 * information are retrieved through the WMI interface
-
 
19
 *
-
 
20
 * @category  PHP
-
 
21
 * @package   PSI WINNT OS class
6
// as published by the Free Software Foundation; either version 2
22
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
-
 
23
 * @copyright 2009 phpSysInfo
7
// of the License, or (at your option) any later version.
24
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
-
 
25
 * @version   Release: 3.0
-
 
26
 * @link      http://phpsysinfo.sourceforge.net
-
 
27
 */
-
 
28
class WINNT extends OS
-
 
29
{
-
 
30
    /**
8
// This program is distributed in the hope that it will be useful,
31
     * holds the data from WMI Win32_OperatingSystem
-
 
32
     *
-
 
33
     * @var array
-
 
34
     */
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
35
    private $_Win32_OperatingSystem = null;
-
 
36
 
-
 
37
    /**
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
38
     * holds the data from WMI Win32_ComputerSystem
-
 
39
     *
-
 
40
     * @var array
-
 
41
     */
11
// GNU General Public License for more details.
42
    private $_Win32_ComputerSystem = null;
-
 
43
 
-
 
44
    /**
12
// You should have received a copy of the GNU General Public License
45
     * holds the data from WMI Win32_Processor
-
 
46
     *
-
 
47
     * @var array
-
 
48
     */
-
 
49
    private $_Win32_Processor = null;
-
 
50
 
-
 
51
     /**
13
// along with this program; if not, write to the Free Software
52
     * holds the data from WMI Win32_PerfFormattedData_PerfOS_Processor
-
 
53
     *
-
 
54
     * @var array
-
 
55
     */
14
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
56
    private $_Win32_PerfFormattedData_PerfOS_Processor = null;
-
 
57
 
-
 
58
    /**
15
// WINNT implementation written by Carl C. Longnecker, longneck@iname.com
59
     * holds the data from systeminfo command
-
 
60
     *
-
 
61
     * @var string
-
 
62
     */
-
 
63
    private $_systeminfo = null;
-
 
64
 
-
 
65
    /**
16
// $Id: class.WINNT.inc.php,v 1.25 2007/03/07 20:21:27 bigmichi1 Exp $
66
     * holds the COM object that we pull all the WMI data from
-
 
67
     *
-
 
68
     * @var Object
-
 
69
     */
-
 
70
    private $_wmi = null;
17
 
71
 
-
 
72
    /**
-
 
73
     * holds the COM object that we pull all the RegRead data from
-
 
74
     *
18
class sysinfo {
75
     * @var Object
-
 
76
     */
-
 
77
    private $_reg = null;
-
 
78
 
-
 
79
    /**
19
  // $wmi holds the COM object that we pull all the WMI data from
80
     * holds the COM object that we pull all the EnumKey data from
-
 
81
     *
20
  var $wmi; 
82
     * @var Object
-
 
83
     */
-
 
84
    private $_key = null;
21
 
85
 
-
 
86
    /**
22
  // $wmidevices holds all devices, which are in the system
87
     * holds all devices, which are in the system
-
 
88
     *
-
 
89
     * @var array
-
 
90
     */
23
  var $wmidevices;
91
    private $_wmidevices;
24
 
92
 
-
 
93
    /**
25
  // this constructor initialis the $wmi object
94
     * holds all disks, which are in the system
-
 
95
     *
-
 
96
     * @var array
-
 
97
     */
-
 
98
    private $_wmidisks;
-
 
99
 
-
 
100
    /**
-
 
101
     * store language encoding of the system to convert some output to utf-8
-
 
102
     *
-
 
103
     * @var string
-
 
104
     */
-
 
105
    private $_codepage = null;
-
 
106
 
-
 
107
    /**
-
 
108
     * store language of the system
-
 
109
     *
26
  function sysinfo ()
110
     * @var string
-
 
111
     */
-
 
112
    private $_syslang = null;
-
 
113
 
-
 
114
    /**
-
 
115
     * reads the data from WMI Win32_OperatingSystem
-
 
116
     *
-
 
117
     * @return array
-
 
118
     */
-
 
119
    private function _get_Win32_OperatingSystem()
27
  {
120
    {
28
    // don't set this params for local connection, it will not work
121
        if ($this->_Win32_OperatingSystem === null) $this->_Win32_OperatingSystem = CommonFunctions::getWMI($this->_wmi, 'Win32_OperatingSystem', array('CodeSet', 'Locale', 'LastBootUpTime', 'LocalDateTime', 'Version', 'ServicePackMajorVersion', 'Caption', 'OSArchitecture', 'TotalVisibleMemorySize', 'FreePhysicalMemory'));
-
 
122
        return $this->_Win32_OperatingSystem;
-
 
123
    }
-
 
124
 
-
 
125
    /**
-
 
126
     * reads the data from WMI Win32_ComputerSystem
-
 
127
     *
-
 
128
     * @return array
-
 
129
     */
-
 
130
    private function _get_Win32_ComputerSystem()
-
 
131
    {
-
 
132
        if ($this->_Win32_ComputerSystem === null) $this->_Win32_ComputerSystem = CommonFunctions::getWMI($this->_wmi, 'Win32_ComputerSystem', array('Name', 'Manufacturer', 'Model'));
-
 
133
        return $this->_Win32_ComputerSystem;
-
 
134
    }
-
 
135
 
-
 
136
    /**
-
 
137
     * reads the data from WMI Win32_Processor
-
 
138
     *
-
 
139
     * @return array
-
 
140
     */
-
 
141
    private function _get_Win32_Processor()
-
 
142
    {
29
    $strHostname = '';
143
        if ($this->_Win32_Processor === null) $this->_Win32_Processor = CommonFunctions::getWMI($this->_wmi, 'Win32_Processor', array('LoadPercentage', 'AddressWidth', 'Name', 'L2CacheSize', 'L3CacheSize', 'CurrentClockSpeed', 'ExtClock', 'NumberOfCores', 'NumberOfLogicalProcessors', 'MaxClockSpeed', 'Manufacturer'));
-
 
144
        return $this->_Win32_Processor;
-
 
145
    }
-
 
146
 
-
 
147
    /**
-
 
148
     * reads the data from WMI Win32_PerfFormattedData_PerfOS_Processor
-
 
149
     *
30
    $strUser = '';
150
     * @return array
-
 
151
     */
-
 
152
    private function _get_Win32_PerfFormattedData_PerfOS_Processor()
-
 
153
    {
-
 
154
        if ($this->_Win32_PerfFormattedData_PerfOS_Processor === null) {
-
 
155
            $this->_Win32_PerfFormattedData_PerfOS_Processor = array();
-
 
156
            $buffer = $this->_get_Win32_OperatingSystem();
-
 
157
            if ($buffer && isset($buffer[0]) && isset($buffer[0]['Version']) && version_compare($buffer[0]['Version'], "5.1", ">=")) { // minimal windows 2003 or windows XP
-
 
158
                $cpubuffer = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfFormattedData_PerfOS_Processor', array('Name', 'PercentProcessorTime'));
-
 
159
                if ($cpubuffer) foreach ($cpubuffer as $cpu) {
-
 
160
                    if (isset($cpu['Name']) && isset($cpu['PercentProcessorTime'])) {
-
 
161
                        $this->_Win32_PerfFormattedData_PerfOS_Processor['cpu'.$cpu['Name']] = $cpu['PercentProcessorTime'];
31
    $strPassword = '';
162
                    }
-
 
163
                }
-
 
164
            }
-
 
165
        }
32
 
166
 
-
 
167
        return $this->_Win32_PerfFormattedData_PerfOS_Processor;
-
 
168
    }
-
 
169
 
-
 
170
    /**
-
 
171
     * reads the data from systeminfo
-
 
172
     *
-
 
173
     * @return string
-
 
174
     */
-
 
175
    private function _get_systeminfo()
-
 
176
    {
-
 
177
        if ($this->_systeminfo === null) CommonFunctions::executeProgram('systeminfo', '', $this->_systeminfo, false);
-
 
178
        return $this->_systeminfo;
-
 
179
    }
-
 
180
 
-
 
181
    /**
-
 
182
     * build the global Error object and create the WMI connection
-
 
183
     */
-
 
184
    public function __construct($blockname = false)
-
 
185
    {
-
 
186
        parent::__construct($blockname);
-
 
187
        try {
33
    // initialize the wmi object
188
            // initialize the wmi object
34
    $objLocator = new COM("WbemScripting.SWbemLocator");
189
            $objLocator = new COM('WbemScripting.SWbemLocator');
-
 
190
            $this->_wmi = $objLocator->ConnectServer('', 'root\CIMv2');
-
 
191
        } catch (Exception $e) {
-
 
192
            $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.");
-
 
193
        }
-
 
194
        try {
-
 
195
            // initialize the RegRead object
-
 
196
            $this->_reg = new COM("WScript.Shell");
-
 
197
        } catch (Exception $e) {
-
 
198
            //$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.");
-
 
199
            $this->_reg = false;
-
 
200
        }
-
 
201
        try {
-
 
202
            // initialize the EnumKey object
-
 
203
            $this->_key = new COM("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\default:StdRegProv");
-
 
204
        } catch (Exception $e) {
35
    if($strHostname == "") {
205
            //$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.");
-
 
206
            $this->_key = false;
-
 
207
        }
-
 
208
 
36
        $this->wmi = $objLocator->ConnectServer();
209
        $this->_getCodeSet();
-
 
210
    }
-
 
211
 
-
 
212
    /**
-
 
213
     * store the codepage of the os for converting some strings to utf-8
-
 
214
     *
-
 
215
     * @return void
-
 
216
     */
-
 
217
    private function _getCodeSet()
-
 
218
    {
-
 
219
        $buffer = $this->_get_Win32_OperatingSystem();
-
 
220
        if (!$buffer) {
-
 
221
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP", $strBuf, false)) {
-
 
222
                $buffer[0]['CodeSet'] = $strBuf;
-
 
223
            }
-
 
224
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\Language\\Default", $strBuf, false)) {
-
 
225
                $buffer[0]['Locale'] = $strBuf;
-
 
226
            }
-
 
227
        }
-
 
228
        if ($buffer && isset($buffer[0])) {
-
 
229
            if (isset($buffer[0]['CodeSet'])) {
-
 
230
                $codeset = $buffer[0]['CodeSet'];
-
 
231
                if ($codeset == 932) {
-
 
232
                    $codename = ' (SJIS)';
-
 
233
                } elseif ($codeset == 949) {
-
 
234
                    $codename = ' (EUC-KR)';
-
 
235
                } elseif ($codeset == 950) {
-
 
236
                    $codename = ' (BIG-5)';
37
      } else{
237
                } else {
-
 
238
                    $codename = '';
-
 
239
                }
-
 
240
                CommonFunctions::setcp($codeset);
-
 
241
                $this->_codepage = 'windows-'.$codeset.$codename;
-
 
242
            }
38
        $this->wmi = $objLocator->ConnectServer($strHostname, "rootcimv2", "$strHostname\$strUser", $strPassword);
243
            if (isset($buffer[0]['Locale']) && (($locale = hexdec($buffer[0]['Locale']))>0)) {
-
 
244
                $lang = "";
-
 
245
                if (is_readable(PSI_APP_ROOT.'/data/languages.ini') && ($langdata = @parse_ini_file(PSI_APP_ROOT.'/data/languages.ini', true))) {
-
 
246
                    if (isset($langdata['WINNT'][$locale])) {
-
 
247
                        $lang = $langdata['WINNT'][$locale];
-
 
248
                    }
-
 
249
                }
-
 
250
                if ($lang == "") {
-
 
251
                    $lang = 'Unknown';
-
 
252
                }
-
 
253
                $this->_syslang = $lang.' ('.$locale.')';
39
      }
254
            }
40
  } 
255
        }
41
 
-
 
42
  // private function for getting a list of values in the specified context, optionally filter this list, based on the list from second parameter
-
 
43
  function _GetWMI($strClass, $strValue = array() ) {
-
 
44
    $objWEBM = $this->wmi->Get($strClass);
-
 
45
 
-
 
46
    if( PHP_VERSION < 5 ) {
-
 
47
      $objProp = $objWEBM->Properties_;
-
 
48
      $arrProp = $objProp->Next($objProp->Count);
-
 
49
      $objWEBMCol = $objWEBM->Instances_();
-
 
50
      $arrWEBMCol = $objWEBMCol->Next($objWEBMCol->Count);
-
 
51
    } else {
-
 
52
      $arrProp = $objWEBM->Properties_;
-
 
53
      $arrWEBMCol = $objWEBM->Instances_();
-
 
54
    }
256
    }
55
 
257
 
-
 
258
    /**
-
 
259
     * retrieve different device types from the system based on selector
-
 
260
     *
-
 
261
     * @param string $strType type of the devices that should be returned
-
 
262
     *
-
 
263
     * @return array list of devices of the specified type
-
 
264
     */
56
    foreach($arrWEBMCol as $objItem)
265
    private function _devicelist($strType)
57
    {
266
    {
58
        @reset($arrProp);
267
        if (empty($this->_wmidevices)) {
59
        $arrInstance = array();
-
 
60
        foreach($arrProp as $propItem)
268
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
61
        {
-
 
62
            eval("\$value = \$objItem->" .$propItem->Name .";");
269
                $this->_wmidevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID', 'Manufacturer', 'PNPClass'));
63
            if( empty( $strValue ) ) {
270
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
64
              $arrInstance[$propItem->Name] = trim($value);
271
                    $this->_wmidisks = CommonFunctions::getWMI($this->_wmi, 'Win32_DiskDrive', array('PNPDeviceID', 'Size', 'SerialNumber'));
65
            } else {
272
                } else {
66
              if( in_array( $propItem->Name, $strValue ) ) {
-
 
67
                $arrInstance[$propItem->Name] = trim($value);
273
                    $this->_wmidisks = CommonFunctions::getWMI($this->_wmi, 'Win32_DiskDrive', array('PNPDeviceID', 'Size'));
68
              }
274
                }
-
 
275
            } else {
-
 
276
                $this->_wmidevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID'));
-
 
277
                $this->_wmidisks = array();
69
            }
278
            }
70
        }
279
        }
71
        $arrData[] = $arrInstance;
280
        $list = array();
-
 
281
        foreach ($this->_wmidevices as $device) {
-
 
282
            if (substr($device['PNPDeviceID'], 0, strpos($device['PNPDeviceID'], "\\") + 1) == ($strType."\\")) {
-
 
283
                if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
-
 
284
                    if (!isset($device['PNPClass']) || ($device['PNPClass']===$strType) || ($device['PNPClass']==='System')) {
-
 
285
                        $device['PNPClass'] = null;
72
    }
286
                    }
-
 
287
                    if (preg_match('/^\(.*\)$/', $device['Manufacturer'])) {
73
    return $arrData;
288
                        $device['Manufacturer'] = null;
74
  }
289
                    }
75
 
-
 
76
  // private function for getting different device types from the system
290
                    $device['Capacity'] = null;
77
  function _devicelist ( $strType ) {
291
                    if (($strType==='IDE')||($strType==='SCSI')) {
78
    if( empty( $this->wmidevices ) ) {
292
                        foreach ($this->_wmidisks as $disk) {
79
      $this->wmidevices = $this->_GetWMI( "Win32_PnPEntity", array( "Name", "PNPDeviceID" ) );
293
                            if (($disk['PNPDeviceID'] === $device['PNPDeviceID']) && isset($disk['Size'])) {
-
 
294
                                $device['Capacity'] = $disk['Size'];
-
 
295
                                break;
80
    }
296
                            }
81
 
-
 
82
    $list = array();
-
 
83
    foreach ( $this->wmidevices as $device ) {
-
 
84
      if ( substr( $device["PNPDeviceID"], 0, strpos( $device["PNPDeviceID"], "\\" ) + 1 ) == ( $strType . "\\" ) ) {
-
 
85
        $list[] = $device["Name"];
-
 
86
      } 
297
                        }
87
    }
298
                    }
88
 
-
 
89
    return $list;
299
                    $device['Serial'] = null;
-
 
300
                    if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
-
 
301
                        if ($strType==='USB') {
-
 
302
                            if (preg_match('/\\\\(\w+)$/', $device['PNPDeviceID'], $buf)) {
-
 
303
                                $device['Serial'] = $buf[1];
90
  }
304
                            }
91
  
-
 
92
  // get our apache SERVER_NAME or vhost
305
                        } elseif (($strType==='IDE')||($strType==='SCSI')) {
93
  function vhostname () {
306
                            foreach ($this->_wmidisks as $disk) {
-
 
307
                                if (($disk['PNPDeviceID'] === $device['PNPDeviceID']) && isset($disk['SerialNumber'])) {
94
    if (! ($result = getenv('SERVER_NAME'))) {
308
                                    $device['Serial'] = $disk['SerialNumber'];
95
      $result = 'N.A.';
309
                                    break;
96
    } 
310
                                }
97
    return $result;
-
 
98
  } 
311
                            }
99
 
-
 
100
  // get the IP address of our vhost name
-
 
101
  function vip_addr () {
-
 
102
    return gethostbyname($this->vhostname());
-
 
103
  }
312
                        }
104
 
-
 
105
  // get our canonical hostname
313
                    }
-
 
314
                    $list[] = array('Name'=>$device['Name'], 'Manufacturer'=>$device['Manufacturer'], 'Product'=>$device['PNPClass'], 'Capacity'=>$device['Capacity'], 'Serial'=>$device['Serial']);
106
  function chostname ()
315
                } else {
107
  {
-
 
108
    $buffer = $this->_GetWMI( "Win32_ComputerSystem", array( "Name" ) );
316
                    $list[] = array('Name'=>$device['Name']);
109
    $result = $buffer[0]["Name"];
317
                }
110
    return gethostbyaddr(gethostbyname($result));
318
            }
111
  }
319
        }
112
 
320
 
113
  // get the IP address of our canonical hostname
-
 
114
  function ip_addr ()
-
 
115
  {
-
 
116
    $buffer = $this->_GetWMI( "Win32_ComputerSystem", array( "Name" ) );
-
 
117
    $result = $buffer[0]["Name"];
-
 
118
    return gethostbyname($result);
321
        return $list;
119
  }
322
    }
120
 
323
 
-
 
324
    /**
-
 
325
     * Host Name
-
 
326
     *
-
 
327
     * @return void
-
 
328
     */
121
  function kernel ()
329
    private function _hostname()
122
  {
330
    {
-
 
331
        if (PSI_USE_VHOST === true) {
-
 
332
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
-
 
333
        } else {
123
    $buffer = $this->_GetWMI( "Win32_OperatingSystem", array( "Version", "ServicePackMajorVersion" ) );
334
            $buffer = $this->_get_Win32_ComputerSystem();
-
 
335
            if (!$buffer && CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName\\ComputerName", $strBuf, false) && (strlen($strBuf) > 0)) {
-
 
336
                    $buffer[0]['Name'] = $strBuf;
-
 
337
            }
-
 
338
            if ($buffer) {
124
    $result = $buffer[0]["Version"];
339
                $result = $buffer[0]['Name'];
-
 
340
                $ip = gethostbyname($result);
125
    if( $buffer[0]["ServicePackMajorVersion"] > 0 ) {
341
                if ($ip != $result) {
-
 
342
                    if ((version_compare("10.0.0.0", $ip, "<=") && version_compare($ip, "10.255.255.255", "<=")) ||
-
 
343
                        (version_compare("172.16.0.0", $ip, "<=") && version_compare($ip, "172.31.255.255", "<=")) ||
-
 
344
                        (version_compare("192.168.0.0", $ip, "<=") && version_compare($ip, "192.168.255.255", "<=")) ||
-
 
345
                        (version_compare("127.0.0.0", $ip, "<=") && version_compare($ip, "127.255.255.255", "<=")) ||
-
 
346
                        (version_compare("169.254.1.0", $ip, "<=") && version_compare($ip, "169.254.254.255", "<=")) ||
-
 
347
                        (version_compare("255.255.255.255", $ip, "=="))) {
-
 
348
                        $this->sys->setHostname($result); // internal ip
-
 
349
                    } else {
126
      $result .= " SP" . $buffer[0]["ServicePackMajorVersion"];
350
                        $this->sys->setHostname(gethostbyaddr($ip));
-
 
351
                    }
-
 
352
                }
-
 
353
            } else {
-
 
354
                if (CommonFunctions::readenv('COMPUTERNAME', $hnm)) $this->sys->setHostname($hnm);
-
 
355
            }
127
    }
356
        }
128
    return $result;
-
 
129
  } 
357
    }
130
 
358
 
-
 
359
    /**
-
 
360
     * UpTime
131
  // get the time the system is running
361
     * time the system is running
-
 
362
     *
-
 
363
     * @return void
-
 
364
     */
132
  function uptime ()
365
    private function _uptime()
133
  {
366
    {
134
    $result = 0;
367
        $result = 0;
-
 
368
        date_default_timezone_set('UTC');
135
    $buffer = $this->_GetWMI( "Win32_OperatingSystem", array( "LastBootUpTime", "LocalDateTime" ) );
369
        $buffer = $this->_get_Win32_OperatingSystem();
-
 
370
        if ($buffer && ($buffer[0]['LastBootUpTime'] !== null)) {
-
 
371
            $local = $buffer[0]['LocalDateTime'];
-
 
372
            $boot = $buffer[0]['LastBootUpTime'];
-
 
373
 
-
 
374
            $lyear = intval(substr($local, 0, 4));
-
 
375
            $lmonth = intval(substr($local, 4, 2));
-
 
376
            $lday = intval(substr($local, 6, 2));
-
 
377
            $lhour = intval(substr($local, 8, 2));
-
 
378
            $lminute = intval(substr($local, 10, 2));
-
 
379
            $lseconds = intval(substr($local, 12, 2));
-
 
380
            $loffset = intval(substr($boot, 21, 4));
-
 
381
 
-
 
382
            $byear = intval(substr($boot, 0, 4));
-
 
383
            $bmonth = intval(substr($boot, 4, 2));
-
 
384
            $bday = intval(substr($boot, 6, 2));
-
 
385
            $bhour = intval(substr($boot, 8, 2));
-
 
386
            $bminute = intval(substr($boot, 10, 2));
-
 
387
            $bseconds = intval(substr($boot, 12, 2));
-
 
388
            $boffset = intval(substr($boot, 21, 4));
136
 
389
 
137
    $byear = intval(substr($buffer[0]["LastBootUpTime"], 0, 4));
-
 
138
    $bmonth = intval(substr($buffer[0]["LastBootUpTime"], 4, 2));
-
 
139
    $bday = intval(substr($buffer[0]["LastBootUpTime"], 6, 2));
390
            if (version_compare($buffer[0]['Version'], "5.1", "<")) { // fix LastBootUpTime on Windows 2000 and older
140
    $bhour = intval(substr($buffer[0]["LastBootUpTime"], 8, 2));
-
 
141
    $bminute = intval(substr($buffer[0]["LastBootUpTime"], 10, 2));
-
 
142
    $bseconds = intval(substr($buffer[0]["LastBootUpTime"], 12, 2));
-
 
143
 
-
 
144
    $lyear = intval(substr($buffer[0]["LocalDateTime"], 0, 4));
-
 
145
    $lmonth = intval(substr($buffer[0]["LocalDateTime"], 4, 2));
-
 
146
    $lday = intval(substr($buffer[0]["LocalDateTime"], 6, 2));
391
                $boffset += $boffset;
147
    $lhour = intval(substr($buffer[0]["LocalDateTime"], 8, 2));
392
            }
148
    $lminute = intval(substr($buffer[0]["LocalDateTime"], 10, 2));
-
 
149
    $lseconds = intval(substr($buffer[0]["LocalDateTime"], 12, 2));
-
 
150
 
393
 
151
    $boottime = mktime($bhour, $bminute, $bseconds, $bmonth, $bday, $byear);
394
            $localtime = mktime($lhour, $lminute, $lseconds, $lmonth, $lday, $lyear) - $loffset*60;
152
    $localtime = mktime($lhour, $lminute, $lseconds, $lmonth, $lday, $lyear);
395
            $boottime = mktime($bhour, $bminute, $bseconds, $bmonth, $bday, $byear) - $boffset*60;
153
 
396
 
154
    $result = $localtime - $boottime;
397
            $result = $localtime - $boottime;
155
 
398
 
-
 
399
            $this->sys->setUptime($result);
156
    return $result;
400
        } elseif (($this->sys->getDistribution()=="ReactOS") && CommonFunctions::executeProgram('uptime', '', $strBuf, false) && (strlen($strBuf) > 0) && preg_match("/^System Up Time:\s+(\d+) days, (\d+) Hours, (\d+) Minutes, (\d+) Seconds/", $strBuf, $ar_buf)) {
-
 
401
            $sec = $ar_buf[4];
-
 
402
            $min = $ar_buf[3];
-
 
403
            $hours = $ar_buf[2];
-
 
404
            $days = $ar_buf[1];
-
 
405
            $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60 + $sec);
-
 
406
        }
157
  } 
407
    }
158
 
408
 
-
 
409
    /**
159
  // count the users, which are logged in
410
     * Number of Users
-
 
411
     *
-
 
412
     * @return void
-
 
413
     */
160
  function users ()
414
    protected function _users()
161
  {
415
    {
-
 
416
        if (CommonFunctions::executeProgram('quser', '', $strBuf, false) && (strlen($strBuf) > 0)) {
162
    if( stristr( $this->kernel(), "2000 P" ) ) return "N.A."; 
417
                $lines = preg_split('/\n/', $strBuf);
-
 
418
                $users = count($lines)-1;
-
 
419
        } else {
-
 
420
            $users = 0;
163
    $buffer = $this->_GetWMI( "Win32_PerfRawData_TermService_TerminalServices", array( "TotalSessions" ) );
421
            $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_Process', array('Caption'));
-
 
422
            foreach ($buffer as $process) {
-
 
423
                if (strtoupper($process['Caption']) == strtoupper('explorer.exe')) {
-
 
424
                    $users++;
-
 
425
                }
-
 
426
            }
-
 
427
        }
-
 
428
        $this->sys->setUsers($users);
-
 
429
    }
-
 
430
 
-
 
431
    /**
-
 
432
     * Distribution
-
 
433
     *
-
 
434
     * @return void
-
 
435
     */
-
 
436
    private function _distro()
-
 
437
    {
-
 
438
        $buffer = $this->_get_Win32_OperatingSystem();
-
 
439
        if ($buffer) {
164
    return $buffer[0]["TotalSessions"];
440
            $ver = $buffer[0]['Version'];
-
 
441
            $kernel = $ver;
-
 
442
            if ($buffer[0]['ServicePackMajorVersion'] > 0) {
-
 
443
                $kernel .= ' SP'.$buffer[0]['ServicePackMajorVersion'];
-
 
444
            }
-
 
445
            if (isset($buffer[0]['OSArchitecture']) && preg_match("/^(\d+)/", $buffer[0]['OSArchitecture'], $bits)) {
-
 
446
                $this->sys->setKernel($kernel.' ('.$bits[1].'-bit)');
-
 
447
            } elseif (($allCpus = $this->_get_Win32_Processor()) && isset($allCpus[0]['AddressWidth'])) {
-
 
448
                $this->sys->setKernel($kernel.' ('.$allCpus[0]['AddressWidth'].'-bit)');
-
 
449
            } else {
-
 
450
                $this->sys->setKernel($kernel);
165
  } 
451
            }
-
 
452
            $this->sys->setDistribution($buffer[0]['Caption']);
166
 
453
 
-
 
454
            if (version_compare($ver, "5.1", "<"))
-
 
455
                $icon = 'Win2000.png';
-
 
456
            elseif (version_compare($ver, "5.1", ">=") && version_compare($ver, "6.0", "<"))
167
  // get the load of the processors
457
                $icon = 'WinXP.png';
-
 
458
            elseif (version_compare($ver, "6.0", ">=") && version_compare($ver, "6.2", "<"))
168
  function loadavg ($bar = false)
459
                $icon = 'WinVista.png';
169
  {
460
            else
-
 
461
                $icon = 'Win8.png';
-
 
462
            $this->sys->setDistributionIcon($icon);
-
 
463
        } elseif (CommonFunctions::executeProgram('cmd', '/c ver 2>nul', $ver_value, false)) {
170
    $buffer = $this->_GetWMI( "Win32_Processor", array( "LoadPercentage" ) );
464
                if (preg_match("/ReactOS\r?\nVersion\s+(.+)/", $ver_value, $ar_temp)) {
-
 
465
                    $this->sys->setDistribution("ReactOS");
171
    $cpuload = array();
466
                    $this->sys->setKernel($ar_temp[1]);
-
 
467
                    $this->sys->setDistributionIcon('ReactOS.png');
-
 
468
                    $this->_wmi = false; // No WMI info on ReactOS yet
-
 
469
                } elseif (preg_match("/^(Microsoft [^\[]*)\s*\[\D*\s*(.+)\]/", $ver_value, $ar_temp)) {
-
 
470
                    if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName", $strBuf, false) && (strlen($strBuf) > 0)) {
172
    for( $i = 0; $i < count( $buffer ); $i++ ) {
471
                        if (preg_match("/^Microsoft /", $strBuf)) {
173
      $cpuload['avg'][] = $buffer[$i]["LoadPercentage"];
472
                            $this->sys->setDistribution($strBuf);
-
 
473
                        } else {
-
 
474
                            $this->sys->setDistribution("Microsoft ".$strBuf);
174
    }
475
                        }
-
 
476
                    } else {
-
 
477
                        $this->sys->setDistribution($ar_temp[1]);
-
 
478
                    }
-
 
479
                    $kernel = $ar_temp[2];
-
 
480
                    $this->sys->setKernel($kernel);
-
 
481
                    if ((($kernel[1] == '.') && ($kernel[0] <5)) || (substr($kernel, 0, 4) == '5.0.'))
-
 
482
                        $icon = 'Win2000.png';
-
 
483
                    elseif ((substr($kernel, 0, 4) == '6.0.') || (substr($kernel, 0, 4) == '6.1.'))
-
 
484
                        $icon = 'WinVista.png';
-
 
485
                    elseif ((substr($kernel, 0, 4) == '6.2.') || (substr($kernel, 0, 4) == '6.3.') || (substr($kernel, 0, 4) == '6.4.') || (substr($kernel, 0, 5) == '10.0.'))
-
 
486
                        $icon = 'Win8.png';
-
 
487
                    else
-
 
488
                        $icon = 'WinXP.png';
-
 
489
                    $this->sys->setDistributionIcon($icon);
-
 
490
                } else {
-
 
491
                    $this->sys->setDistribution("WinNT");
-
 
492
                    $this->sys->setDistributionIcon('Win2000.png');
-
 
493
                }
175
    if ($bar) {
494
        } else {
-
 
495
            $this->sys->setDistribution("WinNT");
176
      $cpuload['cpupercent'] = array_sum( $cpuload['avg'] ) / count( $buffer );
496
            $this->sys->setDistributionIcon('Win2000.png');
177
    }
497
        }
178
    return $cpuload;
-
 
179
  } 
498
    }
180
 
499
 
-
 
500
    /**
-
 
501
     * Processor Load
181
  // get some informations about the cpu's
502
     * optionally create a loadbar
-
 
503
     *
-
 
504
     * @return void
-
 
505
     */
182
  function cpu_info ()
506
    private function _loadavg()
183
  {
507
    {
184
    $buffer = $this->_GetWMI( "Win32_Processor", array( "Name", "L2CacheSize", "CurrentClockSpeed", "ExtClock" ) );
508
        if (($cpubuffer = $this->_get_Win32_PerfFormattedData_PerfOS_Processor()) && isset($cpubuffer['cpu_Total'])) {
-
 
509
            $this->sys->setLoad($cpubuffer['cpu_Total']);
-
 
510
            if (PSI_LOAD_BAR) {
-
 
511
                $this->sys->setLoadPercent($cpubuffer['cpu_Total']);
-
 
512
            }
-
 
513
        } elseif ($buffer = $this->_get_Win32_Processor()) {
-
 
514
            $loadok = true;
185
    $results["cpus"] = 0;
515
            $sum = 0;
186
    foreach ($buffer as $cpu) {
516
            foreach ($buffer as $load) {
-
 
517
                $value = $load['LoadPercentage'];
-
 
518
                if ($value !== null) {
-
 
519
                    $sum += $value;
187
      $results["cpus"]++;
520
                } else {
188
      $results["model"] = $cpu["Name"];
521
                    $loadok = false;
-
 
522
                    break;
-
 
523
                }
-
 
524
            }
-
 
525
            if ($loadok) {
189
      $results["cache"] = $cpu["L2CacheSize"];
526
                $percent = $sum / count($buffer);
190
      $results["cpuspeed"] = $cpu["CurrentClockSpeed"];
527
                $this->sys->setLoad($percent);
-
 
528
                if (PSI_LOAD_BAR) {
191
      $results["busspeed"] = $cpu["ExtClock"];
529
                    $this->sys->setLoadPercent($percent);
-
 
530
                }
-
 
531
            }
192
    } 
532
        }
193
    return $results;
-
 
194
  } 
533
    }
195
 
534
 
-
 
535
    /**
196
  // get the pci devices from the system
536
     * CPU information
-
 
537
     *
-
 
538
     * @return void
-
 
539
     */
197
  function pci ()
540
    private function _cpuinfo()
198
  {
541
    {
199
    $pci = $this->_devicelist( "PCI" );
542
        $allCpus = $this->_get_Win32_Processor();
-
 
543
        if (!$allCpus) {
-
 
544
            $hkey = "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor";
-
 
545
            if (CommonFunctions::enumKey($this->_key, $hkey, $arrBuf, false)) {
-
 
546
                foreach ($arrBuf as $coreCount) {
-
 
547
                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\ProcessorNameString", $strBuf, false)) {
-
 
548
                        $allCpus[$coreCount]['Name'] = $strBuf;
-
 
549
                    }
-
 
550
                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\~MHz", $strBuf, false)) {
-
 
551
                        if (preg_match("/^0x([0-9a-f]+)$/i", $strBuf, $hexvalue)) {
-
 
552
                            $allCpus[$coreCount]['CurrentClockSpeed'] = hexdec($hexvalue[1]);
-
 
553
                        }
-
 
554
                    }
-
 
555
                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\VendorIdentifier", $strBuf, false)) {
-
 
556
                        $allCpus[$coreCount]['Manufacturer'] = $strBuf;
-
 
557
                    }
200
    return $pci;
558
                }
-
 
559
            }
201
  } 
560
        }
202
 
561
 
-
 
562
        $globalcpus = 0;
203
  // get the ide devices from the system
563
        foreach ($allCpus as $oneCpu) {
204
  function ide ()
564
            $cpuCount = 1;
205
  {
-
 
206
    $buffer = $this->_devicelist( "IDE" );
565
            if (isset($oneCpu['NumberOfLogicalProcessors'])) {
207
    $ide = array();
566
                $cpuCount = $oneCpu['NumberOfLogicalProcessors'];
208
    foreach ( $buffer as $device ) {
567
            } elseif (isset($oneCpu['NumberOfCores'])) {
209
        $ide[]['model'] = $device;
568
                $cpuCount = $oneCpu['NumberOfCores'];
210
    } 
569
            }
211
    return $ide;
570
            $globalcpus+=$cpuCount;
212
  } 
571
        }
213
 
572
 
214
  // get the scsi devices from the system
573
        foreach ($allCpus as $oneCpu) {
-
 
574
            $cpuCount = 1;
-
 
575
            if (isset($oneCpu['NumberOfLogicalProcessors'])) {
-
 
576
                $cpuCount = $oneCpu['NumberOfLogicalProcessors'];
-
 
577
            } elseif (isset($oneCpu['NumberOfCores'])) {
-
 
578
                $cpuCount = $oneCpu['NumberOfCores'];
-
 
579
            }
-
 
580
            for ($i = 0; $i < $cpuCount; $i++) {
-
 
581
                $cpu = new CpuDevice();
-
 
582
                if (isset($oneCpu['Name'])) $cpu->setModel($oneCpu['Name']);
-
 
583
                if (isset($oneCpu['L3CacheSize']) && ($oneCpu['L3CacheSize'] > 0)) {
-
 
584
                    $cpu->setCache($oneCpu['L3CacheSize'] * 1024);
-
 
585
                } elseif (isset($oneCpu['L2CacheSize'])) {
-
 
586
                    $cpu->setCache($oneCpu['L2CacheSize'] * 1024);
215
  function scsi ()
587
                }
-
 
588
                if (isset($oneCpu['CurrentClockSpeed'])) {
-
 
589
                    $cpu->setCpuSpeed($oneCpu['CurrentClockSpeed']);
-
 
590
                    if (isset($oneCpu['MaxClockSpeed']) && ($oneCpu['CurrentClockSpeed'] < $oneCpu['MaxClockSpeed'])) $cpu->setCpuSpeedMax($oneCpu['MaxClockSpeed']);
-
 
591
                }
-
 
592
                if (isset($oneCpu['ExtClock'])) $cpu->setBusSpeed($oneCpu['ExtClock']);
-
 
593
                if (isset($oneCpu['Manufacturer'])) $cpu->setVendorId($oneCpu['Manufacturer']);
-
 
594
                if (PSI_LOAD_BAR) {
-
 
595
                    if (($cpubuffer = $this->_get_Win32_PerfFormattedData_PerfOS_Processor()) && (count($cpubuffer) == ($globalcpus+1)) && isset($cpubuffer['cpu'.$i])) {
-
 
596
                           $cpu->setLoad($cpubuffer['cpu'.$i]);
-
 
597
                    } elseif ((count($allCpus) == $globalcpus) && isset($oneCpu['LoadPercentage'])) {
-
 
598
                        $cpu->setLoad($oneCpu['LoadPercentage']);
-
 
599
                    }
216
  {
600
                }
217
    $scsi = $this->_devicelist( "SCSI" );
601
                $this->sys->setCpus($cpu);
218
    return $scsi;
602
            }
-
 
603
        }
219
  } 
604
    }
220
 
605
 
-
 
606
    /**
221
  // get the usb devices from the system
607
     * Machine information
-
 
608
     *
-
 
609
     * @return void
-
 
610
     */
222
  function usb ()
611
    private function _machine()
223
  {
612
    {
224
    $usb = $this->_devicelist( "USB" );
613
        $buffer = $this->_get_Win32_ComputerSystem();
-
 
614
        if ($buffer) {
225
    return $usb;
615
            $buf = "";
-
 
616
            if (isset($buffer[0]['Manufacturer']) && !preg_match("/^To be filled by O\.E\.M\.$|^System manufacturer$|^Not Specified$/i", $buf2=$buffer[0]['Manufacturer'])) {
-
 
617
                $buf .= ' '.$buf2;
-
 
618
            }
-
 
619
 
-
 
620
            if (isset($buffer[0]['Model']) && !preg_match("/^To be filled by O\.E\.M\.$|^System Product Name$|^Not Specified$/i", $buf2=$buffer[0]['Model'])) {
-
 
621
                $buf .= ' '.$buf2;
-
 
622
            }
-
 
623
            if (trim($buf) != "") {
-
 
624
                $this->sys->setMachine(trim($buf));
-
 
625
            }
-
 
626
        }
226
  } 
627
    }
227
 
628
 
-
 
629
    /**
-
 
630
     * Hardwaredevices
-
 
631
     *
228
  // get the sbus devices from the system - currently not called
632
     * @return void
-
 
633
     */
229
  function sbus ()
634
    private function _hardware()
230
  {
635
    {
231
    $sbus = $this->_devicelist( "SBUS" );
636
        foreach ($this->_devicelist('PCI') as $pciDev) {
-
 
637
            $dev = new HWDevice();
-
 
638
            $dev->setName($pciDev['Name']);
-
 
639
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
-
 
640
                $dev->setManufacturer($pciDev['Manufacturer']);
-
 
641
                $dev->setProduct($pciDev['Product']);
232
    return $sbus;
642
            }
-
 
643
            $this->sys->setPciDevices($dev);
233
  } 
644
        }
234
 
645
 
235
	// get the netowrk devices and rx/tx bytes
646
        foreach ($this->_devicelist('IDE') as $ideDev) {
-
 
647
            $dev = new HWDevice();
-
 
648
            $dev->setName($ideDev['Name']);
-
 
649
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
-
 
650
                $dev->setCapacity($ideDev['Capacity']);
-
 
651
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
-
 
652
                    $dev->setSerial($ideDev['Serial']);
236
	function network () {
653
                }
-
 
654
            }
-
 
655
            $this->sys->setIdeDevices($dev);
-
 
656
        }
-
 
657
 
-
 
658
        foreach ($this->_devicelist('SCSI') as $scsiDev) {
-
 
659
            $dev = new HWDevice();
-
 
660
            $dev->setName($scsiDev['Name']);
-
 
661
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
-
 
662
                $dev->setCapacity($scsiDev['Capacity']);
-
 
663
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
-
 
664
                    $dev->setSerial($scsiDev['Serial']);
237
		$results = array();
665
                }
-
 
666
            }
238
		$buffer = $this->_GetWMI( "Win32_PerfRawData_Tcpip_NetworkInterface" );
667
            $this->sys->setScsiDevices($dev);
-
 
668
        }
-
 
669
 
-
 
670
        foreach ($this->_devicelist('USB') as $usbDev) {
239
		foreach( $buffer as $device ) {
671
            $dev = new HWDevice();
240
			$dev_name = $device["Name"];
672
            $dev->setName($usbDev['Name']);
241
			// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_perfrawdata_tcpip_networkinterface.asp
673
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
242
			// there is a possible bug in the wmi interfaceabout uint32 and uint64: http://www.ureader.com/message/1244948.aspx, so that
674
                $dev->setManufacturer($usbDev['Manufacturer']);
-
 
675
                $dev->setProduct($usbDev['Product']);
243
			// magative numbers would occour, try to calculate the nagative value from total - positive number
676
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
-
 
677
                    $dev->setSerial($usbDev['Serial']);
-
 
678
                }
-
 
679
            }
-
 
680
            $this->sys->setUsbDevices($dev);
-
 
681
        }
-
 
682
    }
244
			
683
 
-
 
684
    /**
-
 
685
     * Network devices
-
 
686
     *
-
 
687
     * @return void
-
 
688
     */
245
			if( $device["BytesSentPersec"] < 0) {
689
    private function _network()
-
 
690
    {
-
 
691
        if ($this->_wmi) {
-
 
692
            $buffer = $this->_get_Win32_OperatingSystem();
-
 
693
            if ($buffer && isset($buffer[0]) && isset($buffer[0]['Version']) && version_compare($buffer[0]['Version'], "6.2", ">=")) { // minimal windows 2012 or windows 8
246
				$results[$dev_name]['tx_bytes'] = $device["BytesTotalPersec"] - $device["BytesReceivedPersec"];
694
                $allDevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfRawData_Tcpip_NetworkAdapter', array('Name', 'BytesSentPersec', 'BytesTotalPersec', 'BytesReceivedPersec', 'PacketsReceivedErrors', 'PacketsReceivedDiscarded', 'CurrentBandwidth'));
247
			} else {
695
            } else {
248
				$results[$dev_name]['tx_bytes'] = $device["BytesSentPersec"];
696
                $allDevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfRawData_Tcpip_NetworkInterface', array('Name', 'BytesSentPersec', 'BytesTotalPersec', 'BytesReceivedPersec', 'PacketsReceivedErrors', 'PacketsReceivedDiscarded', 'CurrentBandwidth'));
-
 
697
            }
-
 
698
            if ($allDevices) {
-
 
699
                $aliases = array();
-
 
700
                $hkey = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}";
-
 
701
                if (CommonFunctions::enumKey($this->_key, $hkey, $arrBuf, false)) {
-
 
702
                    foreach ($arrBuf as $netID) {
-
 
703
                        if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\PnPInstanceId", $strInstanceID, false)) { //a w Name jest net alias
-
 
704
                            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\".$strInstanceID."\\FriendlyName", $strName, false)) {
-
 
705
                                $cname = str_replace(array('(', ')', '#'), array('[', ']', '_'), $strName); //convert to canonical
-
 
706
                                if (!isset($aliases[$cname])) { // duplicate checking
-
 
707
                                    $aliases[$cname]['id'] = $netID;
-
 
708
                                    $aliases[$cname]['name'] = $strName;
-
 
709
                                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\Name", $strCName, false)
-
 
710
                                       && (str_replace(array('(', ')', '#'), array('[', ']', '_'), $strCName) !== $cname)) {
-
 
711
                                        $aliases[$cname]['netname'] = $strCName;
249
			}
712
                                    }
250
			if( $device["BytesReceivedPersec"] < 0 ) {
-
 
251
				$results[$dev_name]['rx_bytes'] = $device["BytesTotalPersec"] - $device["BytesSentPersec"];
-
 
252
			} else {
713
                                } else {
253
				$results[$dev_name]['rx_bytes'] = $device["BytesReceivedPersec"];
714
                                    $aliases[$cname]['id'] = '';
-
 
715
                                }
-
 
716
                            }
-
 
717
                        }
-
 
718
                    }
254
			}
719
                }
255
			
720
 
-
 
721
                $aliases2 = array();
-
 
722
                $hkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards";
256
			$results[$dev_name]['rx_packets'] = $device["PacketsReceivedPersec"];
723
                if (CommonFunctions::enumKey($this->_key, $hkey, $arrBuf, false)) {
-
 
724
                    foreach ($arrBuf as $netCount) {
-
 
725
                        if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netCount."\\Description", $strName, false)
-
 
726
                            && CommonFunctions::readReg($this->_reg, $hkey."\\".$netCount."\\ServiceName", $strGUID, false)) {
-
 
727
                            $cname = str_replace(array('(', ')', '#'), array('[', ']', '_'), $strName); //convert to canonical
-
 
728
                            if (!isset($aliases2[$cname])) { // duplicate checking
-
 
729
                                $aliases2[$cname]['id'] = $strGUID;
257
			$results[$dev_name]['tx_packets'] = $device["PacketsSentPersec"];
730
                                $aliases2[$cname]['name'] = $strName;
-
 
731
                            } else {
-
 
732
                                $aliases2[$cname]['id'] = '';
-
 
733
                            }
-
 
734
                        }
-
 
735
                    }
-
 
736
                }
258
			
737
 
-
 
738
                $allNetworkAdapterConfigurations = CommonFunctions::getWMI($this->_wmi, 'Win32_NetworkAdapterConfiguration', array('SettingID', /*'Description',*/ 'MACAddress', 'IPAddress'));
-
 
739
                foreach ($allDevices as $device) if (!preg_match('/^WAN Miniport \[/', $device['Name'])) {
259
			$results[$dev_name]['rx_errs'] = $device["PacketsReceivedErrors"];
740
                    $dev = new NetDevice();
260
			$results[$dev_name]['rx_drop'] = $device["PacketsReceivedDiscarded"];
741
                    $name = $device['Name'];
261
			
742
 
-
 
743
                    if (preg_match('/^isatap\.({[A-Fa-f0-9\-]*})/', $name)) {
262
			$results[$dev_name]['errs'] = $device["PacketsReceivedErrors"];
744
                        $dev->setName("Microsoft ISATAP Adapter");
-
 
745
                    } else {
-
 
746
                        if (preg_match('/\s-\s([^-]*)$/', $name, $ar_name)) {
263
			$results[$dev_name]['drop'] = $device["PacketsReceivedDiscarded"];
747
                            $name=substr($name, 0, strlen($name)-strlen($ar_name[0]));
264
		}
748
                        }
265
		
-
 
266
		return $results;
749
                        $dev->setName($name);
267
	} 
750
                    }
268
 
751
 
269
  function memory ()
752
                    $macexist = false;
270
  {
-
 
-
 
753
                    if (((($ali=$aliases) && isset($ali[$name])) || (($ali=$aliases2) && isset($ali[$name]))) && isset($ali[$name]['id']) && ($ali[$name]['id'] !== "")) {
271
    $buffer = $this->_GetWMI( "Win32_LogicalMemoryConfiguration", array( "TotalPhysicalMemory" ) );
754
                        foreach ($allNetworkAdapterConfigurations as $NetworkAdapterConfiguration) {
-
 
755
                            if ($ali[$name]['id']==$NetworkAdapterConfiguration['SettingID']) {
272
    $results['ram']['total'] = $buffer[0]["TotalPhysicalMemory"];
756
                                $mininame = $ali[$name]['name'];
-
 
757
                                if (preg_match('/^isatap\.({[A-Fa-f0-9\-]*})/', $mininame))
-
 
758
                                    $mininame="Microsoft ISATAP Adapter";
-
 
759
                                elseif (preg_match('/\s-\s([^-]*)$/', $mininame, $ar_name))
-
 
760
                                    $name=substr($mininame, 0, strlen($mininame)-strlen($ar_name[0]));
-
 
761
                                $dev->setName($mininame);
-
 
762
                                if (trim($NetworkAdapterConfiguration['MACAddress']) !== "") $macexist = true;
-
 
763
                                if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS) {
-
 
764
                                    if (isset($ali[$name]['netname'])) $dev->setInfo(str_replace(';', ':', $ali[$name]['netname']));
-
 
765
                                    if ((!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR)
-
 
766
                                       && (trim($NetworkAdapterConfiguration['MACAddress']) !== "")) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').str_replace(':', '-', strtoupper($NetworkAdapterConfiguration['MACAddress'])));
-
 
767
                                    if (isset($NetworkAdapterConfiguration['IPAddress']))
-
 
768
                                        foreach ($NetworkAdapterConfiguration['IPAddress'] as $ipaddres)
-
 
769
                                            if (($ipaddres != "0.0.0.0") && ($ipaddres != "::") && !preg_match('/^fe80::/i', $ipaddres))
-
 
770
                                                $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ipaddres));
-
 
771
                                }
-
 
772
 
-
 
773
                                break;
-
 
774
                            }
-
 
775
                        }
-
 
776
                    }
273
 
777
 
-
 
778
                    if ($macexist
-
 
779
//                        || ($device['CurrentBandwidth'] >= 1000000)
-
 
780
                        || ($device['BytesTotalPersec'] != 0)
-
 
781
                        || ($device['BytesSentPersec'] != 0)
-
 
782
                        || ($device['BytesReceivedPersec'] != 0)
-
 
783
                        || ($device['PacketsReceivedErrors'] != 0)
-
 
784
                        || ($device['PacketsReceivedDiscarded'] != 0)) { // hide unused
274
    $buffer = $this->_GetWMI( "Win32_PerfRawData_PerfOS_Memory", array( "AvailableKBytes" ) );
785
                        if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS) {
-
 
786
                            if (($speedinfo = $device['CurrentBandwidth']) >= 1000000) {
275
    $results['ram']['free'] = $buffer[0]["AvailableKBytes"];
787
                                if ($speedinfo > 1000000000) {
-
 
788
                                    $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').round($speedinfo/1000000000, 2)."Gb/s");
-
 
789
                                } else {
-
 
790
                                    $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').round($speedinfo/1000000, 2)."Mb/s");
-
 
791
                                }
-
 
792
                            }
-
 
793
                        }
276
 
794
 
-
 
795
                        // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_perfrawdata_tcpip_networkinterface.asp
-
 
796
                        // there is a possible bug in the wmi interfaceabout uint32 and uint64: http://www.ureader.com/message/1244948.aspx, so that
-
 
797
                        // magative numbers would occour, try to calculate the nagative value from total - positive number
-
 
798
                        $txbytes = $device['BytesSentPersec'];
-
 
799
                        $rxbytes = $device['BytesReceivedPersec'];
-
 
800
                        if (($txbytes < 0) && ($rxbytes < 0)) {
-
 
801
                            $txbytes += 4294967296;
-
 
802
                            $rxbytes += 4294967296;
-
 
803
                        } elseif ($txbytes < 0) {
277
    $results['ram']['used'] = $results['ram']['total'] - $results['ram']['free'];
804
                            if ($device['BytesTotalPersec'] > $rxbytes)
-
 
805
                               $txbytes = $device['BytesTotalPersec'] - $rxbytes;
-
 
806
                            else
-
 
807
                               $txbytes += 4294967296;
-
 
808
                        } elseif ($rxbytes < 0) {
-
 
809
                            if ($device['BytesTotalPersec'] > $txbytes)
278
    $results['ram']['percent'] = ceil( ( $results['ram']['used'] * 100 ) / $results['ram']['total'] );
810
                               $rxbytes = $device['BytesTotalPersec'] - $txbytes;
279
    $results['swap']['total'] = 0;
811
                            else
-
 
812
                               $rxbytes += 4294967296;
-
 
813
                        }
-
 
814
                        $dev->setTxBytes($txbytes);
-
 
815
                        $dev->setRxBytes($rxbytes);
-
 
816
                        $dev->setErrors($device['PacketsReceivedErrors']);
-
 
817
                        $dev->setDrops($device['PacketsReceivedDiscarded']);
-
 
818
 
-
 
819
                        $this->sys->setNetDevices($dev);
-
 
820
                    }
-
 
821
                }
-
 
822
            }
-
 
823
        } elseif (($buffer = $this->_get_systeminfo()) && preg_match('/^(\s+)\[\d+\]:[^\r\n]+\r\n\s+[^\s\[]/m', $buffer, $matches, PREG_OFFSET_CAPTURE)) {
-
 
824
            $netbuf = substr($buffer, $matches[0][1]);
-
 
825
            if (preg_match('/^[^\s]/m', $netbuf, $matches2, PREG_OFFSET_CAPTURE)) {
-
 
826
                $netbuf = substr($netbuf, 0, $matches2[0][1]);
-
 
827
            }
-
 
828
            $netstrs = preg_split('/^'.$matches[1][0].'\[\d+\]:/m', $netbuf, -1, PREG_SPLIT_NO_EMPTY);
280
    $results['swap']['used'] = 0;
829
            $devnr = 0;
-
 
830
            foreach ($netstrs as $netstr) {
-
 
831
                $netstrls = preg_split('/\r\n/', $netstr, -1, PREG_SPLIT_NO_EMPTY);
-
 
832
                if (sizeof($netstrls)>1) {
-
 
833
                    $dev = new NetDevice();
-
 
834
                    foreach ($netstrls as $nr=>$netstrl) {
281
    $results['swap']['free'] = 0;
835
                        if ($nr === 0) {
-
 
836
                            $name = trim($netstrl);
-
 
837
                            if ($name !== "") {
-
 
838
                                $dev->setName($name);
-
 
839
                            } else {
-
 
840
                                $dev->setName('dev'.$devnr);
-
 
841
                                $devnr++;
-
 
842
                            }
-
 
843
                        } elseif (preg_match('/\[\d+\]:\s+(.+)/', $netstrl, $netinfo)) {
-
 
844
                            $ipaddres = trim($netinfo[1]);
-
 
845
                            if (($ipaddres!="0.0.0.0") && !preg_match('/^fe80::/i', $ipaddres))
-
 
846
                                $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ipaddres));
-
 
847
                        }
-
 
848
                    }
-
 
849
                    $this->sys->setNetDevices($dev);
-
 
850
                }
-
 
851
            }
-
 
852
        }
-
 
853
    }
282
 
854
 
-
 
855
    /**
-
 
856
     * Physical memory information and Swap Space information
-
 
857
     *
-
 
858
     * @link http://msdn2.microsoft.com/En-US/library/aa394239.aspx
-
 
859
     * @link http://msdn2.microsoft.com/en-us/library/aa394246.aspx
-
 
860
     * @return void
-
 
861
     */
-
 
862
    private function _memory()
-
 
863
    {
-
 
864
        if ($this->_wmi) {
-
 
865
            $buffer = $this->_get_Win32_OperatingSystem();
-
 
866
            if ($buffer) {
-
 
867
                $this->sys->setMemTotal($buffer[0]['TotalVisibleMemorySize'] * 1024);
-
 
868
                $this->sys->setMemFree($buffer[0]['FreePhysicalMemory'] * 1024);
283
    $buffer = $this->_GetWMI( "Win32_PageFileUsage" ); // no need to filter, using nearly everything from output
869
                $this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
284
    $k = 0;
870
            }
-
 
871
            $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_PageFileUsage');
285
    foreach ($buffer as $swapdevice) {
872
            foreach ($buffer as $swapdevice) {
286
      $results['devswap'][$k]['dev'] = $swapdevice["Name"];
873
                $dev = new DiskDevice();
287
      $results['devswap'][$k]['total'] = $swapdevice["AllocatedBaseSize"] * 1024;
874
                $dev->setName("SWAP");
288
      $results['devswap'][$k]['used'] = $swapdevice["CurrentUsage"] * 1024;
875
                $dev->setMountPoint($swapdevice['Name']);
289
      $results['devswap'][$k]['free'] = ( $swapdevice["AllocatedBaseSize"] - $swapdevice["CurrentUsage"] ) * 1024;
876
                $dev->setTotal($swapdevice['AllocatedBaseSize'] * 1024 * 1024);
290
      $results['devswap'][$k]['percent'] = ceil( $swapdevice["CurrentUsage"] / $swapdevice["AllocatedBaseSize"] );
877
                $dev->setUsed($swapdevice['CurrentUsage'] * 1024 * 1024);
291
 
-
 
292
      $results['swap']['total'] += $results['devswap'][$k]['total'];
878
                $dev->setFree($dev->getTotal() - $dev->getUsed());
293
      $results['swap']['used'] += $results['devswap'][$k]['used'];
879
                $dev->setFsType('swap');
294
      $results['swap']['free'] += $results['devswap'][$k]['free'];
880
                $this->sys->setSwapDevices($dev);
295
      $k += 1;
881
            }
296
    } 
-
 
297
    $results['swap']['percent'] = ceil( $results['swap']['used'] / $results['swap']['total'] * 100 );
882
        } elseif (($buffer = $this->_get_systeminfo()) && preg_match("/:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+\s([\d \xFF]+)\sMB\r\n/m", $buffer, $buffer2)) {
298
    return $results;
-
 
299
  } 
-
 
300
 
-
 
301
  // get the filesystem informations
-
 
302
  function filesystems ()
-
 
303
  {
-
 
304
     $typearray = array("Unknown", "No Root Directory", "Removeable Disk",
883
//           && (preg_match("/:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+\s([\d \xFF]+)\sMB\r\n.*:\s+(\S+)\r\n/m", $buffer, $buffer2)) {
305
        "Local Disk", "Network Drive", "Compact Disc", "RAM Disk");
884
            $this->sys->setMemTotal(preg_replace('/(\s)|(\xFF)/', '', $buffer2[1]) * 1024 * 1024);
306
     $floppyarray = array("Unknown", "5 1/4 in.", "3 1/2 in.", "3 1/2 in.",
-
 
307
        "3 1/2 in.", "3 1/2 in.", "5 1/4 in.", "5 1/4 in.", "5 1/4 in.",
885
            $this->sys->setMemFree(preg_replace('/(\s)|(\xFF)/', '', $buffer2[2]) * 1024 * 1024);
308
        "5 1/4 in.", "5 1/4 in.", "Other", "HD", "3 1/2 in.", "3 1/2 in.",
886
            $this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
309
        "5 1/4 in.", "5 1/4 in.", "3 1/2 in.", "3 1/2 in.", "5 1/4 in.",
-
 
310
        "3 1/2 in.", "3 1/2 in.", "8 in.");
887
        }
311
 
888
    }
312
    $buffer = $this->_GetWMI( "Win32_LogicalDisk" , array( "Name", "Size", "FreeSpace", "FileSystem", "DriveType", "MediaType" ) );
-
 
313
 
889
 
-
 
890
    /**
-
 
891
     * filesystem information
-
 
892
     *
-
 
893
     * @return void
-
 
894
     */
-
 
895
    private function _filesystems()
-
 
896
    {
-
 
897
        $typearray = array('Unknown', 'No Root Directory', 'Removable Disk', 'Local Disk', 'Network Drive', 'Compact Disc', 'RAM Disk');
314
    $k = 0;
898
        $floppyarray = array('Unknown', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', 'Other', 'HD', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '8 in.');
-
 
899
        $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_LogicalDisk', array('Name', 'Size', 'FreeSpace', 'FileSystem', 'DriveType', 'MediaType'));
315
    foreach ( $buffer as $filesystem ) {
900
        foreach ($buffer as $filesystem) {
-
 
901
            $dev = new DiskDevice();
-
 
902
            $dev->setMountPoint($filesystem['Name']);
-
 
903
            $dev->setFsType($filesystem['FileSystem']);
316
      if ( hide_mount( $filesystem["Name"] ) ) {
904
            if ($filesystem['Size'] > 0) {
-
 
905
                $dev->setTotal($filesystem['Size']);
-
 
906
                $dev->setFree($filesystem['FreeSpace']);
-
 
907
                $dev->setUsed($filesystem['Size'] - $filesystem['FreeSpace']);
-
 
908
            }
-
 
909
            if ($filesystem['MediaType'] != "" && $filesystem['DriveType'] == 2) {
-
 
910
                $dev->setName($typearray[$filesystem['DriveType']]." (".$floppyarray[$filesystem['MediaType']].")");
-
 
911
            } else {
-
 
912
                $dev->setName($typearray[$filesystem['DriveType']]);
-
 
913
            }
-
 
914
            $this->sys->setDiskDevices($dev);
-
 
915
        }
-
 
916
        if (!$buffer && ($this->sys->getDistribution()=="ReactOS")) {
-
 
917
            // test for command 'free' on current disk
-
 
918
            if (CommonFunctions::executeProgram('cmd', '/c free 2>nul', $out_value, true)) {
-
 
919
                for ($letter='A'; $letter!='AA'; $letter++) if (CommonFunctions::executeProgram('cmd', '/c free '.$letter.': 2>nul', $out_value, false)) {
-
 
920
                    $values = preg_replace('/[^\d\n]/', '', $out_value);
-
 
921
                    if (preg_match('/\n(\d+)\n(\d+)\n(\d+)$/', $values, $out_dig)) {
-
 
922
                        $size = $out_dig[1];
-
 
923
                        $used = $out_dig[2];
-
 
924
                        $free = $out_dig[3];
-
 
925
                        if ($used + $free == $size) {
-
 
926
                            $dev = new DiskDevice();
-
 
927
                            $dev->setMountPoint($letter.":");
-
 
928
                            $dev->setFsType('Unknown');
-
 
929
                            $dev->setName('Unknown');
-
 
930
                            $dev->setTotal($size);
-
 
931
                            $dev->setUsed($used);
-
 
932
                            $dev->setFree($free);
-
 
933
                            $this->sys->setDiskDevices($dev);
-
 
934
                        }
-
 
935
                    }
317
        continue;
936
                }
318
      }
937
            }
319
      $results[$k]['mount'] = $filesystem["Name"];
-
 
320
      $results[$k]['size'] = $filesystem["Size"] / 1024;
-
 
321
      $results[$k]['used'] = ( $filesystem["Size"] - $filesystem["FreeSpace"] ) / 1024;
-
 
322
      $results[$k]['free'] = $filesystem["FreeSpace"] / 1024;
-
 
323
      @$results[$k]['percent'] = ceil( $results[$k]['used'] / $results[$k]['size'] * 100 );  // silence this line, nobody is having a floppy in the drive everytime
-
 
324
      $results[$k]['fstype'] = $filesystem["FileSystem"];
-
 
325
      $results[$k]['disk'] = $typearray[$filesystem["DriveType"]];
-
 
326
      if ( $filesystem["MediaType"] != ""  && $filesystem["DriveType"] == 2 ) $results[$k]['disk'] .= " (" . $floppyarray[$filesystem["MediaType"]] . ")";
-
 
327
      $k += 1;
-
 
328
    } 
938
        }
329
    return $results;
-
 
330
  } 
939
    }
331
 
940
 
-
 
941
    /**
-
 
942
     * get os specific encoding
-
 
943
     *
-
 
944
     * @see OS::getEncoding()
-
 
945
     *
-
 
946
     * @return string
-
 
947
     */
332
  function distro ()
948
    public function getEncoding()
333
  {
949
    {
334
    $buffer = $this->_GetWMI( "Win32_OperatingSystem", array( "Caption" ) );
-
 
335
    return $buffer[0]["Caption"];
950
        return $this->_codepage;
336
  } 
951
    }
337
 
952
 
-
 
953
    /**
-
 
954
     * get os specific language
-
 
955
     *
-
 
956
     * @see OS::getLanguage()
-
 
957
     *
-
 
958
     * @return string
-
 
959
     */
338
  function distroicon ()
960
    public function getLanguage()
339
  {
961
    {
340
    return 'xp.gif';
962
        return $this->_syslang;
-
 
963
    }
-
 
964
 
-
 
965
    public function _processes()
-
 
966
    {
-
 
967
        $processes['*'] = 0;
-
 
968
        if (CommonFunctions::executeProgram('qprocess', '*', $strBuf, false) && (strlen($strBuf) > 0)) {
-
 
969
            $lines = preg_split('/\n/', $strBuf);
-
 
970
            $processes['*'] = (count($lines)-1) - 3 ; //correction for process "qprocess *"
-
 
971
        }
-
 
972
        if ($processes['*'] <= 0) {
-
 
973
            $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_Process', array('Caption'));
-
 
974
            $processes['*'] = count($buffer);
341
  } 
975
        }
-
 
976
        $processes[' '] = $processes['*'];
-
 
977
        $this->sys->setProcesses($processes);
342
} 
978
    }
343
 
979
 
-
 
980
    /**
-
 
981
     * get the information
-
 
982
     *
-
 
983
     * @see PSI_Interface_OS::build()
-
 
984
     *
-
 
985
     * @return Void
-
 
986
     */
-
 
987
    public function build()
-
 
988
    {
-
 
989
        $this->_distro(); //share getDistribution()
-
 
990
        if ($this->sys->getDistribution()=="ReactOS") {
-
 
991
            $this->error->addError("WARN", "The ReactOS version of phpSysInfo is a work in progress, some things currently don't work");
-
 
992
        }
-
 
993
        if (!$this->blockname || $this->blockname==='vitals') {
-
 
994
            $this->_hostname();
-
 
995
            $this->_users();
-
 
996
            $this->_uptime();
-
 
997
            $this->_loadavg();
-
 
998
            $this->_processes();
-
 
999
        }
-
 
1000
        if (!$this->blockname || $this->blockname==='network') {
-
 
1001
            $this->_network();
-
 
1002
        }
-
 
1003
        if (!$this->blockname || $this->blockname==='hardware') {
-
 
1004
            $this->_machine();
-
 
1005
            $this->_cpuinfo();
-
 
1006
            $this->_hardware();
-
 
1007
        }
-
 
1008
        if (!$this->blockname || $this->blockname==='filesystem') {
-
 
1009
            $this->_filesystems();
-
 
1010
        }
-
 
1011
        if (!$this->blockname || $this->blockname==='memory') {
-
 
1012
            $this->_memory();
-
 
1013
        }
-
 
1014
    }
344
?>
1015
}