initial commit of file from CVS for smeserver-phpsysinfo on Sat Sep 7 20:53:46 AEST 2024
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
<?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
|
||||
*
|
||||
* @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 $Id: class.updatenotifier.inc.php 661 2012-08-27 11:26:39Z namiltd $
|
||||
* @link http://phpsysinfo.sourceforge.net
|
||||
*/
|
||||
class UpdateNotifier extends PSI_Plugin
|
||||
{
|
||||
/**
|
||||
* variable, which holds the content of the command
|
||||
* @var array
|
||||
*/
|
||||
private $_filecontent = array();
|
||||
|
||||
/**
|
||||
* variable, which holds the result before the xml is generated out of this array
|
||||
* @var array
|
||||
*/
|
||||
private $_result = array();
|
||||
|
||||
/**
|
||||
* read the data into an internal array and also call the parent constructor
|
||||
*
|
||||
* @param String $enc encoding
|
||||
*/
|
||||
public function __construct($enc)
|
||||
{
|
||||
parent::__construct(__CLASS__, $enc);
|
||||
|
||||
CommonFunctions::rfts(PSI_PLUGIN_UPDATENOTIFIER_FILE, $buffer_info);
|
||||
// Remove blank lines
|
||||
$this->_filecontent = preg_split("/\n/", $buffer_info, -1, PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* doing all tasks to get the required informations that the plugin needs
|
||||
* result is stored in an internal array
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
if (empty($this->_filecontent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (PSI_PLUGIN_UPDATENOTIFIER_UBUNTU_LANDSCAPE_FORMAT === true) {
|
||||
/*
|
||||
Ubuntu Landscape format:
|
||||
- line 1: packages to update
|
||||
- line 2: security packages to update
|
||||
*/
|
||||
if (count($this->_filecontent) == 2) {
|
||||
foreach ($this->_filecontent as $line) {
|
||||
list($num, $text) = explode(" ", $line, 2);
|
||||
$this->_result[] = $num;
|
||||
}
|
||||
} else {
|
||||
$this->global_error->addWarning("Unable to parse UpdateNotifier file");
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
Universal format: A;B
|
||||
- A: packages to update
|
||||
- B: security packages to update
|
||||
*/
|
||||
if (count($this->_filecontent) == 1 && strpos($this->_filecontent[0], ";") !== false) {
|
||||
$this->_result = explode(";", $this->_filecontent[0]);
|
||||
} else {
|
||||
$this->global_error->addWarning("Unable to parse UpdateNotifier file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* generates the XML content for the plugin
|
||||
*
|
||||
* @return SimpleXMLElement entire XML content for the plugin
|
||||
*/
|
||||
public function xml()
|
||||
{
|
||||
if (!empty($this->_result)) {
|
||||
$xmluu = $this->xml->addChild("UpdateNotifier");
|
||||
$xmluu->addChild("packages", $this->_result[0]);
|
||||
$xmluu->addChild("security", $this->_result[1]);
|
||||
}
|
||||
|
||||
return $this->xml->getSimpleXmlElement();
|
||||
}
|
||||
}
|
107
root/opt/phpsysinfo/plugins/updatenotifier/js/updatenotifier.js
Normal file
107
root/opt/phpsysinfo/plugins/updatenotifier/js/updatenotifier.js
Normal file
@@ -0,0 +1,107 @@
|
||||
/***************************************************************************
|
||||
* 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. *
|
||||
***************************************************************************/
|
||||
|
||||
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang, createBar */
|
||||
|
||||
"use strict";
|
||||
|
||||
var UpdateNotifier_show = false, UpdateNotifier_table;
|
||||
/**
|
||||
* insert content into table
|
||||
* @param {jQuery} xml plugin-XML
|
||||
*/
|
||||
function updatenotifier_populate(xml) {
|
||||
var html = "";
|
||||
|
||||
$("Plugins Plugin_UpdateNotifier UpdateNotifier", xml).each(function(idp) {
|
||||
var packages = "", security = "";
|
||||
packages = $("packages", this).text();
|
||||
security = $("security", this).text();
|
||||
|
||||
//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";
|
||||
|
||||
$("#Plugin_UpdateNotifier tbody").append(html);
|
||||
|
||||
if ((packages == 0) && (security == 0)) {
|
||||
$("#UpdateNotifierTable-info").html(genlang(5, true, "UpdateNotifier"));
|
||||
} else {
|
||||
$("#UpdateNotifierTable-info").html(genlang(2, true, "UpdateNotifier"));
|
||||
}
|
||||
|
||||
UpdateNotifier_show = true;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* fill the plugin block with table structure
|
||||
*/
|
||||
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";
|
||||
|
||||
$("#Plugin_UpdateNotifier").append(html);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* load the xml via ajax
|
||||
*/
|
||||
function updatenotifier_request() {
|
||||
$.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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#footer").before(buildBlock("UpdateNotifier", 1, false));
|
||||
$("#Plugin_UpdateNotifier").css("width", "451px");
|
||||
|
||||
updatenotifier_buildTable();
|
||||
updatenotifier_request();
|
||||
});
|
@@ -0,0 +1,25 @@
|
||||
function renderPlugin_updatenotifier(data) {
|
||||
|
||||
var directives = {
|
||||
updateNotifierNbPackages: {
|
||||
text: function () {
|
||||
return this['packages'];
|
||||
}
|
||||
},
|
||||
updateNotifierNbSecPackages: {
|
||||
text: function () {
|
||||
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>");
|
||||
}
|
||||
$('#block_updatenotifier').show();
|
||||
} else {
|
||||
$('#block_updatenotifier').hide();
|
||||
}
|
||||
}
|
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/cz.xml
Normal file
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/cz.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: cz.xml 661 2012-08-27 11:26:39Z namiltd $ -->
|
||||
<!--
|
||||
phpSysInfo language file Language: Czech Created by: Tomáš Růžička
|
||||
-->
|
||||
<tns:translationPlugin language="czech" 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>Notifikátor aktualizací</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_002" name="updatenotifier_th">
|
||||
<exp>Jsou dostupné aktualizace!</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_003" name="updatenotifier_packages">
|
||||
<exp>balíčků je připraveno k aktualizaci.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_004" name="updatenotifier_security">
|
||||
<exp>balíčků obsahuje bezpečnostní aktualizace.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
|
||||
<exp>Žádné aktualizace jsou dostupné</exp>
|
||||
</expression>
|
||||
</tns:translationPlugin>
|
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/de.xml
Normal file
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/de.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
|
||||
<!--
|
||||
phpSysInfo language file Language: German Created by: Matthias Freund (MAFLO321)
|
||||
-->
|
||||
<tns:translationPlugin language="german" 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>Updates Notifier</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_002" name="updatenotifier_th">
|
||||
<exp>Updates verfügbar</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_003" name="updatenotifier_packages">
|
||||
<exp>Pakete können aktualisiert werden.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_004" name="updatenotifier_security">
|
||||
<exp>Updates sind Sicherheits-Updates.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
|
||||
<exp>Keine Updates verfügbar</exp>
|
||||
</expression>
|
||||
</tns:translationPlugin>
|
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/en.xml
Normal file
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/en.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
|
||||
<!--
|
||||
phpSysInfo language file Language: English Created by: Damien ROTH
|
||||
-->
|
||||
<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_updatenotifier_001" name="updatenotifier_title">
|
||||
<exp>Updates Notifier</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_002" name="updatenotifier_th">
|
||||
<exp>Updates available</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_003" name="updatenotifier_packages">
|
||||
<exp>packages can be updated.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_004" name="updatenotifier_security">
|
||||
<exp>updates are security updates.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
|
||||
<exp>No updates available</exp>
|
||||
</expression>
|
||||
</tns:translationPlugin>
|
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/fr.xml
Normal file
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/fr.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: fr.xml 661 2012-08-27 11:26:39Z namiltd $ -->
|
||||
<!--
|
||||
phpSysInfo language file Language: French Created by: Damien ROTH
|
||||
-->
|
||||
<tns:translationPlugin language="french" 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>Updates Notifier</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_002" name="updatenotifier_th">
|
||||
<exp>Mises à jour disponibles</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_003" name="updatenotifier_packages">
|
||||
<exp>paquets peuvent être mit à jour.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_004" name="updatenotifier_security">
|
||||
<exp>mises à jour concernent la sécurité.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
|
||||
<exp>Pas de mises à jour disponibles</exp>
|
||||
</expression>
|
||||
</tns:translationPlugin>
|
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/pl.xml
Normal file
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/pl.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: pl.xml 661 2012-08-27 11:26:39Z 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_updatenotifier_001" name="updatenotifier_title">
|
||||
<exp>Updates Notifier</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_002" name="updatenotifier_th">
|
||||
<exp>Aktualizacje dostępne</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_003" name="updatenotifier_packages">
|
||||
<exp>pakietów do aktualizacji.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_004" name="updatenotifier_security">
|
||||
<exp>to aktualizacje zabezpieczeń.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
|
||||
<exp>Brak dostępnych aktualizacji</exp>
|
||||
</expression>
|
||||
</tns:translationPlugin>
|
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/ro.xml
Normal file
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/ro.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: ro.xml 661 2014-05-02 11:26:39Z namiltd $ -->
|
||||
<!--
|
||||
phpSysInfo language file Language: Romană Created by: Iulian Alexe
|
||||
-->
|
||||
<tns:translationPlugin language="romana" 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>Updates Notifier</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_002" name="updatenotifier_th">
|
||||
<exp>Actualizări Disponibile</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_003" name="updatenotifier_packages">
|
||||
<exp>Pachetele pot fi actualizate.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_004" name="updatenotifier_security">
|
||||
<exp>Sunt actualizări de securitate.</exp>
|
||||
</expression>
|
||||
<expression id="plugin_updatenotifier_005" name="updatenotifier_no">
|
||||
<exp>Nu actualizări disponibile</exp>
|
||||
</expression>
|
||||
</tns:translationPlugin>
|
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/ru.xml
Normal file
24
root/opt/phpsysinfo/plugins/updatenotifier/lang/ru.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: en.xml 661 2012-08-27 11:26:39Z namiltd $ -->
|
||||
<!--
|
||||
phpSysInfo language file Language: Russian Created by: Denis Sevostyanov (den007)
|
||||
-->
|
||||
<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_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>
|
||||
</tns:translationPlugin>
|
@@ -0,0 +1,12 @@
|
||||
<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>
|
||||
<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>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user