* 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

@@ -1,18 +1,4 @@
<?php
/**
* Uprecords Plugin
*
* PHP version 5
*
* @category PHP
* @package PSI_Plugin_Uprecords
* @author Ambrus Sandor Olah <aolah76@freemail.hu>
* @copyright 2014 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @version SVN: $Id: class.uprecords.inc.php 661 2014-01-08 11:26:39Z aolah76 $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* Uprecords plugin, which displays all uprecords informations available
*
@@ -20,7 +6,7 @@
* @package PSI_Plugin_Uprecords
* @author Ambrus Sandor Olah <aolah76@freemail.hu>
* @copyright 2014 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: 1.0
* @link http://phpsysinfo.sourceforge.net
*/
@@ -42,7 +28,7 @@ class uprecords extends PSI_Plugin
* @return array uprecords in array with label
*/
private function uprecords()
private function getUprecords()
{
$result = array();
$i = 0;
@@ -50,8 +36,16 @@ class uprecords extends PSI_Plugin
foreach ($this->_lines as $line) {
if (($i > 1) and (strpos($line, '---') === false)) {
$buffer = preg_split("/\s*[ |]\s+/", ltrim(ltrim($line, '->'), ' '));
if (defined('PSI_PLUGIN_UPRECORDS_SHORT_MODE') && PSI_PLUGIN_UPRECORDS_SHORT_MODE && !is_numeric($buffer[0])) {
break;
}
if (strpos($line, '->') !== false) {
$buffer[0] = '-> '.$buffer[0];
if (defined('PSI_PLUGIN_UPRECORDS_DENOTE_BY_ASTERISK') && PSI_PLUGIN_UPRECORDS_DENOTE_BY_ASTERISK) {
$buffer[0] .= ' *';
} else {
$buffer[0] = '-> '.$buffer[0];
}
}
if (count($buffer) > 4) {
@@ -62,7 +56,7 @@ class uprecords extends PSI_Plugin
$result[$i]['Uptime'] = $buffer[1];
$result[$i]['System'] = $buffer[2];
//Date formating
$result[$i]['Bootup'] = preg_replace("/^(\S+)(\s+)/", "$1,$2", preg_replace("/^(\S+\s+\S+\s+)(\d)(\s+)/", "$1 0$2$3", $buffer[3]." GMT"));
$result[$i]['Bootup'] = preg_replace("/^(\S+)(\s+)/", "$1,$2", preg_replace("/^(\S+\s+\S+\s+)(\d)(\s+)/", "$1 0$2$3", trim($buffer[3])." GMT"));
}
$i++;
}
@@ -73,31 +67,36 @@ class uprecords extends PSI_Plugin
public function execute()
{
$this->_lines = array();
switch (strtolower(PSI_PLUGIN_UPRECORDS_ACCESS)) {
case 'command':
$lines = "";
$oldtz=getenv("TZ");
putenv("TZ=GMT");
if (CommonFunctions::executeProgram('uprecords', '-a -w', $lines) && !empty($lines))
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
putenv("TZ=".$oldtz);
break;
case 'data':
if (CommonFunctions::rfts(APP_ROOT."/data/uprecords.txt", $lines) && !empty($lines))
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
default:
$this->error->addConfigError('__construct()', 'PSI_PLUGIN_UPRECORDS_ACCESS');
break;
if (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT')) switch (strtolower(PSI_PLUGIN_UPRECORDS_ACCESS)) {
case 'command':
$lines = "";
$options = "";
if (defined('PSI_PLUGIN_UPRECORDS_MAX_ENTRIES')) {
if (($ment = max(intval(PSI_PLUGIN_UPRECORDS_MAX_ENTRIES), 0)) != 10) {
$options=" -m ".$ment;
}
}
if (defined('PSI_PLUGIN_UPRECORDS_SHORT_MODE') && PSI_PLUGIN_UPRECORDS_SHORT_MODE) {
$options .= " -s";
}
if (CommonFunctions::executeProgram('TZ=GMT uprecords', '-a -w'.$options, $lines) && !empty($lines))
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'data':
if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::rftsdata("uprecords.tmp", $lines) && !empty($lines))
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
default:
$this->global_error->addConfigError("execute()", "[uprecords] ACCESS");
}
}
public function xml()
{
if (empty($this->_lines))
return $this->xml->getSimpleXmlElement();
return $this->xml->getSimpleXmlElement();
$arrBuff = $this->uprecords();
$arrBuff = $this->getUprecords();
if (sizeof($arrBuff) > 0) {
$uprecords = $this->xml->addChild("Uprecords");
foreach ($arrBuff as $arrValue) {

View File

@@ -21,7 +21,7 @@
//$Id: uprecords.js 661 2014-01-08 11:26:39 aolah76 $
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang, createBar */
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang */
"use strict";
@@ -33,36 +33,41 @@ var uprecords_show = false;
*/
function uprecords_populate(xml) {
var html = "", datetimeFormat = "", hostname = "";
var html = "";// lastboot = 0;
$("#Plugin_uprecordsTable").html(" ");
hostname = $("Plugins Plugin_uprecords", xml).attr('Hostname');
if (hostname !== undefined) {
$('span[class=Hostname_uprecords]').html(hostname);
}
$("Options", xml).each(function getByteFormat(id) {
datetimeFormat = $(this).attr("datetimeFormat");
});
$("Plugins Plugin_uprecords uprecords Item", xml).each(function uprecords_getitem(idp) {
if(idp==0) {
html += " <tr>\n";
html += " <th>" + genlang(101, true, "uprecords") + "</th>\n";
html += " <th>" + genlang(102, true, "uprecords") + "</th>\n";
html += " <th>" + genlang(103, true, "uprecords") + "</th>\n";
html += " <th>" + genlang(104, true, "uprecords") + "</th>\n";
html += " </tr>\n";
}
html += " <tr>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("hash") + "</td>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Uptime") + "</td>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("System") + "</td>\n";
/* lastboot = new Date($(this).attr("Bootup"));
html += " <tr>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("hash") + "</td>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("Uptime") + "</td>\n";
html += " <td style=\"font-weight:normal\">" + $(this).attr("System") + "</td>\n";
/*
var lastboot = new Date($(this).attr("Bootup"));
if (typeof(lastboot.toUTCString)==="function") {
html += " <td style=\"font-weight:normal\">" + lastboot.toUTCString() + "</td>\n";
html += " <td style=\"font-weight:normal\">" + lastboot.toUTCString() + "</td>\n";
} else { //deprecated
html += " <td style=\"font-weight:normal\">" + lastboot.toGMTString() + "</td>\n";
} */
html += " <td style=\"font-weight:normal\">" + $(this).attr("Bootup") + "</td>\n";
html += " </tr>\n";
html += " <td style=\"font-weight:normal\">" + lastboot.toGMTString() + "</td>\n";
}
*/
if ((datetimeFormat !== undefined) && (datetimeFormat.toLowerCase() === "locale")) {
var lastboot = new Date($(this).attr("Bootup"));
html += " <td style=\"font-weight:normal\">" + lastboot.toLocaleString() + "</td>\n";
} else {
html += " <td style=\"font-weight:normal\">" + $(this).attr("Bootup") + "</td>\n";
}
html += " </tr>\n";
uprecords_show = true;
});
$("#Plugin_uprecordsTable").append(html);
$("#Plugin_uprecordsTable-tbody").empty().append(html);
$('#Plugin_uprecordsTable tr:nth-child(even)').addClass('even');
}
@@ -70,12 +75,20 @@ function uprecords_populate(xml) {
function uprecords_buildTable() {
var html = "";
html += "<table id=\"Plugin_uprecordsTable\" class=\"stripeMe\" style=\"border-spacing:0;\">\n";
html += " <thead>\n";
html += " </thead>\n";
html += " <tbody>\n";
html += " </tbody>\n";
html += "</table>\n";
html += "<div style=\"overflow-x:auto;\">\n";
html += " <table id=\"Plugin_uprecordsTable\" class=\"stripeMe\" style=\"border-collapse:collapse;\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th>" + genlang(101, "uprecords") + "</th>\n";
html += " <th>" + genlang(102, "uprecords") + "</th>\n";
html += " <th>" + genlang(103, "uprecords") + "</th>\n";
html += " <th>" + genlang(104, "uprecords") + "</th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody id=\"Plugin_uprecordsTable-tbody\">\n";
html += " </tbody>\n";
html += " </table>\n";
html += "</div>\n";
$("#Plugin_uprecords").append(html);
}
@@ -84,26 +97,27 @@ function uprecords_buildTable() {
*/
function uprecords_request() {
$("#Reload_uprecordsTable").attr("title", "reload");
$.ajax({
url: "xml.php?plugin=uprecords",
dataType: "xml",
error: function uprecords_error() {
$.jGrowl("Error loading XML document for Plugin uprecords!");
},
success: function uprecords_buildblock(xml) {
populateErrors(xml);
uprecords_populate(xml);
if (uprecords_show) {
plugin_translate("uprecords");
$("#Plugin_uprecords").show();
$.jGrowl("Error loading XML document for Plugin uprecords!");
},
success: function uprecords_buildblock(xml) {
populateErrors(xml);
uprecords_populate(xml);
if (uprecords_show) {
plugin_translate("uprecords");
$("#Plugin_uprecords").show();
}
}
}
});
}
$(document).ready(function uprecords_buildpage() {
$("#footer").before(buildBlock("uprecords", 1, true));
$("#Plugin_uprecords").css("width", "915px");
$("#Plugin_uprecords").addClass("fullsize");
uprecords_buildTable();
@@ -111,6 +125,6 @@ $(document).ready(function uprecords_buildpage() {
$("#Reload_uprecordsTable").click(function uprecords_reload(id) {
uprecords_request();
$("#Reload_uprecordsTable").attr("title",datetime());
$(this).attr("title", datetime());
});
});

View File

@@ -3,13 +3,24 @@ function renderPlugin_uprecords(data) {
var directives = {
hash: {
html: function () {
return this["hash"];
return this.hash;
}
},
Bootup: {
html: function () {
var datetimeFormat;
if (((datetimeFormat = data.Options["@attributes"].datetimeFormat) !== undefined) && (datetimeFormat.toLowerCase() === "locale")) {
var bootup = new Date(this.Bootup);
return bootup.toLocaleString();
} else {
return this.Bootup;
}
}
}
};
if ((data['Plugins']['Plugin_uprecords'] !== undefined) && (data['Plugins']['Plugin_uprecords']['Uprecords'] !== undefined)) {
var upitems = items(data['Plugins']['Plugin_uprecords']['Uprecords']['Item']);
if ((data.Plugins.Plugin_uprecords !== undefined) && (data.Plugins.Plugin_uprecords.Uprecords !== undefined)) {
var upitems = items(data.Plugins.Plugin_uprecords.Uprecords.Item);
if (upitems.length > 0) {
var up_memory = [];
up_memory.push_attrs(upitems);

View File

@@ -9,9 +9,6 @@
<expression id="plugin_uprecords_001" name="uprecords_title">
<exp>Uprecords</exp>
</expression>
<expression id="plugin_uprecords_002" name="uprecords_date">
<exp>Last refresh</exp>
</expression>
<expression id="plugin_uprecords_101" name="uprecords_hash">
<exp>#</exp>
</expression>

View File

@@ -8,9 +8,6 @@
<expression id="plugin_uprecords_001" name="uprecords_title">
<exp>Uprecords</exp>
</expression>
<expression id="plugin_uprecords_002" name="uprecords_date">
<exp>Dernière actualisation</exp>
</expression>
<expression id="plugin_uprecords_101" name="uprecords_hash">
<exp>#</exp>
</expression>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: gr.xml 661 2014-01-08 11:26:39Z aolah76 $ -->
<!--
phpSysInfo language file Language: Greek Created by: ChriZathens
-->
<tns:translationPlugin language="greek" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_uprecords_001" name="uprecords_title">
<exp>Uprecords</exp>
</expression>
<expression id="plugin_uprecords_101" name="uprecords_hash">
<exp>#</exp>
</expression>
<expression id="plugin_uprecords_102" name="uprecords_uptime">
<exp>Ώρες Λειτουργίας</exp>
</expression>
<expression id="plugin_uprecords_103" name="uprecords_system">
<exp>Σύστημα</exp>
</expression>
<expression id="plugin_uprecords_104" name="uprecords_bootup">
<exp>Εκκίνηση</exp>
</expression>
</tns:translationPlugin>

View File

@@ -3,15 +3,12 @@
<!--
phpSysInfo language file Language: Hungarian Created by: Ambrus Sandor Olah
-->
<tns:translationPlugin language="english" charset="utf-8"
<tns:translationPlugin language="hungarian" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_uprecords_001" name="uprecords_title">
<exp>Uprecords</exp>
</expression>
<expression id="plugin_uprecords_002" name="uprecords_date">
<exp>Last refresh</exp>
</expression>
<expression id="plugin_uprecords_101" name="uprecords_hash">
<exp>#</exp>
</expression>

View File

@@ -3,15 +3,12 @@
<!--
phpSysInfo language file Language: Polish Created by: Created by: Mieczyslaw Nalewaj
-->
<tns:translationPlugin language="english" charset="utf-8"
<tns:translationPlugin language="polish" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_uprecords_001" name="uprecords_title">
<exp>Uprecords</exp>
</expression>
<expression id="plugin_uprecords_002" name="uprecords_date">
<exp>Last refresh</exp>
</expression>
<expression id="plugin_uprecords_101" name="uprecords_hash">
<exp>#</exp>
</expression>

View File

@@ -9,9 +9,6 @@
<expression id="plugin_uprecords_001" name="uprecords_title">
<exp>Uprecords</exp>
</expression>
<expression id="plugin_uprecords_002" name="uprecords_date">
<exp>Ultimul refresh</exp>
</expression>
<expression id="plugin_uprecords_101" name="uprecords_hash">
<exp>#</exp>
</expression>

View File

@@ -3,15 +3,12 @@
<!--
phpSysInfo language file Language: Russian Created by: Denis Sevostyanov (den007)
-->
<tns:translationPlugin language="english" charset="utf-8"
<tns:translationPlugin language="russian" charset="utf-8"
xmlns:tns="http://phpsysinfo.sourceforge.net/translation-plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation-plugin ../../../language/translation-plugin.xsd">
<expression id="plugin_uprecords_001" name="uprecords_title">
<exp>Состояное системы</exp>
</expression>
<expression id="plugin_uprecords_002" name="uprecords_date">
<exp>Последние обновление</exp>
</expression>
<expression id="plugin_uprecords_101" name="uprecords_hash">
<exp>#</exp>
</expression>

View File

@@ -1,25 +1,30 @@
<div class="col-lg-12" id="block_uprecords" style="display:none">
<div class="panel panel-primary">
<div class="panel-heading">Uprecords</div>
<div class="panel-body">
<table id="uprecords" class="table table-hover table-condensed">
<thead>
<tr>
<th>#</th>
<th>Uptime</th>
<th>System</th>
<th>Boot up</th>
</tr>
</thead>
<tbody id="uprecords-data">
<tr>
<th><span data-bind="hash"></span></th>
<td><span data-bind="Uptime"></span></td>
<td><span data-bind="System"></span></td>
<td><span data-bind="Bootup"></span></td>
</tr>
</tbody>
</table>
<div class="col-lg-12" id="block_uprecords" style="display:none;">
<div class="card" id="panel_uprecords" style="display:none;">
<div class="card-header"><span class="lang_plugin_uprecords_001">Uprecords</span>
<span class="hostname_uprecords"></span>
<div id="reload_uprecords" class="reload" title="reload"></div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="uprecords" class="table table-hover table-sm">
<thead>
<tr>
<th><span class="lang_plugin_uprecords_101">#</span></th>
<th><span class="lang_plugin_uprecords_102">Uptime</span></th>
<th><span class="lang_plugin_uprecords_103">System</span></th>
<th><span class="lang_plugin_uprecords_104">Boot up</span></th>
</tr>
</thead>
<tbody id="uprecords-data">
<tr>
<th><span data-bind="hash"></span></th>
<td><span data-bind="Uptime"></span></td>
<td><span data-bind="System"></span></td>
<td><span data-bind="Bootup"></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>