initial commit of file from CVS for smeserver-phpsysinfo on Sat Sep 7 20:53:46 AEST 2024
This commit is contained in:
114
root/opt/phpsysinfo/plugins/uprecords/class.uprecords.inc.php
Normal file
114
root/opt/phpsysinfo/plugins/uprecords/class.uprecords.inc.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?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
|
||||
*
|
||||
* @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 Release: 1.0
|
||||
* @link http://phpsysinfo.sourceforge.net
|
||||
*/
|
||||
|
||||
class uprecords extends PSI_Plugin
|
||||
{
|
||||
private $_lines;
|
||||
|
||||
public function __construct($enc)
|
||||
{
|
||||
parent::__construct(__CLASS__, $enc);
|
||||
|
||||
$this->_lines = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* get uprecords information
|
||||
*
|
||||
* @return array uprecords in array with label
|
||||
*/
|
||||
|
||||
private function uprecords()
|
||||
{
|
||||
$result = array();
|
||||
$i = 0;
|
||||
|
||||
foreach ($this->_lines as $line) {
|
||||
if (($i > 1) and (strpos($line, '---') === false)) {
|
||||
$buffer = preg_split("/\s*[ |]\s+/", ltrim(ltrim($line, '->'), ' '));
|
||||
if (strpos($line, '->') !== false) {
|
||||
$buffer[0] = '-> '.$buffer[0];
|
||||
}
|
||||
|
||||
if (count($buffer) > 4) {
|
||||
$buffer[3] = $buffer[3].' '.$buffer[4];
|
||||
}
|
||||
|
||||
$result[$i]['hash'] = $buffer[0];
|
||||
$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"));
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public function xml()
|
||||
{
|
||||
if (empty($this->_lines))
|
||||
return $this->xml->getSimpleXmlElement();
|
||||
|
||||
$arrBuff = $this->uprecords();
|
||||
if (sizeof($arrBuff) > 0) {
|
||||
$uprecords = $this->xml->addChild("Uprecords");
|
||||
foreach ($arrBuff as $arrValue) {
|
||||
$item = $uprecords->addChild('Item');
|
||||
$item->addAttribute('hash', $arrValue['hash']);
|
||||
$item->addAttribute('Uptime', $arrValue['Uptime']);
|
||||
$item->addAttribute('System', $arrValue['System']);
|
||||
$item->addAttribute('Bootup', $arrValue['Bootup']);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->xml->getSimpleXmlElement();
|
||||
}
|
||||
}
|
116
root/opt/phpsysinfo/plugins/uprecords/js/uprecords.js
Normal file
116
root/opt/phpsysinfo/plugins/uprecords/js/uprecords.js
Normal file
@@ -0,0 +1,116 @@
|
||||
/***************************************************************************
|
||||
* 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: uprecords.js 661 2014-01-08 11:26:39 aolah76 $
|
||||
|
||||
|
||||
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang, createBar */
|
||||
|
||||
"use strict";
|
||||
|
||||
var uprecords_show = false;
|
||||
|
||||
/**
|
||||
* insert content into table
|
||||
* @param {jQuery} xml plugin-XML
|
||||
*/
|
||||
|
||||
function uprecords_populate(xml) {
|
||||
|
||||
var html = "";// lastboot = 0;
|
||||
$("#Plugin_uprecordsTable").html(" ");
|
||||
|
||||
$("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"));
|
||||
if (typeof(lastboot.toUTCString)==="function") {
|
||||
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";
|
||||
uprecords_show = true;
|
||||
});
|
||||
|
||||
$("#Plugin_uprecordsTable").append(html);
|
||||
$('#Plugin_uprecordsTable tr:nth-child(even)').addClass('even');
|
||||
|
||||
}
|
||||
|
||||
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";
|
||||
$("#Plugin_uprecords").append(html);
|
||||
}
|
||||
|
||||
/**
|
||||
* load the xml via ajax
|
||||
*/
|
||||
|
||||
function uprecords_request() {
|
||||
$.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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function uprecords_buildpage() {
|
||||
$("#footer").before(buildBlock("uprecords", 1, true));
|
||||
$("#Plugin_uprecords").css("width", "915px");
|
||||
|
||||
uprecords_buildTable();
|
||||
|
||||
uprecords_request();
|
||||
|
||||
$("#Reload_uprecordsTable").click(function uprecords_reload(id) {
|
||||
uprecords_request();
|
||||
$("#Reload_uprecordsTable").attr("title",datetime());
|
||||
});
|
||||
});
|
@@ -0,0 +1,25 @@
|
||||
function renderPlugin_uprecords(data) {
|
||||
|
||||
var directives = {
|
||||
hash: {
|
||||
html: function () {
|
||||
return this["hash"];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
$('#uprecords-data').render(up_memory, directives);
|
||||
|
||||
$('#block_uprecords').show();
|
||||
} else {
|
||||
$('#block_uprecords').hide();
|
||||
}
|
||||
} else {
|
||||
$('#block_uprecords').hide();
|
||||
}
|
||||
}
|
27
root/opt/phpsysinfo/plugins/uprecords/lang/en.xml
Normal file
27
root/opt/phpsysinfo/plugins/uprecords/lang/en.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: en.xml 661 2014-01-08 11:26:39Z aolah76 $ -->
|
||||
<!--
|
||||
phpSysInfo language file Language: English Created by: Ambrus Sandor Olah
|
||||
-->
|
||||
<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_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>
|
||||
<expression id="plugin_uprecords_102" name="uprecords_uptime">
|
||||
<exp>Uptime</exp>
|
||||
</expression>
|
||||
<expression id="plugin_uprecords_103" name="uprecords_system">
|
||||
<exp>System</exp>
|
||||
</expression>
|
||||
<expression id="plugin_uprecords_104" name="uprecords_bootup">
|
||||
<exp>Boot up</exp>
|
||||
</expression>
|
||||
</tns:translationPlugin>
|
26
root/opt/phpsysinfo/plugins/uprecords/lang/fr.xml
Normal file
26
root/opt/phpsysinfo/plugins/uprecords/lang/fr.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
phpSysInfo language file Language: French Created by: phpsysinfo
|
||||
-->
|
||||
<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_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>
|
||||
<expression id="plugin_uprecords_102" name="uprecords_uptime">
|
||||
<exp>Uptime</exp>
|
||||
</expression>
|
||||
<expression id="plugin_uprecords_103" name="uprecords_system">
|
||||
<exp>Système</exp>
|
||||
</expression>
|
||||
<expression id="plugin_uprecords_104" name="uprecords_bootup">
|
||||
<exp>Démarrage</exp>
|
||||
</expression>
|
||||
</tns:translationPlugin>
|
27
root/opt/phpsysinfo/plugins/uprecords/lang/hu.xml
Normal file
27
root/opt/phpsysinfo/plugins/uprecords/lang/hu.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: hu.xml 661 2014-01-08 11:26:39Z aolah76 $ -->
|
||||
<!--
|
||||
phpSysInfo language file Language: Hungarian Created by: Ambrus Sandor Olah
|
||||
-->
|
||||
<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_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>
|
||||
<expression id="plugin_uprecords_102" name="uprecords_uptime">
|
||||
<exp>Uptime</exp>
|
||||
</expression>
|
||||
<expression id="plugin_uprecords_103" name="uprecords_system">
|
||||
<exp>Rendszer</exp>
|
||||
</expression>
|
||||
<expression id="plugin_uprecords_104" name="uprecords_bootup">
|
||||
<exp>Rendszerindítás időpontja</exp>
|
||||
</expression>
|
||||
</tns:translationPlugin>
|
27
root/opt/phpsysinfo/plugins/uprecords/lang/pl.xml
Normal file
27
root/opt/phpsysinfo/plugins/uprecords/lang/pl.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: pl.xml 661 2014-01-08 11:26:39Z aolah76 $ -->
|
||||
<!--
|
||||
phpSysInfo language file Language: Polish Created by: 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_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>
|
||||
<expression id="plugin_uprecords_102" name="uprecords_uptime">
|
||||
<exp>Czas pracy</exp>
|
||||
</expression>
|
||||
<expression id="plugin_uprecords_103" name="uprecords_system">
|
||||
<exp>System</exp>
|
||||
</expression>
|
||||
<expression id="plugin_uprecords_104" name="uprecords_bootup">
|
||||
<exp>Wystartował</exp>
|
||||
</expression>
|
||||
</tns:translationPlugin>
|
27
root/opt/phpsysinfo/plugins/uprecords/lang/ro.xml
Normal file
27
root/opt/phpsysinfo/plugins/uprecords/lang/ro.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: ro.xml 661 2014-01-08 11:26:39Z aolah76 $ -->
|
||||
<!--
|
||||
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_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>
|
||||
<expression id="plugin_uprecords_102" name="uprecords_uptime">
|
||||
<exp>Uptime</exp>
|
||||
</expression>
|
||||
<expression id="plugin_uprecords_103" name="uprecords_system">
|
||||
<exp>System</exp>
|
||||
</expression>
|
||||
<expression id="plugin_uprecords_104" name="uprecords_bootup">
|
||||
<exp>Boot up</exp>
|
||||
</expression>
|
||||
</tns:translationPlugin>
|
27
root/opt/phpsysinfo/plugins/uprecords/lang/ru.xml
Normal file
27
root/opt/phpsysinfo/plugins/uprecords/lang/ru.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: ru.xml 661 2015-01-05 11:26:39Z $ -->
|
||||
<!--
|
||||
phpSysInfo language file Language: Russian Created by: Denis Sevostyanov (den007)
|
||||
-->
|
||||
<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_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>
|
||||
<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>
|
@@ -0,0 +1,25 @@
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user