* 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

@@ -0,0 +1,96 @@
<?php
/**
* Viewer Plugin, which displays custom informations
*
* @category PHP
* @package PSI_Plugin_Viewer
* @author erpomata
* @copyright 2016 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: 1.0
* @link http://phpsysinfo.sourceforge.net
*/
class Viewer extends PSI_Plugin
{
private $_lines;
private $name = "";
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
$this->_lines = array();
}
/**
* get viewer information
*
* @return array viewer in array with label
*/
private function getViewer()
{
$result = array();
$i = 0;
foreach ($this->_lines as $line) {
$result[$i]['line'] = $line;
$i++;
}
return $result;
}
public function execute()
{
$this->_lines = array();
if (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT')) switch (strtolower(PSI_PLUGIN_VIEWER_ACCESS)) {
case 'command':
if (defined('PSI_PLUGIN_VIEWER_COMMAND') && is_string(PSI_PLUGIN_VIEWER_COMMAND)) {
if (defined('PSI_PLUGIN_VIEWER_PARAMS') && is_string(PSI_PLUGIN_VIEWER_PARAMS)) {
$params = PSI_PLUGIN_VIEWER_PARAMS;
} else {
$params = "";
}
$this->name = trim(PSI_PLUGIN_VIEWER_COMMAND." ".$params);
$lines = "";
if ((PSI_OS == 'WINNT') && ($cp = CommonFunctions::getcp())) {
if (CommonFunctions::executeProgram('cmd', '/c chcp '.$cp.' >nul & '.$this->name, $lines) && !empty($lines))
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
} else {
if (CommonFunctions::executeProgram(PSI_PLUGIN_VIEWER_COMMAND, $params, $lines) && !empty($lines))
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
} else {
$this->global_error->addConfigError("execute()", "[viewer] COMMAND");
}
break;
case 'data':
if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::rftsdata("viewer.tmp", $lines) && !empty($lines))
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
default:
$this->global_error->addConfigError("execute()", "[viewer] ACCESS");
}
}
public function xml()
{
if (empty($this->_lines))
return $this->xml->getSimpleXmlElement();
$arrBuff = $this->getViewer();
if (sizeof($arrBuff) > 0) {
$viewer = $this->xml->addChild("Viewer");
$viewer->addAttribute("Name", $this->name);
foreach ($arrBuff as $arrValue) {
$item = $viewer->addChild('Item');
$item->addAttribute('Line', $arrValue['line']);
}
}
return $this->xml->getSimpleXmlElement();
}
}

View File

@@ -0,0 +1,115 @@
/***************************************************************************
* Copyright (C) 2008 by phpSysInfo - A PHP System Information Script *
* http://phpsysinfo.sourceforge.net/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
//$Id: viewer.js 661 2016-05-03 11:26:39 erpomata $
/*global $, jQuery, buildBlock, datetime, plugin_translate */
"use strict";
var viewer_show = false;
/**
* insert content into table
* @param {jQuery} xml plugin-XML
*/
function viewer_populate(xml) {
var html = "", name = "", hostname = "";
hostname = $("Plugins Plugin_Viewer", xml).attr('Hostname');
if (hostname !== undefined) {
$('span[class=Hostname_Viewer]').html(hostname);
}
name = $("Plugins Plugin_Viewer Viewer", xml).attr("Name");
$("#Plugin_viewerTable-th").empty();
if (name !== undefined) $("#Plugin_viewerTable-th").append(name);
$("Plugins Plugin_Viewer Viewer Item", xml).each(function viewer_getitem(idp) {
html += " <tr>\n";
if ($(this).attr("Line") === "")
html += " <td style=\"font-weight:normal\">&nbsp;</td>\n";
else
html += " <td style=\"font-weight:normal\">" + $(this).attr("Line") + "</td>\n";
html += " </tr>\n";
viewer_show = true;
});
$("#Plugin_viewerTable-tbody").empty().append(html);
$('#Plugin_viewerTable tr:nth-child(even)').addClass('even');
}
function viewer_buildTable() {
var html = "";
html += "<div style=\"overflow-x:auto;\">\n";
html += " <table id=\"Plugin_viewerTable\" class=\"stripeMe\" style=\"border-collapse:collapse;\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th id=\"Plugin_viewerTable-th\"></th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody id=\"Plugin_viewerTable-tbody\">\n";
html += " </tbody>\n";
html += " </table>\n";
html += "</div>\n";
$("#Plugin_viewer").append(html);
}
/**
* load the xml via ajax
*/
function viewer_request() {
$("#Reload_viewerTable").attr("title", "reload");
$.ajax({
url: "xml.php?plugin=viewer",
dataType: "xml",
error: function viewer_error() {
$.jGrowl("Error loading XML document for Plugin Viewer!");
},
success: function viewer_buildblock(xml) {
populateErrors(xml);
viewer_populate(xml);
if (viewer_show) {
plugin_translate("viewer");
$("#Plugin_viewer").show();
}
}
});
}
$(document).ready(function viewer_buildpage() {
$("#footer").before(buildBlock("viewer", 1, true));
$("#Plugin_viewer").addClass("fullsize");
viewer_buildTable();
viewer_request();
$("#Reload_viewerTable").click(function viewer_reload(id) {
viewer_request();
$(this).attr("title", datetime());
});
});

View File

@@ -0,0 +1,32 @@
function renderPlugin_viewer(data) {
var directives = {
Line: {
html: function () {
if (this.Line === "")
return "&nbsp;";
else
return this.Line;
}
}
};
if ((data.Plugins.Plugin_Viewer !== undefined) && (data.Plugins.Plugin_Viewer.Viewer !== undefined)) {
var name = data.Plugins.Plugin_Viewer.Viewer["@attributes"].Name;
$('#viewer-th').empty();
if (name !== undefined) $('#viewer-th').append(name);
var upitems = items(data.Plugins.Plugin_Viewer.Viewer.Item);
if (upitems.length > 0) {
var up_memory = [];
up_memory.push_attrs(upitems);
$('#viewer-data').render(up_memory, directives);
$('#block_viewer').show();
} else {
$('#block_viewer').hide();
}
} else {
$('#block_viewer').hide();
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2029-06-15 13:43:21Z namiltd $ -->
<!--
phpSysInfo language file Language: English Created by: Mieczyslaw Nalewaj
-->
<tns:translationPlugin language="english" 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_viewer_001" name="viewer_hash">
<exp>Viewer</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2029-06-15 13:43:21Z namiltd $ -->
<!--
phpSysInfo language file Language: English 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_viewer_001" name="viewer_hash">
<exp>Πρόγραμμα Περιήγησης</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: pl.xml 661 2029-06-1 Mieczyslaw Nalewaj 13:43:21Z namiltd $ -->
<!--
phpSysInfo language file Language: Polish Created by: Mieczyslaw Nalewaj
-->
<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_viewer_001" name="viewer_hash">
<exp>Przeglądarka</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,24 @@
<div class="col-lg-12" id="block_viewer" style="display:none;">
<div class="card" id="panel_viewer" style="display:none;">
<div class="card-header"><span class="lang_plugin_viewer_001">Viewer</span>
<span class="hostname_viewer"></span>
<div id="reload_viewer" class="reload" title="reload"></div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="viewer" class="table table-hover table-sm">
<thead>
<tr>
<th id="viewer-th"></th>
</tr>
</thead>
<tbody id="viewer-data">
<tr>
<td><span data-bind="Line"></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>