* 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:
2025-05-14 16:14:01 +01:00
parent 80b1da5fa5
commit c8ce77259d
952 changed files with 51341 additions and 28699 deletions

View File

@@ -8,7 +8,7 @@
* @package PSI FreeBSD OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.FreeBSD.inc.php 696 2012-09-09 11:24:04Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
@@ -20,7 +20,7 @@
* @package PSI FreeBSD OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @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
*/
@@ -29,30 +29,18 @@ class FreeBSD extends BSDCommon
/**
* define the regexp for log parser
*/
public function __construct()
public function __construct($blockname = false)
{
parent::__construct();
$this->setCPURegExp1("CPU: (.*) \((.*)-MHz (.*)\)");
parent::__construct($blockname);
$this->setCPURegExp1("/CPU: (.*) \((.*)-MHz (.*)\)/");
$this->setCPURegExp2("/(.*) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)/");
$this->setSCSIRegExp1("^(.*): <(.*)> .*SCSI.*device");
$this->setSCSIRegExp2("^(da[0-9]): (.*)MB ");
$this->setPCIRegExp1("/(.*): <(.*)>(.*) pci[0-9]$/");
$this->setSCSIRegExp1("/^(.*): <(.*)> .*SCSI.*device/");
$this->setSCSIRegExp2("/^(da[0-9]+): (.*)MB /");
$this->setSCSIRegExp3("/^(da[0-9]+|cd[0-9]+): Serial Number (.*)/");
$this->setPCIRegExp1("/(.*): <(.*)>(.*) pci[0-9]+$/");
$this->setPCIRegExp2("/(.*): <(.*)>.* at [.0-9]+ irq/");
}
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
$s = preg_split('/ /', $this->grabkey('kern.boottime'));
$a = preg_replace('/,/', '', $s[3]);
$this->sys->setUptime(time() - $a);
}
/**
* get network information
*
@@ -65,11 +53,11 @@ class FreeBSD extends BSDCommon
$lines = preg_split("/\n/", $netstat, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$ar_buf = preg_split("/\s+/", $line);
if (! empty($ar_buf[0])) {
if (!empty($ar_buf[0])) {
if (preg_match('/^<Link/i', $ar_buf[2])) {
$dev = new NetDevice();
$dev->setName($ar_buf[0]);
if (strlen($ar_buf[3]) < 17) { /* no Address */
if ((strlen($ar_buf[3]) < 17) && ($ar_buf[0] != $ar_buf[3])) { /* no MAC or dev name*/
if (isset($ar_buf[11]) && (trim($ar_buf[11]) != '')) { /* Idrop column exist*/
$dev->setTxBytes($ar_buf[9]);
$dev->setRxBytes($ar_buf[6]);
@@ -97,14 +85,25 @@ class FreeBSD extends BSDCommon
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS) && (CommonFunctions::executeProgram('ifconfig', $ar_buf[0].' 2>/dev/null', $bufr2, PSI_DEBUG))) {
$bufe2 = preg_split("/\n/", $bufr2, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe2 as $buf2) {
if (preg_match('/^\s+ether\s+(\S+)/i', $buf2, $ar_buf2))
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', $ar_buf2[1]));
elseif (preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $buf2, $ar_buf2))
if (preg_match('/^\s+ether\s+(\S+)/i', $buf2, $ar_buf2)) {
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
} elseif (preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $buf2, $ar_buf2)) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
elseif ((preg_match('/^\s+inet6\s+([^\s%]+)\s+prefixlen/i', $buf2, $ar_buf2)
} elseif ((preg_match('/^\s+inet6\s+([^\s%]+)\s+prefixlen/i', $buf2, $ar_buf2)
|| preg_match('/^\s+inet6\s+([^\s%]+)%\S+\s+prefixlen/i', $buf2, $ar_buf2))
&& !preg_match('/^fe80::/i', $ar_buf2[1]))
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1])) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1]));
} elseif (preg_match('/^\s+media:\s+/i', $buf2) && preg_match('/[\(\s](\d+)(G*)base/i', $buf2, $ar_buf2)) {
if (isset($ar_buf2[2]) && strtoupper($ar_buf2[2])=="G") {
$unit = "G";
} else {
$unit = "M";
}
if (preg_match('/[<\s]([^\s<]+)-duplex/i', $buf2, $ar_buf3))
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1].$unit.'b/s '.strtolower($ar_buf3[1]));
else
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1].$unit.'b/s');
}
}
}
$this->sys->setNetDevices($dev);
@@ -121,9 +120,19 @@ class FreeBSD extends BSDCommon
*/
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');
} elseif (preg_match('/^TrueNAS/i', $version)) { // TrueNAS detection
$this->sys->setDistribution($version);
$this->sys->setDistributionIcon('TrueNAS.png');
} else {
$this->sys->setDistributionIcon('FreeBSD.png');
}
} else {
$this->sys->setDistributionIcon('FreeBSD.png');
}
@@ -176,15 +185,20 @@ class FreeBSD extends BSDCommon
*
* @see BSDCommon::build()
*
* @return Void
* @return void
*/
public function build()
{
parent::build();
$this->_memoryadditional();
$this->_distroicon();
$this->_network();
$this->_uptime();
$this->_processes();
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distroicon();
$this->_processes();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->_memoryadditional();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
}
}