| Server IP : 104.21.80.248 / Your IP : 172.71.28.155 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/www/news/system/plugins/stablebit/ |
Upload File : |
<?php
/**
* StableBit Plugin, which displays disks state
*
* @category PHP
* @package PSI_Plugin_StableBit
* @author Mieczyslaw Nalewaj <[email protected]>
* @copyright 2017 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version $Id: class.stablebit.inc.php 661 2012-08-27 11:26:39Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
class StableBit extends PSI_Plugin
{
/**
* variable, which holds the result before the xml is generated out of this array
* @var array
*/
private $_result;
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc encoding
*/
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
$this->_result = array();
}
private $stablebit_items = array('Name', 'Firmware', 'Size', 'TemperatureC', 'PowerState', 'IsHot', 'IsSmartWarning', 'IsSmartPastThresholds', 'IsSmartPastAdvisoryThresholds', 'IsSmartFailurePredicted', 'IsDamaged', 'SerialNumber');
/**
* doing all tasks to get the required informations that the plugin needs
* result is stored in an internal array
*
* @return void
*/
public function execute()
{
if (PSI_OS == 'WINNT') {
try {
$objLocator = new COM('WbemScripting.SWbemLocator');
$wmi = $objLocator->ConnectServer('', 'root\StableBit\Scanner');
$this->_result = CommonFunctions::getWMI($wmi, 'Disks', $this->stablebit_items);
} catch (Exception $e) {
}
}
}
/**
* generates the XML content for the plugin
*
* @return SimpleXMLElement entire XML content for the plugin
*/
public function xml()
{
foreach ($this->_result as $disk_items) {
if (isset($disk_items['Name']) && (trim($disk_items['Name']) !== '')) {
$xmlstablebit_disk = $this->xml->addChild("Disk");
foreach ($this->stablebit_items as $item) {
if (isset($disk_items[$item]) && (($itemvalue=$disk_items[$item]) !== '') &&
(($item !== 'SerialNumber') || (defined('PSI_PLUGIN_STABLEBIT_SHOW_SERIAL') && (PSI_PLUGIN_STABLEBIT_SHOW_SERIAL === true)))) {
$xmlstablebit_disk ->addAttribute($item, $itemvalue);
}
}
}
}
return $this->xml->getSimpleXmlElement();
}
}