* 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,17 +1,4 @@
<?php
/**
* UpdateNotifier Plugin
*
* PHP version 5
*
* @category PHP
* @package PSI_Plugin_UpdateNotifier
* @author Damien ROTH <iysaak@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @version SVN: $Id: class.updatenotifier.inc.php 661 2012-08-27 11:26:39Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* UpdateNotifier Plugin, which displays update notification from Ubuntu Landscape system
*
@@ -19,7 +6,7 @@
* @package PSI_Plugin_UpdateNotifier
* @author Damien ROTH <iysaak@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 $Id: class.updatenotifier.inc.php 661 2012-08-27 11:26:39Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
@@ -45,10 +32,38 @@ class UpdateNotifier extends PSI_Plugin
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
$buffer_info = "";
if (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT')) switch (strtolower(PSI_PLUGIN_UPDATENOTIFIER_ACCESS)) {
case 'command':
if (defined('PSI_PLUGIN_UPDATENOTIFIER_UBUNTU_LANDSCAPE_FORMAT') && PSI_PLUGIN_UPDATENOTIFIER_UBUNTU_LANDSCAPE_FORMAT) {
CommonFunctions::executeProgram("/usr/lib/update-notifier/apt-check", "--human-readable", $buffer_info);
} else {
CommonFunctions::executeProgram("/usr/lib/update-notifier/apt-check", "2>&1", $buffer_info);
}
break;
case 'data':
if (!defined('PSI_EMU_HOSTNAME')) {
if (defined('PSI_PLUGIN_UPDATENOTIFIER_FILE') && is_string(PSI_PLUGIN_UPDATENOTIFIER_FILE)) {
CommonFunctions::rfts(PSI_PLUGIN_UPDATENOTIFIER_FILE, $buffer_info);
} else {
CommonFunctions::rfts("/var/lib/update-notifier/updates-available", $buffer_info);
}
} else { //if (defined('PSI_EMU_PORT')
if (defined('PSI_PLUGIN_UPDATENOTIFIER_FILE') && is_string(PSI_PLUGIN_UPDATENOTIFIER_FILE)) {
CommonFunctions::executeProgram('cat', PSI_PLUGIN_UPDATENOTIFIER_FILE, $buffer_info);
} else {
CommonFunctions::executeProgram('cat', "/var/lib/update-notifier/updates-available", $buffer_info);
}
}
break;
default:
$this->global_error->addConfigError("__construct()", "[updatenotifier] ACCESS");
}
CommonFunctions::rfts(PSI_PLUGIN_UPDATENOTIFIER_FILE, $buffer_info);
// Remove blank lines
$this->_filecontent = preg_split("/\n/", $buffer_info, -1, PREG_SPLIT_NO_EMPTY);
if (trim($buffer_info) != "") {
// Remove blank lines
$this->_filecontent = preg_split("/\r?\n/", $buffer_info, -1, PREG_SPLIT_NO_EMPTY);
}
}
/**
@@ -63,16 +78,20 @@ class UpdateNotifier extends PSI_Plugin
return;
}
if (PSI_PLUGIN_UPDATENOTIFIER_UBUNTU_LANDSCAPE_FORMAT === true) {
if (defined('PSI_PLUGIN_UPDATENOTIFIER_UBUNTU_LANDSCAPE_FORMAT') && PSI_PLUGIN_UPDATENOTIFIER_UBUNTU_LANDSCAPE_FORMAT) {
/*
Ubuntu Landscape format:
- line 1: packages to update
- line 2: security packages to update
*/
if (count($this->_filecontent) == 2) {
if (count($this->_filecontent) >= 1) {
foreach ($this->_filecontent as $line) {
list($num, $text) = explode(" ", $line, 2);
$this->_result[] = $num;
if (preg_match("/^(\d+)\s/", $line, $num) && !preg_match("/UA Infra|ESM Apps/", $line)) {
$this->_result[] = $num[1];
}
}
if (empty($this->_result)) {
$this->global_error->addWarning("Unable to parse UpdateNotifier file");
}
} else {
$this->global_error->addWarning("Unable to parse UpdateNotifier file");
@@ -98,10 +117,14 @@ class UpdateNotifier extends PSI_Plugin
*/
public function xml()
{
if (!empty($this->_result)) {
if (!empty($this->_result) && is_numeric($this->_result[0])) {
$xmluu = $this->xml->addChild("UpdateNotifier");
$xmluu->addChild("packages", $this->_result[0]);
$xmluu->addChild("security", $this->_result[1]);
if (isset($this->_result[1]) && is_numeric($this->_result[1])) {
$xmluu->addChild("security", $this->_result[1]);
} else {
$xmluu->addChild("security", '0');
}
}
return $this->xml->getSimpleXmlElement();

View File

@@ -18,7 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang, createBar */
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang */
"use strict";
@@ -28,7 +28,12 @@ var UpdateNotifier_show = false, UpdateNotifier_table;
* @param {jQuery} xml plugin-XML
*/
function updatenotifier_populate(xml) {
var html = "";
var html = "", hostname = "";
hostname = $("Plugins Plugin_UpdateNotifier", xml).attr('Hostname');
if (hostname !== undefined) {
$('span[class=Hostname_UpdateNotifier]').html(hostname);
}
$("Plugins Plugin_UpdateNotifier UpdateNotifier", xml).each(function(idp) {
var packages = "", security = "";
@@ -38,19 +43,19 @@ function updatenotifier_populate(xml) {
//UpdateNotifier_table.fnAddData([packages]);
//UpdateNotifier_table.fnAddData([security]);
html = " <tr>\n";
html += " <td>" + packages + " " + genlang(3, true, "UpdateNotifier") + "</td>\n";
html += " </tr>\n";
html += " <tr>\n";
html += " <td>" + security + " " + genlang(4, true, "UpdateNotifier") + "</td>\n";
html += " </tr>\n";
html = " <tr>\n";
html += " <td>" + packages + " " + genlang(3, "UpdateNotifier") + "</td>\n";
html += " </tr>\n";
html += " <tr>\n";
html += " <td>" + security + " " + genlang(4, "UpdateNotifier") + "</td>\n";
html += " </tr>\n";
$("#Plugin_UpdateNotifier tbody").append(html);
$("#Plugin_UpdateNotifier tbody").empty().append(html);
if ((packages == 0) && (security == 0)) {
$("#UpdateNotifierTable-info").html(genlang(5, true, "UpdateNotifier"));
if ((packages <= 0) && (security <= 0)) {
$("#UpdateNotifierTable-info").html(genlang(5, "UpdateNotifier"));
} else {
$("#UpdateNotifierTable-info").html(genlang(2, true, "UpdateNotifier"));
$("#UpdateNotifierTable-info").html(genlang(2, "UpdateNotifier"));
}
UpdateNotifier_show = true;
@@ -63,15 +68,17 @@ function updatenotifier_populate(xml) {
function updatenotifier_buildTable() {
var html = "";
html += "<table id=\"Plugin_UpdateNotifierTable\" style=\"border-spacing:0;\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th id=\"UpdateNotifierTable-info\">" + genlang(2, true, "UpdateNotifier") + "</th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody>\n";
html += " </tbody>\n";
html += "</table>\n";
html += "<div style=\"overflow-x:auto;\">\n";
html += " <table id=\"Plugin_UpdateNotifierTable\" style=\"border-collapse:collapse;\">\n";
html += " <thead>\n";
html += " <tr>\n";
html += " <th id=\"UpdateNotifierTable-info\">" + genlang(2, "UpdateNotifier") + "</th>\n";
html += " </tr>\n";
html += " </thead>\n";
html += " <tbody>\n";
html += " </tbody>\n";
html += " </table>\n";
html += "</div>\n";
$("#Plugin_UpdateNotifier").append(html);
@@ -81,27 +88,33 @@ function updatenotifier_buildTable() {
* load the xml via ajax
*/
function updatenotifier_request() {
$("#Reload_UpdateNotifierTable").attr("title", "reload");
$.ajax({
url: "xml.php?plugin=UpdateNotifier",
dataType: "xml",
error: function () {
$.jGrowl("Error loading XML document for Plugin UpdateNotifier!");
},
success: function updatenotifier_buildblock(xml) {
populateErrors(xml);
updatenotifier_populate(xml);
if (UpdateNotifier_show) {
plugin_translate("UpdateNotifier");
$("#Plugin_UpdateNotifier").show();
$.jGrowl("Error loading XML document for Plugin UpdateNotifier!");
},
success: function updatenotifier_buildblock(xml) {
populateErrors(xml);
updatenotifier_populate(xml);
if (UpdateNotifier_show) {
plugin_translate("UpdateNotifier");
$("#Plugin_UpdateNotifier").show();
}
}
}
});
}
$(document).ready(function() {
$("#footer").before(buildBlock("UpdateNotifier", 1, false));
$("#Plugin_UpdateNotifier").css("width", "451px");
$("#footer").before(buildBlock("UpdateNotifier", 1, true));
$("#Plugin_UpdateNotifier").addClass("halfsize");
updatenotifier_buildTable();
updatenotifier_request();
$("#Reload_UpdateNotifierTable").click(function updatenotifier_reload(id) {
updatenotifier_request();
$(this).attr("title", datetime());
});
});

View File

@@ -3,20 +3,20 @@ function renderPlugin_updatenotifier(data) {
var directives = {
updateNotifierNbPackages: {
text: function () {
return this['packages'];
return this.packages;
}
},
updateNotifierNbSecPackages: {
text: function () {
return this['security'];
return this.security;
}
}
};
if ((data['Plugins']['Plugin_UpdateNotifier'] !== undefined) && (data['Plugins']['Plugin_UpdateNotifier']["UpdateNotifier"] !== undefined)){
$('#updatenotifier').render(data['Plugins']['Plugin_UpdateNotifier']["UpdateNotifier"], directives);
if ((data['Plugins']['Plugin_UpdateNotifier']["UpdateNotifier"]["packages"] == 0) &&
(data['Plugins']['Plugin_UpdateNotifier']["UpdateNotifier"]["security"] == 0) ) {
$("#updatenotifier-info").html("<strong>No updates available</strong>");
if ((data.Plugins.Plugin_UpdateNotifier !== undefined) && (data.Plugins.Plugin_UpdateNotifier.UpdateNotifier !== undefined)){
$('#updatenotifier').render(data.Plugins.Plugin_UpdateNotifier.UpdateNotifier, directives);
if ((data.Plugins.Plugin_UpdateNotifier.UpdateNotifier.packages <= 0) &&
(data.Plugins.Plugin_UpdateNotifier.UpdateNotifier.security <= 0) ) {
$("#updatenotifier-info").html("<strong>"+genlang(5, 'updatenotifier')+"</strong>");
}
$('#block_updatenotifier').show();
} else {

View File

@@ -21,4 +21,10 @@
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
<exp>Žádné aktualizace jsou dostupné</exp>
</expression>
<expression id="plugin_updatenotifier_006" name="updatenotifier_no_packages">
<exp>Number of packages</exp>
</expression>
<expression id="plugin_updatenotifier_007" name="updatenotifier_no_security">
<exp>Number of security packages</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!-- $Id: de.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: German Created by: Matthias Freund (MAFLO321)
-->
@@ -21,4 +21,10 @@
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
<exp>Keine Updates verfügbar</exp>
</expression>
<expression id="plugin_updatenotifier_006" name="updatenotifier_no_packages">
<exp>Anzahl Pakete</exp>
</expression>
<expression id="plugin_updatenotifier_007" name="updatenotifier_no_security">
<exp>Anzahl Sicherheitspakete</exp>
</expression>
</tns:translationPlugin>

View File

@@ -21,4 +21,10 @@
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
<exp>No updates available</exp>
</expression>
<expression id="plugin_updatenotifier_006" name="updatenotifier_no_packages">
<exp>Number of packages</exp>
</expression>
<expression id="plugin_updatenotifier_007" name="updatenotifier_no_security">
<exp>Number of security packages</exp>
</expression>
</tns:translationPlugin>

View File

@@ -21,4 +21,10 @@
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
<exp>Pas de mises à jour disponibles</exp>
</expression>
<expression id="plugin_updatenotifier_006" name="updatenotifier_no_packages">
<exp>Number of packages</exp>
</expression>
<expression id="plugin_updatenotifier_007" name="updatenotifier_no_security">
<exp>Number of security packages</exp>
</expression>
</tns:translationPlugin>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: gr.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
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_updatenotifier_001" name="updatenotifier_title">
<exp>Ειδοποιήσεις Ενημερώσεων</exp>
</expression>
<expression id="plugin_updatenotifier_002" name="updatenotifier_th">
<exp>Διαθέσιμες Ενημερώσεις</exp>
</expression>
<expression id="plugin_updatenotifier_003" name="updatenotifier_packages">
<exp>πακέτα μπορούν να ενημερωθούν.</exp>
</expression>
<expression id="plugin_updatenotifier_004" name="updatenotifier_security">
<exp>ενημερώσεις είναι ενημερώσεις ασφαλείας.</exp>
</expression>
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
<exp>Δεν υπάρχουν ενημερώσεις</exp>
</expression>
<expression id="plugin_updatenotifier_006" name="updatenotifier_no_packages">
<exp>Αριθμός πακέτων</exp>
</expression>
<expression id="plugin_updatenotifier_007" name="updatenotifier_no_security">
<exp>Αριθμός πακέτων ασφαλείας</exp>
</expression>
</tns:translationPlugin>

View File

@@ -21,4 +21,10 @@
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
<exp>Brak dostępnych aktualizacji</exp>
</expression>
<expression id="plugin_updatenotifier_006" name="updatenotifier_no_packages">
<exp>Liczba pakietów aktualizacyjnych</exp>
</expression>
<expression id="plugin_updatenotifier_007" name="updatenotifier_no_security">
<exp>Liczba pakietów aktualizacji zabezpieczeń</exp>
</expression>
</tns:translationPlugin>

View File

@@ -21,4 +21,10 @@
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
<exp>Nu actualizări disponibile</exp>
</expression>
<expression id="plugin_updatenotifier_006" name="updatenotifier_no_packages">
<exp>Number of packages</exp>
</expression>
<expression id="plugin_updatenotifier_007" name="updatenotifier_no_security">
<exp>Number of security packages</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!-- $Id: ru.xml 661 2012-08-27 11:26:39Z namiltd $ -->
<!--
phpSysInfo language file Language: Russian Created by: Denis Sevostyanov (den007)
-->
@@ -21,4 +21,10 @@
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
<exp>Нет доступных обновлений</exp>
</expression>
<expression id="plugin_updatenotifier_006" name="updatenotifier_no_packages">
<exp>Number of packages</exp>
</expression>
<expression id="plugin_updatenotifier_007" name="updatenotifier_no_security">
<exp>Number of security packages</exp>
</expression>
</tns:translationPlugin>

View File

@@ -1,11 +1,14 @@
<div class="col-lg-6" id="block_updatenotifier" style="display:none">
<div class="panel panel-primary">
<div class="panel-heading">Updates Notifier</div>
<div class="panel-body">
<p id="updatenotifier-info"><strong>Updates available</strong></p>
<div class="col-lg-6" id="block_updatenotifier" style="display:none;">
<div class="card" id="panel_updatenotifier" style="display:none;">
<div class="card-header"><span class="lang_plugin_updatenotifier_001">Updates Notifier</span>
<span class="hostname_updatenotifier"></span>
<div id="reload_updatenotifier" class="reload" title="reload"></div>
</div>
<div class="card-body">
<p id="updatenotifier-info"><strong><span class="lang_plugin_updatenotifier_002">Updates available</span></strong></p>
<ul class="list-group" id="updatenotifier">
<li class="list-group-item"><span class="badge" data-bind="updateNotifierNbPackages"></span>Number of packages</li>
<li class="list-group-item"><span class="badge" data-bind="updateNotifierNbSecPackages"></span>Number of security packages</li>
<li class="list-group-item"><span class="badge badge-secondary" data-bind="updateNotifierNbPackages"></span><span class="lang_plugin_updatenotifier_006">Number of packages</span></li>
<li class="list-group-item"><span class="badge badge-secondary" data-bind="updateNotifierNbSecPackages"></span><span class="lang_plugin_updatenotifier_007">Number of security packages</span></li>
</ul>
</div>
</div>