* Mon May 12 2025 Brian Read <brianr@koozali.org> 11.0.0-1.sme
- Adding SM2 panel [SME: 13004] - Upgrade to phpsysinfo 3.4.4 - Add code to delete inline styles and add css to make it look better. - version saved / built uses the static version, which means no drops downs and choices.
This commit is contained in:
@@ -1,25 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Open Hardware Monitor sensor class
|
||||
* Open Hardware Monitor sensor class, getting information from Open Hardware Monitor
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PSI_Sensor
|
||||
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
|
||||
* @copyright 2009 phpSysInfo
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
|
||||
* @version SVN: $Id: class.ohm.inc.php 661 2012-08-27 11:26:39Z namiltd $
|
||||
* @link http://phpsysinfo.sourceforge.net
|
||||
*/
|
||||
/**
|
||||
* getting information from Open Hardware Monitor
|
||||
*
|
||||
* @category PHP
|
||||
* @package PSI_Sensor
|
||||
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
|
||||
* @copyright 2009 phpSysInfo
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
|
||||
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
|
||||
* @copyright 2014 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
|
||||
*/
|
||||
@@ -38,25 +27,16 @@ class OHM extends Sensors
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$_wmi = null;
|
||||
// don't set this params for local connection, it will not work
|
||||
$strHostname = '';
|
||||
$strUser = '';
|
||||
$strPassword = '';
|
||||
try {
|
||||
// initialize the wmi object
|
||||
$objLocator = new COM('WbemScripting.SWbemLocator');
|
||||
if ($strHostname == "") {
|
||||
$_wmi = $objLocator->ConnectServer($strHostname, 'root\OpenHardwareMonitor');
|
||||
|
||||
} else {
|
||||
$_wmi = $objLocator->ConnectServer($strHostname, 'root\OpenHardwareMonitor', $strHostname.'\\'.$strUser, $strPassword);
|
||||
if ((PSI_OS == 'WINNT') || (defined('PSI_EMU_HOSTNAME') && !defined('PSI_EMU_PORT'))) {
|
||||
$_wmi = WINNT::initWMI('root\OpenHardwareMonitor', true);
|
||||
if ($_wmi) {
|
||||
$tmpbuf = WINNT::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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for OpenHardwareMonitor data.");
|
||||
}
|
||||
if ($_wmi) {
|
||||
$this->_buf = CommonFunctions::getWMI($_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,13 +47,11 @@ class OHM extends Sensors
|
||||
*/
|
||||
private function _temperature()
|
||||
{
|
||||
if ($this->_buf) foreach ($this->_buf as $buffer) {
|
||||
if ($buffer['SensorType'] == "Temperature") {
|
||||
$dev = new SensorDevice();
|
||||
$dev->setName($buffer['Parent'].' '.$buffer['Name']);
|
||||
$dev->setValue($buffer['Value']);
|
||||
$this->mbinfo->setMbTemp($dev);
|
||||
}
|
||||
if (isset($this->_buf['Temperature'])) foreach ($this->_buf['Temperature'] as $name=>$value) {
|
||||
$dev = new SensorDevice();
|
||||
$dev->setName($name);
|
||||
$dev->setValue($value);
|
||||
$this->mbinfo->setMbTemp($dev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,13 +62,11 @@ class OHM extends Sensors
|
||||
*/
|
||||
private function _voltage()
|
||||
{
|
||||
if ($this->_buf) foreach ($this->_buf as $buffer) {
|
||||
if ($buffer['SensorType'] == "Voltage") {
|
||||
$dev = new SensorDevice();
|
||||
$dev->setName($buffer['Parent'].' '.$buffer['Name']);
|
||||
$dev->setValue($buffer['Value']);
|
||||
$this->mbinfo->setMbVolt($dev);
|
||||
}
|
||||
if (isset($this->_buf['Voltage'])) foreach ($this->_buf['Voltage'] as $name=>$value) {
|
||||
$dev = new SensorDevice();
|
||||
$dev->setName($name);
|
||||
$dev->setValue($value);
|
||||
$this->mbinfo->setMbVolt($dev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,13 +77,11 @@ class OHM extends Sensors
|
||||
*/
|
||||
private function _fans()
|
||||
{
|
||||
if ($this->_buf) foreach ($this->_buf as $buffer) {
|
||||
if ($buffer['SensorType'] == "Fan") {
|
||||
$dev = new SensorDevice();
|
||||
$dev->setName($buffer['Parent'].' '.$buffer['Name']);
|
||||
$dev->setValue($buffer['Value']);
|
||||
$this->mbinfo->setMbFan($dev);
|
||||
}
|
||||
if (isset($this->_buf['Fan'])) foreach ($this->_buf['Fan'] as $name=>$value) {
|
||||
$dev = new SensorDevice();
|
||||
$dev->setName($name);
|
||||
$dev->setValue($value);
|
||||
$this->mbinfo->setMbFan($dev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,13 +92,11 @@ class OHM extends Sensors
|
||||
*/
|
||||
private function _power()
|
||||
{
|
||||
if ($this->_buf) foreach ($this->_buf as $buffer) {
|
||||
if ($buffer['SensorType'] == "Power") {
|
||||
$dev = new SensorDevice();
|
||||
$dev->setName($buffer['Parent'].' '.$buffer['Name']);
|
||||
$dev->setValue($buffer['Value']);
|
||||
$this->mbinfo->setMbPower($dev);
|
||||
}
|
||||
if (isset($this->_buf['Power'])) foreach ($this->_buf['Power'] as $name=>$value) {
|
||||
$dev = new SensorDevice();
|
||||
$dev->setName($name);
|
||||
$dev->setValue($value);
|
||||
$this->mbinfo->setMbPower($dev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +105,7 @@ class OHM extends Sensors
|
||||
*
|
||||
* @see PSI_Interface_Sensor::build()
|
||||
*
|
||||
* @return Void
|
||||
* @return void
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
|
Reference in New Issue
Block a user