Subversion Repositories ALCASAR

Compare Revisions

No changes between revisions

Ignore whitespace Rev 2770 → Rev 2769

/web/acc/phpsysinfo/includes/xml/class.SimpleXMLExtended.inc.php
File deleted
/web/acc/phpsysinfo/includes/xml/class.XML.inc.php
File deleted
/web/acc/phpsysinfo/includes/xml/portail.php
0,0 → 1,181
<?php
/***************************************************************************
* Copyright (C) 2006 by phpSysInfo - A PHP System Information Script *
* http://phpsysinfo.sourceforge.net/ *
* addons by 3abtux & Rexy for ALCASAR *
* 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$
 
// xml_utilisateur()
 
function request ($texte) {
$strResult = 0;
// Déclaration des paramètres de connexion
$host = "localhost";
$DB_USER = "radius";
$DB_RADIUS = "radius";
$radiuspwd = "";
// Connexion au serveur
$mysqli = new mysqli($host, $DB_USER, $radiuspwd, $DB_RADIUS);
if ($texte == 'user') {$query = "SELECT UserName FROM userinfo";}
else { $query = "SELECT GroupName FROM radusergroup GROUP BY GroupName";}
$result = $mysqli->query($query);
// Recuperation des resultats
$strResult = $result->num_rows;
// Deconnexion de la base de donnees
$mysqli->close();
return $strResult;
}
 
function xml_portail () {
global $sysinfo;
 
$_text = " <Portail>\n"
// . " <Utilisateur>" . htmlspecialchars( request('user'), ENT_QUOTES ) . "</Utilisateur>\n"
. " <Utilisateur>" . "</Utilisateur>\n"
. " <Groupe>" . "</Groupe>\n";
// . " <Groupe>" . htmlspecialchars( trim( request('group') ), ENT_QUOTES ) . "</Groupe>\n";
$_text .= " </Portail>\n";
 
return $_text;
}
// Fonction de test de connectivité internet
function internetTest() {
$host = 'www.google.com';
$host2 = 'www.alcasar.net';
$port = 80;
 
$sock = @fsockopen($host, $port, $errno, $errstr, 2);
if ($sock) {
fclose($sock);
return true;
}
 
$sock = @fsockopen($host2, $port, $errno, $errstr, 2);
if ($sock) {
fclose($sock);
return true;
}
 
return false;
}
// Fonction de test du filtrage
function filtrageTest($file, $search_regex){
$pointeur = fopen($file,"r");
$result = false;
if ($pointeur)
{
while (!feof($pointeur))
{
$ligne = fgets($pointeur);
if (preg_match($search_regex, $ligne, $r))
{
$result = true;
break;
}
}
}
fclose($pointeur);
return $result;
}
// html_portail()
function html_portail () {
global $webpath;
global $XPath;
global $text;
 
// Read CONF_FILE
define ('CONF_FILE', '/usr/local/etc/alcasar.conf');
$file_conf = fopen(CONF_FILE, 'r');
if (!$file_conf) {
exit('Error opening the file '.CONF_FILE);
}
while (!feof($file_conf)) {
$buffer = fgets($file_conf, 4096);
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
$tmp = explode('=', $buffer, 2);
$conf[trim($tmp[0])] = trim($tmp[1]);
}
}
fclose($file_conf);
 
// Get current version
$INSTALLEDVERSION = $conf['VERSION'];
$VERSIONBL = date ("F d Y", filemtime ('/etc/e2guardian/lists/blacklists/README'));
$nbr_user = request ('user');
$nbr_grp = request ('group');
$nbr_user_online = exec ("sudo /usr/sbin/chilli_query list | cut -d\" \" -f5 | grep \"1\" | wc -l");
if ((filtrageTest("/var/www/html/index.php","/network_pb = false/")) && (internetTest())) {
$internet_status = "<img src='/images/state_ok.gif'>".$text['enable'];
$version = dns_get_record("version.alcasar.net",DNS_TXT);
$AVAILABLEDVERSION = $version[0]['txt'];
} else {
$internet_status = "<img src='/images/state_error.gif'>".$text['disable'];
$AVAILABLEDVERSION = "-";
}
$_text = "<table border=\"0\" width=\"100%\" align=\"center\">\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['internet_link'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $internet_status . "</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['portail-version'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $INSTALLEDVERSION . "</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['portail-disp'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $AVAILABLEDVERSION . "</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['utilisateur'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $nbr_user_online . " / " . $nbr_user . "</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['groupe'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $nbr_grp . "</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['bl-version'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $VERSIONBL . "</font></td>\n"
. " </tr>\n"
. "</table>\n";
return $_text;
}
 
function wml_portail () {
global $XPath;
global $text;
 
$_text = "<card id=\"vitals\" title=\"" . $text['vitals'] . "\">\n"
. "<p>" . $text['hostname'] . ":<br/>\n"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/Hostname" ) . "</p>\n"
. "<p>" . $text['ip'] . ":<br/>\n"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/IPAddr" ) . "</p>\n"
. "<p>" . $text['kversion'] . ":<br/>\n"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/Kernel" ) . "</p>\n"
. "<p>" . $text['uptime'] . ":<br/>\n"
. "-&nbsp;" . uptime( $XPath->getData( "/phpsysinfo/Vitals/Uptime" ) ) . "</p>\n"
. "<p>" . $text['users'] . ":<br/>"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/Users" ) . "</p>\n"
. "<p>" . $text['loadavg'] . ":<br/>"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/LoadAvg" ) . "</p>\n"
. "</card>\n";
 
return $_text;
}
?>
Property changes:
Added: svn:keywords
+Id Date Author
\ No newline at end of property
/web/acc/phpsysinfo/includes/xml/vitals.php
0,0 → 1,134
<?php
/***************************************************************************
* Copyright (C) 2006 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: vitals.php,v 1.32 2007/02/18 18:59:54 bigmichi1 Exp $
 
// xml_vitals()
 
function xml_vitals () {
global $sysinfo;
global $loadbar;
global $show_vhostname;
$strLoadavg = "";
$arrBuf = ( $loadbar ? $sysinfo->loadavg( $loadbar ) : $sysinfo->loadavg() );
foreach( $arrBuf['avg'] as $strValue) {
$strLoadavg .= $strValue . ' ';
}
$_text = " <Vitals>\n"
. " <Hostname>" . htmlspecialchars( $show_vhostname ? $sysinfo->vhostname() : $sysinfo->chostname(), ENT_QUOTES ) . "</Hostname>\n"
. " <IPAddr>" . htmlspecialchars( $show_vhostname ? $sysinfo->vip_addr() : $sysinfo->ip_addr(), ENT_QUOTES ) . "</IPAddr>\n"
. " <Kernel>" . htmlspecialchars( $sysinfo->kernel(), ENT_QUOTES ) . "</Kernel>\n"
. " <Distro>" . htmlspecialchars( $sysinfo->distro(), ENT_QUOTES ) . "</Distro>\n"
. " <Distroicon>" . htmlspecialchars( $sysinfo->distroicon(), ENT_QUOTES ) . "</Distroicon>\n"
. " <Uptime>" . htmlspecialchars( $sysinfo->uptime(), ENT_QUOTES ) . "</Uptime>\n"
// . " <Users>" . htmlspecialchars( $sysinfo->users(), ENT_QUOTES ) . "</Users>\n"
. " <LoadAvg>" . htmlspecialchars( trim( $strLoadavg ), ENT_QUOTES ) . "</LoadAvg>\n";
if( isset( $arrBuf['cpupercent'] ) ) {
$_text .= " <CPULoad>" . htmlspecialchars( round( $arrBuf['cpupercent'], 2 ), ENT_QUOTES ) . "</CPULoad>";
}
$_text .= " </Vitals>\n";
return $_text;
}
 
// html_vitals()
function html_vitals () {
global $webpath;
global $XPath;
global $text;
$textdir = direction();
$scale_factor = 2;
$strLoadbar = "";
$uptime = "";
$date = date('d-m-Y H:i:s');
$certificateInfos = openssl_x509_parse(file_get_contents('/etc/pki/tls/certs/alcasar.crt'));
$certExpirationDate = date('d-m-Y H:i:s', $certificateInfos['validTo_time_t']);
if( $XPath->match( "/phpsysinfo/Vitals/CPULoad" ) )
$strLoadbar = "<br>" . create_bargraph( $XPath->getData( "/phpsysinfo/Vitals/CPULoad" ), 100, $scale_factor ) . "&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/CPULoad" ) . "%";
$_text = "<table border=\"0\" width=\"100%\" align=\"center\">\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['hostname'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Vitals/Hostname" ) . "</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['cert_expiration_date'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $certExpirationDate . "</font></td>\n"
. " </tr>\n"
// . " <tr>\n"
// . " <td valign=\"top\"><font size=\"-1\">" . $text['ip'] . "</font></td>\n"
// . " <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Vitals/IPAddr" ) . "</font></td>\n"
// . " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['kversion'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Vitals/Kernel" ) . "</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['dversion'] . "</font></td>\n"
. " <td><img width=\"16\" height=\"16\" alt=\"\" src=\"" . $webpath . "images/" . $XPath->getData( "/phpsysinfo/Vitals/Distroicon" ) . "\">&nbsp;<font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Distro") . "</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . "Date" . "</font></td>\n"
. " <td><font size=\"-1\">" . $date . "</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['uptime'] . "</font></td>\n"
. " <td><font size=\"-1\">" . uptime( $XPath->getData( "/phpsysinfo/Vitals/Uptime" ) ) . "</font></td>\n"
. " </tr>\n"
// . " <tr>\n"
// . " <td valign=\"top\"><font size=\"-1\">" . $text['users'] . "</font></td>\n"
// . " <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Vitals/Users" ) . "</font></td>\n"
// . " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['loadavg'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Vitals/LoadAvg" ) . $strLoadbar . "</font></td>\n"
. " </tr>\n"
. "</table>\n";
return $_text;
}
 
function wml_vitals () {
global $XPath;
global $text;
$_text = "<card id=\"vitals\" title=\"" . $text['vitals'] . "\">\n"
. "<p>" . $text['hostname'] . ":<br/>\n"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/Hostname" ) . "</p>\n"
. "<p>" . $text['ip'] . ":<br/>\n"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/IPAddr" ) . "</p>\n"
. "<p>" . $text['kversion'] . ":<br/>\n"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/Kernel" ) . "</p>\n"
. "<p>" . $text['uptime'] . ":<br/>\n"
. "-&nbsp;" . uptime( $XPath->getData( "/phpsysinfo/Vitals/Uptime" ) ) . "</p>\n"
. "<p>" . $text['users'] . ":<br/>"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/Users" ) . "</p>\n"
. "<p>" . $text['loadavg'] . ":<br/>"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/LoadAvg" ) . "</p>\n"
. "</card>\n";
return $_text;
}
?>
/web/acc/phpsysinfo/includes/xml/network.php
0,0 → 1,95
<?php
/***************************************************************************
* Copyright (C) 2006 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: network.php,v 1.15 2007/02/08 20:16:25 bigmichi1 Exp $
 
//
// xml_network()
//
function xml_network () {
global $sysinfo;
$arrNet = $sysinfo->network();
$_text = " <Network>\n";
foreach( $arrNet as $strDev => $arrStats ) {
$_text .= " <NetDevice>\n"
. " <Name>" . htmlspecialchars( trim( $strDev ), ENT_QUOTES ) . "</Name>\n"
. " <RxBytes>" . htmlspecialchars( $arrStats['rx_bytes'], ENT_QUOTES ) . "</RxBytes>\n"
. " <TxBytes>" . htmlspecialchars( $arrStats['tx_bytes'], ENT_QUOTES ) . "</TxBytes>\n"
. " <Errors>" . htmlspecialchars( $arrStats['errs'], ENT_QUOTES ) . "</Errors>\n"
. " <Drops>" . htmlspecialchars( $arrStats['drop'], ENT_QUOTES ) . "</Drops>\n"
. " </NetDevice>\n";
}
$_text .= " </Network>\n";
return $_text;
}
 
//
// html_network()
//
function html_network () {
global $XPath;
global $text;
$textdir = direction();
$_text = "<table border=\"0\" width=\"100%\" align=\"center\">\n"
. " <tr>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['device'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['received'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['sent'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['errors'] . "</b></font></td>\n"
. " </tr>\n";
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/Network" ) ); $i < $max; $i++ ) {
if( $XPath->match( "/phpsysinfo/Network/NetDevice[" . $i . "]/Name" ) ) {
$_text .= " <tr>\n";
$_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Network/NetDevice[" . $i . "]/Name" ) . "</font></td>\n";
$_text .= " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Network/NetDevice[" . $i . "]/RxBytes" ) / 1024 ) . "</font></td>\n";
$_text .= " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Network/NetDevice[" . $i . "]/TxBytes" ) / 1024 ) . "</font></td>\n";
$_text .= " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Network/NetDevice[" . $i . "]/Errors" ) . '/' . $XPath->getData( "/phpsysinfo/Network/NetDevice[" . $i . "]/Drops" ) . "</font></td>\n";
$_text .= " </tr>\n";
}
}
$_text .= "</table>";
return $_text;
}
 
function wml_network() {
global $XPath;
global $text;
$_text = "<card id=\"network\" title=\"" . $text['netusage'] . "\">\n";
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/Network" ) ); $i < $max; $i++ ) {
if( $XPath->match( "/phpsysinfo/Network/NetDevice[" . $i . "]/Name" ) ) {
$_text .= "<p>" . $text['device'] . ": " . $XPath->getData( "/phpsysinfo/Network/NetDevice[" . $i . "]/Name" ) . "<br/>\n"
. "- U: " . format_bytesize( $XPath->getData("/phpsysinfo/Network/NetDevice[" . $i . "]/TxBytes" ) / 1024 ) . "<br/>\n"
. "- D: " . format_bytesize( $XPath->getData("/phpsysinfo/Network/NetDevice[" . $i . "]/RxBytes" ) / 1024 ) . "<br/>\n"
. "- E: " . $XPath->getData( "/phpsysinfo/Network/NetDevice[" . $i . "]/Errors" ) . '/' . $XPath->getData( "/phpsysinfo/Network/NetDevice[" . $i . "]/Drops" ) . "</p>\n";
}
}
$_text .= "</card>\n";
return $_text;
}
?>
/web/acc/phpsysinfo/includes/xml/utilisateur.php.2
0,0 → 1,87
<?php
/***************************************************************************
* Copyright (C) 2006 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: vitals.php,v 1.32 2007/02/18 18:59:54 bigmichi1 Exp $
 
// xml_vitals()
 
function xml_utilisateur () {
global $sysinfo;
global $loadbar;
global $show_vhostname;
$strLoadavg = "";
$arrBuf = ( $loadbar ? $sysinfo->loadavg( $loadbar ) : $sysinfo->loadavg() );
foreach( $arrBuf['avg'] as $strValue) {
$strLoadavg .= $strValue . ' ';
}
$_text = " <Portail>\n"
. " <Utilisateur>" . htmlspecialchars( $show_vhostname ? $sysinfo->vhostname() : $sysinfo->chostname(), ENT_QUOTES ) . "</Utilisateur>\n"
. " <Groupe>" . htmlspecialchars( $show_vhostname ? $sysinfo->vip_addr() : $sysinfo->ip_addr(), ENT_QUOTES ) . "</Groupe>\n";
$_text .= " </Portail>\n";
return $_text;
}
 
// html_vitals()
function html_utilisateur () {
global $webpath;
global $XPath;
global $text;
$textdir = direction();
$scale_factor = 2;
$strLoadbar = "";
$uptime = "";
if( $XPath->match( "/phpsysinfo/Portail/User" ) )
$strLoadbar = "<br>" . create_bargraph( $XPath->getData( "/phpsysinfo/Vitals/CPULoad" ), 100, $scale_factor ) . "&nbsp;" . $XPath->getData( "/phpsysinfo/Portail/User" ) . "%";
$_text = "<table border=\"0\" width=\"100%\" align=\"center\">\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['utilisateur'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Portail/Utilisateur" ) . "</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td valign=\"top\"><font size=\"-1\">" . $text['groupe'] . "</font></td>\n"
. " <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Portail/Groupe" ) . "</font></td>\n"
. " </tr>\n"
. "</table>\n";
return $_text;
}
 
function wml_utilisateur () {
global $XPath;
global $text;
$_text = "<card id=\"vitals\" title=\"" . $text['vitals'] . "\">\n"
. "<p>" . $text['hostname'] . ":<br/>\n"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/Hostname" ) . "</p>\n"
. "<p>" . $text['ip'] . ":<br/>\n"
. "-&nbsp;" . $XPath->getData( "/phpsysinfo/Vitals/IPAddr" ) . "</p>\n"
. "</card>\n";
return $_text;
}
?>
/web/acc/phpsysinfo/includes/xml/mbinfo.php
0,0 → 1,208
<?php
/***************************************************************************
* Copyright (C) 2006 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: mbinfo.php,v 1.20 2007/02/18 19:11:31 bigmichi1 Exp $
 
function xml_mbinfo() {
global $text;
global $mbinfo;
$_text = "";
$arrBuff = $mbinfo->temperature();
$_text = " <MBinfo>\n";
if( sizeof($arrBuff ) > 0 ) {
$_text .= " <Temperature>\n";
foreach( $arrBuff as $arrValue ) {
$_text .= " <Item>\n";
$_text .= " <Label>" . htmlspecialchars( $arrValue['label'], ENT_QUOTES ) . "</Label>\n";
$_text .= " <Value>" . htmlspecialchars( $arrValue['value'], ENT_QUOTES ) . "</Value>\n";
$_text .= " <Limit>" . htmlspecialchars( $arrValue['limit'], ENT_QUOTES ) . "</Limit>\n";
$_text .= " </Item>\n";
}
$_text .= " </Temperature>\n";
}
$arrBuff = $mbinfo->fans();
if( sizeof( $arrBuff ) > 0 ) {
$_text .= " <Fans>\n";
foreach( $arrBuff as $arrValue ) {
$_text .= " <Item>\n";
$_text .= " <Label>" . htmlspecialchars( $arrValue['label'], ENT_QUOTES ) . "</Label>\n";
$_text .= " <Value>" . htmlspecialchars( $arrValue['value'], ENT_QUOTES ) . "</Value>\n";
$_text .= " <Min>" . htmlspecialchars( $arrValue['min'], ENT_QUOTES ) . "</Min>\n";
$_text .= " </Item>\n";
}
$_text .= " </Fans>\n";
}
$arrBuff = $mbinfo->voltage();
if( sizeof( $arrBuff ) > 0 ) {
$_text .= " <Voltage>\n";
foreach( $arrBuff as $arrValue ) {
$_text .= " <Item>\n";
$_text .= " <Label>" . htmlspecialchars( $arrValue['label'], ENT_QUOTES ) . "</Label>\n";
$_text .= " <Value>" . htmlspecialchars( $arrValue['value'], ENT_QUOTES ) . "</Value>\n";
$_text .= " <Min>" . htmlspecialchars( $arrValue['min'], ENT_QUOTES ) . "</Min>\n";
$_text .= " <Max>" . htmlspecialchars( $arrValue['max'], ENT_QUOTES ) . "</Max>\n";
$_text .= " </Item>\n";
}
$_text .= " </Voltage>\n";
}
$_text .= " </MBinfo>\n";
return $_text;
}
 
function html_mbtemp() {
global $text;
global $XPath;
$textdir = direction();
$scale_factor = 2;
$_text = " <tr>\n"
. " <td><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n"
. " <td><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_limit'] . "</b></font></td>\n"
. " </tr>\n";
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Temperature" ) ); $i < $max; $i++ ) {
$_text .= " <tr>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Label" ) . "</font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">";
if( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ) == 0) {
$_text .= "Unknown - Not connected?";
} else {
$_text .= create_bargraph( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ), $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Limit" ), $scale_factor );
}
$_text .= temperature( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . temperature( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Limit" ) ) . "</font></td>\n"
. " </tr>\n";
}
return $_text;
}
 
function html_mbfans() {
global $text;
global $XPath;
$textdir = direction();
$booShowfans = false;
$_text ="<table width=\"100%\">\n";
$_text .= " <tr>\n"
. " <td><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_min'] . "</b></font></td>\n"
. " </tr>\n";
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Fans" ) ); $i < $max; $i++ ) {
$_text .= " <tr>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Fans/Item[" . $i . "]/Label" ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . round( $XPath->getData( "/phpsysinfo/MBinfo/Fans/Item[" . $i . "]/Value" ) ) . " " . $text['rpm_mark'] . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Fans/Item[" . $i . "]/Min" ) . " " . $text['rpm_mark'] . "</font></td>\n"
. " </tr>\n";
if( round( $XPath->getData( "/phpsysinfo/MBinfo/Fans/Item[" . $i . "]/Value" ) ) > 0 ) {
$booShowfans = true;
}
}
$_text .= "</table>\n";
if( ! $booShowfans ) {
$_text = "";
}
return $_text;
}
 
function html_mbvoltage() {
global $text;
global $XPath;
$textdir = direction();
$_text = "<table width=\"100%\">\n";
$_text .= " <tr>\n"
. " <td><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_min'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_max'] . "</b></font></td>\n"
. " </tr>\n";
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Voltage" ) ); $i < $max; $i++ ) {
$_text .= " <tr>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Label" ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Value" ) . " " . $text['voltage_mark'] . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Min" ) . " " . $text['voltage_mark'] . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Max" ) . " " . $text['voltage_mark'] . "</font></td>\n"
. " </tr>\n";
}
$_text .= "</table>\n";
return $_text;
}
 
function wml_mbtemp() {
global $XPath;
$_text = "";
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Temperature" ) ); $i < $max; $i++ ) {
$_text .= "<p>" . $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Label" ) . ": ";
if( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ) == 0 ) {
$_text .= "Unknown - Not connected?</p>";
} else {
$_text .= "&nbsp;" . str_replace( "&deg;", "", temperature( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ) ) ) . "</p>\n";
}
}
return $_text;
}
 
function wml_mbfans() {
global $text;
global $XPath;
$_text = "<card id=\"fans\" title=\"" . $text['fans'] . "\">\n";
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Fans" ) ); $i < $max; $i++ ) {
$_text .= "<p>" . $XPath->getData( "/phpsysinfo/MBinfo/Fans/Item[" . $i . "]/Label" ) . ": " . round( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ) ) . "&nbsp;" . $text['rpm_mark'] . "</p>\n";
}
$_text .= "</card>\n";
return $_text;
}
 
function wml_mbvoltage() {
global $text;
global $XPath;
$_text = "<card id=\"volt\" title=\"" . $text['voltage'] . "\">\n";
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Voltage" ) ); $i < $max; $i++ ) {
$_text .= "<p>" . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Label" ) . ": " . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Value" ) . "&nbsp;" . $text['voltage_mark'] . "</p>\n";
}
$_text .= "</card>\n";
return $_text;
}
?>
/web/acc/phpsysinfo/includes/xml/hardware.php
0,0 → 1,224
<?php
/***************************************************************************
* Copyright (C) 2006 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: hardware.php,v 1.36 2007/01/21 11:13:51 bigmichi1 Exp $
 
function xml_hardware() {
global $sysinfo;
global $text;
$strPcidevices = ""; $strIdedevices = ""; $strUsbdevices = ""; $strScsidevices = "";
$arrSys = $sysinfo->cpu_info();
$arrBuf = finddups( $sysinfo->pci() );
if( count( $arrBuf ) ) {
for( $i = 0, $max = sizeof($arrBuf); $i < $max; $i++ ) {
if( $arrBuf[$i] ) {
$strPcidevices .= " <Device><Name>" . htmlspecialchars( chop( $arrBuf[$i] ), ENT_QUOTES ) . "</Name></Device>\n";
}
}
}
$arrBuf = $sysinfo->ide();
if( count( $arrBuf ) ) {
foreach( $arrBuf as $strKey => $arrValue ) {
$strIdedevices .= " <Device>\n<Name>" . htmlspecialchars( $strKey . ': ' . $arrValue['model'], ENT_QUOTES ) . "</Name>\n";
if( isset( $arrValue['capacity'] ) ) {
$strIdedevices .= '<Capacity>' . htmlspecialchars( $arrValue['capacity'], ENT_QUOTES ) . '</Capacity>';
}
$strIdedevices .= "</Device>\n";
}
}
$arrBuf = $sysinfo->scsi();
if( count( $arrBuf ) ) {
foreach( $arrBuf as $strKey => $arrValue ) {
$strScsidevices .= "<Device>\n";
if( $strKey >= '0' && $strKey <= '9' ) {
$strScsidevices .= " <Name>" . htmlspecialchars( $arrValue['model'], ENT_QUOTES ) . "</Name>\n";
} else {
$strScsidevices .= " <Name>" . htmlspecialchars( $strKey . ': ' . $arrValue['model'], ENT_QUOTES ) . "</Name>\n";
}
if( isset( $arrrValue['capacity'])) {
$strScsidevices .= '<Capacity>' . htmlspecialchars( $arrValue['capacity'], ENT_QUOTES ) . '</Capacity>';
}
$strScsidevices .= "</Device>\n";
}
}
$arrBuf = finddups( $sysinfo->usb() );
if( count( $arrBuf ) ) {
for( $i = 0, $max = sizeof( $arrBuf ); $i < $max; $i++ ) {
if( $arrBuf[$i] ) {
$strUsbdevices .= " <Device><Name>" . htmlspecialchars( chop( $arrBuf[$i] ), ENT_QUOTES ) . "</Name></Device>\n";
}
}
}
$_text = " <Hardware>\n";
$_text .= " <CPU>\n";
if( isset( $arrSys['cpus'] ) ) {
$_text .= " <Number>" . htmlspecialchars( $arrSys['cpus'], ENT_QUOTES ) . "</Number>\n";
}
if( isset( $arrSys['model'] ) ) {
$_text .= " <Model>" . htmlspecialchars( $arrSys['model'], ENT_QUOTES ) . "</Model>\n";
}
if( isset( $arrSys['temp'] ) ) {
$_text .= " <Cputemp>" . htmlspecialchars( $arrSys['temp'], ENT_QUOTES ) . "</Cputemp>\n";
}
if( isset( $arrSys['cpuspeed'] ) ) {
$_text .= " <Cpuspeed>" . htmlspecialchars( $arrSys['cpuspeed'], ENT_QUOTES ) . "</Cpuspeed>\n";
}
if( isset( $arrSys['busspeed'] ) ) {
$_text .= " <Busspeed>" . htmlspecialchars( $arrSys['busspeed'], ENT_QUOTES ) . "</Busspeed>\n";
}
if( isset( $arrSys['cache'] ) ) {
$_text .= " <Cache>" . htmlspecialchars( $arrSys['cache'], ENT_QUOTES ) . "</Cache>\n";
}
if( isset( $arrSys['bogomips'] ) ) {
$_text .= " <Bogomips>" . htmlspecialchars( $arrSys['bogomips'], ENT_QUOTES ) . "</Bogomips>\n";
}
$_text .= " </CPU>\n";
$_text .= " <PCI>\n";
if( $strPcidevices) {
$_text .= $strPcidevices;
}
$_text .= " </PCI>\n";
$_text .= " <IDE>\n";
if( $strIdedevices) {
$_text .= $strIdedevices;
}
$_text .= " </IDE>\n";
$_text .= " <SCSI>\n";
if( $strScsidevices) {
$_text .= $strScsidevices;
}
$_text .= " </SCSI>\n";
$_text .= " <USB>\n";
if($strUsbdevices) {
$_text .= $strUsbdevices;
}
$_text .= " </USB>\n";
$_text .= " </Hardware>\n";
 
return $_text;
}
 
function html_hardware () {
global $XPath;
global $text;
$strPcidevices = ""; $strIdedevices = ""; $strUsbdevices = ""; $strScsidevices = "";
$textdir = direction();
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/Hardware/PCI" ) ); $i < $max; $i++ ) {
if( $XPath->match( "/phpsysinfo/Hardware/PCI/Device[" . $i . "]/Name" ) ) {
$strPcidevices .= "<tr><td valign=\"top\"><font size=\"-1\">-</font></td><td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Hardware/PCI/Device[" . $i . "]/Name" ) . "</font></td></tr>";
}
}
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/Hardware/IDE" ) ); $i < $max; $i++ ) {
if( $XPath->match( "/phpsysinfo/Hardware/IDE/Device[" . $i . "]" ) ) {
$strIdedevices .= "<tr><td valign=\"top\"><font size=\"-1\">-</font></td><td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Hardware/IDE/Device[" . $i . "]/Name" );
if( $XPath->match( "/phpsysinfo/Hardware/IDE/Device[" . $i . "]/Capacity" ) ) {
$strIdedevices .= " (" . $text['capacity'] . ": " . format_bytesize( $XPath->getData( "/phpsysinfo/Hardware/IDE/Device[" . $i . "]/Capacity" ) / 2 ) . ")";
}
$strIdedevices .= "</font></td></tr>";
}
}
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/Hardware/SCSI" ) ); $i < $max; $i++ ) {
if( $XPath->match( "/phpsysinfo/Hardware/SCSI/Device[" . $i . "]" ) ) {
$strScsidevices .= "<tr><td valign=\"top\"><font size=\"-1\">-</font></td><td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Hardware/SCSI/Device[" . $i . "]/Name" );
if( $XPath->match( "/phpsysinfo/Hardware/SCSI/Device[" . $i . "]/Capacity" ) ) {
$strScsidevices .= " (" . $text['capacity'] . ": " . format_bytesize( $XPath->getData( "/phpsysinfo/Hardware/SCSI/Device[" . $i . "]/Capacity" ) / 2 ) . ")";
}
$strScsidevices .= "</font></td></tr>";
}
}
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/Hardware/USB" ) ); $i < $max; $i++ ) {
if( $XPath->match( "/phpsysinfo/Hardware/USB/Device[" . $i . "]/Name" )) {
$strUsbdevices .= "<tr><td valign=\"top\"><font size=\"-1\">-</font></td><td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Hardware/USB/Device[" . $i . "]/Name" ) . "</font></td></tr>";
}
}
$_text = "<table border=\"0\" width=\"100%\" align=\"center\">\n";
if( $XPath->match( "/phpsysinfo/Hardware/CPU/Number" ) ) {
$_text .= " <tr>\n <td valign=\"top\"><font size=\"-1\">" . $text['numcpu'] . "</font></td>\n <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Hardware/CPU/Number" ) . "</font></td>\n </tr>\n";
}
if( $XPath->match( "/phpsysinfo/Hardware/CPU/Model" ) ) {
$_text .= " <tr>\n <td valign=\"top\"><font size=\"-1\">" . $text['cpumodel'] . "</font></td>\n <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Hardware/CPU/Model" );
if( $XPath->match( "/phpsysinfo/Hardware/CPU/Cputemp" ) ) {
$_text .= "&nbsp;@&nbsp;" . temperature( $XPath->getData( "/phpsysinfo/Hardware/CPU/Cputemp" ) );
}
$_text .= "</font></td>\n </tr>\n";
}
if( $XPath->match( "/phpsysinfo/Hardware/CPU/Cpuspeed" ) ) {
$_text .= " <tr>\n <td valign=\"top\"><font size=\"-1\">" . $text['cpuspeed'] . "</font></td>\n <td><font size=\"-1\">" . format_speed( $XPath->getData( "/phpsysinfo/Hardware/CPU/Cpuspeed" ) ) . "</font></td>\n </tr>\n";
}
if( $XPath->match( "/phpsysinfo/Hardware/CPU/Busspeed" ) ) {
$_text .= " <tr>\n <td valign=\"top\"><font size=\"-1\">" . $text['busspeed'] . "</font></td>\n <td><font size=\"-1\">" . format_speed( $XPath->getData( "/phpsysinfo/Hardware/CPU/Busspeed" ) ) . "</font></td>\n </tr>\n";
}
if( $XPath->match("/phpsysinfo/Hardware/CPU/Cache" ) ) {
$_text .= " <tr>\n <td valign=\"top\"><font size=\"-1\">" . $text['cache'] . "</font></td>\n <td><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Hardware/CPU/Cache" ) ) . "</font></td>\n </tr>\n";
}
if( $XPath->match( "/phpsysinfo/Hardware/CPU/Bogomips" ) ) {
$_text .= " <tr>\n <td valign=\"top\"><font size=\"-1\">" . $text['bogomips'] . "</font></td>\n <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Hardware/CPU/Bogomips" ) . "</font></td>\n </tr>\n";
}
$_text .= " <tr>\n <td valign=\"top\"><font size=\"-1\">" . $text['pci'] . "</font></td>\n <td>";
if( $strPcidevices) {
$_text .= "<table>" . $strPcidevices . "</table>";
} else {
$_text .= "<font size=\"-1\"><i>" . $text['none'] . "</i></font>";
}
$_text .= "</td>\n </tr>\n";
$_text .= " <tr>\n <td valign=\"top\"><font size=\"-1\">" . $text['ide'] . "</font></td>\n <td>";
if( $strIdedevices ) {
$_text .= "<table>" . $strIdedevices . "</table>";
} else {
$_text .= "<font size=\"-1\"><i>" . $text['none'] . "</i></font>";
}
$_text .= "</td>\n </tr>\n";
$_text .= " <tr>\n <td valign=\"top\"><font size=\"-1\">" . $text['scsi'] . "</font></td>\n <td>";
if( $strScsidevices ) {
$_text .= "<table>" . $strScsidevices . "</table></td>\n </tr>";
} else {
$_text .= "<font size=\"-1\"><i>" . $text['none'] . "</i></font>";
}
$_text .= " <tr>\n <td valign=\"top\"><font size=\"-1\">" . $text['usb'] . "</font></td>\n <td>";
if( $strUsbdevices) {
$_text .= "<table>" . $strUsbdevices . "</table></td>\n </tr>";
} else {
$_text .= "<font size=\"-1\"><i>" . $text['none'] . "</i></font>";
}
$_text .= "</table>";
return $_text;
}
?>
/web/acc/phpsysinfo/includes/xml/index.html
--- hddtemp.php (nonexistent)
+++ hddtemp.php (revision 2769)
@@ -0,0 +1,90 @@
+<?php
+/***************************************************************************
+ * Copyright (C) 2006 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: hddtemp.php,v 1.13 2007/02/08 20:16:25 bigmichi1 Exp $
+
+function xml_hddtemp() {
+ global $hddtemp_avail, $hddtemp;
+ $arrBuf = $hddtemp->temperature( $hddtemp_avail );
+
+ $_text = " <HDDTemp>\n";
+ for( $i = 0, $max = sizeof( $arrBuf ); $i < $max; $i++ ) {
+ $_text .= " <Item>\n";
+ $_text .= " <Label>" . htmlspecialchars( $arrBuf[$i]['label'], ENT_QUOTES ) . "</Label>\n";
+ $_text .= " <Value>" . htmlspecialchars( $arrBuf[$i]['value'], ENT_QUOTES ) . "</Value>\n";
+ $_text .= " <Model>" . htmlspecialchars( $arrBuf[$i]['model'], ENT_QUOTES ) . "</Model>\n";
+ $_text .= " </Item>\n";
+ }
+ $_text .= " </HDDTemp>\n";
+
+ return $_text;
+}
+
+function html_hddtemp() {
+ global $XPath;
+ global $text;
+ global $sensor_program;
+
+ $textdir = direction();
+ $scale_factor = 2;
+ $_text = "";
+ $maxvalue = "+60";
+
+ if( $XPath->match( "/phpsysinfo/HDDTemp" ) ) {
+ for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/HDDTemp" ) ); $i < $max; $i++ ) {
+ if( $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Value" ) != 0 ) {
+ $_text .= " <tr>\n";
+ $_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">". $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Model" ) . "</font></td>\n";
+ $_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\" nowrap><font size=\"-1\">";
+ $_text .= create_bargraph( $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Value" ), $maxvalue, $scale_factor );
+ $_text .= temperature( $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Value" ) ) . "</font></td>\n";
+ $_text .= " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . temperature( $maxvalue ) . "</font></td></tr>\n";
+ }
+ }
+ }
+ if( strlen( $_text ) > 0 && empty( $sensor_program ) ) {
+ $_text = " <tr>\n"
+ . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n"
+ . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n"
+ . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_limit'] . "</b></font></td>\n"
+ . " </tr>" . $_text;
+ }
+
+ return $_text;
+}
+
+function wml_hddtemp() {
+ global $XPath;
+ global $text;
+
+ $_text = "";
+
+ if( $XPath->match( "/phpsysinfo/HDDTemp" ) ) {
+ for( $i = 1; $i < sizeof( $XPath->getDataParts( "/phpsysinfo/HDDTemp" ) ); $i++ ) {
+ if( $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Value") != 0 ) {
+ $_text .= "<p>" . $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Model" ) . ": " . str_replace( "&deg;", "", temperature( $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Value" ) ) ) . "</p>\n";
+ }
+ }
+ }
+
+ return $_text;
+}
+?>
/web/acc/phpsysinfo/includes/xml/filesystems.php
0,0 → 1,164
<?php
/***************************************************************************
* Copyright (C) 2006 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: filesystems.php,v 1.31 2007/02/08 20:16:25 bigmichi1 Exp $
 
//
// xml_filesystems()
//
function xml_filesystems () {
global $sysinfo;
global $show_mount_point;
$arrFs = $sysinfo->filesystems();
$_text = " <FileSystem>\n";
for ( $i = 0, $max = sizeof( $arrFs ); $i < $max; $i++ ) {
$_text .= " <Mount>\n";
$_text .= " <MountPointID>" . htmlspecialchars( $i, ENT_QUOTES ) . "</MountPointID>\n";
if( $show_mount_point ) {
$_text .= " <MountPoint>" . htmlspecialchars( $arrFs[$i]['mount'], ENT_QUOTES ) . "</MountPoint>\n";
}
$_text .= " <Type>" . htmlspecialchars( $arrFs[$i]['fstype'], ENT_QUOTES ) . "</Type>\n"
. " <Device><Name>" . htmlspecialchars( $arrFs[$i]['disk'], ENT_QUOTES ) . "</Name></Device>\n"
. " <Percent>" . htmlspecialchars( $arrFs[$i]['percent'], ENT_QUOTES ) . "</Percent>\n"
. " <Free>" . htmlspecialchars( $arrFs[$i]['free'], ENT_QUOTES ) . "</Free>\n"
. " <Used>" . htmlspecialchars( $arrFs[$i]['used'], ENT_QUOTES ) . "</Used>\n"
. " <Size>" . htmlspecialchars( $arrFs[$i]['size'], ENT_QUOTES ) . "</Size>\n";
if( isset( $arrFs[$i]['options'] ) ) {
$_text .= " <Options>" . htmlspecialchars( $arrFs[$i]['options'], ENT_QUOTES ) . "</Options>\n";
}
if( isset( $arrFs[$i]['inodes'] ) ) {
$_text .= " <Inodes>" . htmlspecialchars( $arrFs[$i]['inodes'], ENT_QUOTES ) . "</Inodes>\n";
}
$_text .= " </Mount>\n";
}
$_text .= " </FileSystem>\n";
return $_text;
}
 
//
// html_filesystems()
//
function html_filesystems () {
global $XPath;
global $text;
global $show_mount_point;
$textdir = direction();
$arrSum = array("size" => 0, "used" => 0, "free" => 0);
$arrCounteddevlist = array();
$intScalefactor = 2;
$_text = "<table border=\"0\" width=\"100%\" align=\"center\">\n";
$_text .= " <tr>\n";
if ($show_mount_point) {
$_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['mount'] . "</b></font></td>\n";
}
$_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['type'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['partition'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['percent'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['free'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['used'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['size'] . "</b></font></td>\n </tr>\n";
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/FileSystem" ) ); $i < $max; $i++ ) {
if( $XPath->match( "/phpsysinfo/FileSystem/Mount[" . $i . "]/MountPointID" ) ) {
if( ! $XPath->match( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Options" ) || ! stristr( $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Options" ), "bind" ) ) {
if( ! in_array( $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Device/Name" ), $arrCounteddevlist ) ) {
$arrSum['size'] += $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Size" );
$arrSum['used'] += $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Used" );
$arrSum['free'] += $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Free" );
if( PHP_OS != "WINNT" ) {
$arrCounteddevlist[] = $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Device/Name" );
}
}
}
$_text .= " <tr>\n";
if( $show_mount_point ) {
$_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/MountPoint" ) . "</font></td>\n";
}
$_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Type" ) . "</font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Device/Name" ) . "</font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">"
. create_bargraph( $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Used" ), $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Size" ), $intScalefactor, $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Type" ) )
. "&nbsp;" . $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Percent" ) . "%";
if( $XPath->match( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Inodes" ) ) {
$_text .= " (" . $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Inodes" ) . "%)";
}
$_text .= "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Free" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Used" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Size" ) ) . "</font></td>\n"
. " </tr>\n";
}
}
$_text .= " <tr>\n";
if( $show_mount_point ) {
$_text .= " <td colspan=\"3\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><i>" . $text['totals'] . " :&nbsp;&nbsp;</i></font></td>\n";
} else {
$_text .= " <td colspan=\"2\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><i>" . $text['totals'] . " :&nbsp;&nbsp;</i></font></td>\n";
}
$_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">"
. create_bargraph( $arrSum['used'], $arrSum['size'], $intScalefactor )
. "&nbsp;";
if( $arrSum['size'] == 0 ) {
$_text .= "0";
} else {
$_text .= round( 100 / $arrSum['size'] * $arrSum['used'] );
}
$_text .= "%" . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $arrSum['free'] ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $arrSum['used'] ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $arrSum['size'] ) . "</font></td>\n </tr>\n"
. "</table>\n";
return $_text;
}
 
function wml_filesystem() {
global $XPath;
global $text;
global $show_mount_point;
$_text = "<card id=\"filesystem\" title=\"" . $text['fs'] . "\">\n";
for( $i = 1; $i < sizeof( $XPath->getDataParts( "/phpsysinfo/FileSystem" ) ); $i++ ) {
if( $XPath->match( "/phpsysinfo/FileSystem/Mount[" . $i . "]/MountPointID" ) ) {
$_text .= "<p>";
if( $show_mount_point ) {
$_text .= $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/MountPoint" ) . "<br/>\n";
} else {
$_text .= $XPath->getData( "/phpsysinfo/FileSystem/Mount[" . $i . "]/Device/Name" ) . "<br/>\n";
}
$_text .= "- " . $text['free'] . ": " . format_bytesize( $XPath->getData("/phpsysinfo/FileSystem/Mount[" . $i . "]/Free" ) ) . "<br/>\n"
. "- " . $text['used'] . ": " . format_bytesize( $XPath->getData("/phpsysinfo/FileSystem/Mount[" . $i . "]/Used" ) ) . "<br/>\n"
. "- " . $text['size'] . ": " . format_bytesize( $XPath->getData("/phpsysinfo/FileSystem/Mount[" . $i . "]/Size" ) ) . "<br/>\n"
. "</p>\n";
}
}
$_text .= "</card>\n";
 
return $_text;
}
?>
/web/acc/phpsysinfo/includes/xml/memory.php
0,0 → 1,211
<?php
/***************************************************************************
* Copyright (C) 2006 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: memory.php,v 1.18 2007/02/08 20:16:25 bigmichi1 Exp $
 
//
// xml_memory()
//
function xml_memory () {
global $sysinfo;
$arrMem = $sysinfo->memory();
$i = 0;
$_text = " <Memory>\n"
. " <Free>" . htmlspecialchars( $arrMem['ram']['free'], ENT_QUOTES ) . "</Free>\n"
. " <Used>" . htmlspecialchars( $arrMem['ram']['used'], ENT_QUOTES ) . "</Used>\n"
. " <Total>" . htmlspecialchars( $arrMem['ram']['total'], ENT_QUOTES ) . "</Total>\n"
. " <Percent>" . htmlspecialchars( $arrMem['ram']['percent'], ENT_QUOTES ) . "</Percent>\n";
if( isset( $arrMem['ram']['app_percent'] ) ) {
$_text .= " <App>" . htmlspecialchars( $arrMem['ram']['app'], ENT_QUOTES ) . "</App>\n <AppPercent>" . htmlspecialchars( $arrMem['ram']['app_percent'], ENT_QUOTES ) . "</AppPercent>\n";
}
if( isset( $arrMem['ram']['buffers_percent'] ) ) {
$_text .= " <Buffers>" . htmlspecialchars( $arrMem['ram']['buffers'], ENT_QUOTES ) . "</Buffers>\n <BuffersPercent>" . htmlspecialchars( $arrMem['ram']['buffers_percent'], ENT_QUOTES ) . "</BuffersPercent>\n";
}
if( isset( $arrMem['ram']['cached_percent'] ) ) {
$_text .= " <Cached>" . htmlspecialchars( $arrMem['ram']['cached'], ENT_QUOTES ) . "</Cached>\n <CachedPercent>" . htmlspecialchars( $arrMem['ram']['cached_percent'], ENT_QUOTES ) . "</CachedPercent>\n";
}
$_text .= " </Memory>\n";
$_text .= " <Swap>\n";
if( isset( $arrMem['swap']['total'] ) && $arrMem['swap']['total'] > 0 ) {
$_text .= " <Free>" . htmlspecialchars( $arrMem['swap']['free'], ENT_QUOTES ) . "</Free>\n"
. " <Used>" . htmlspecialchars( $arrMem['swap']['used'], ENT_QUOTES ) . "</Used>\n"
. " <Total>" . htmlspecialchars( $arrMem['swap']['total'], ENT_QUOTES ) . "</Total>\n"
. " <Percent>" . htmlspecialchars( $arrMem['swap']['percent'], ENT_QUOTES ) . "</Percent>\n";
}
$_text .= " </Swap>\n";
$_text .= " <Swapdevices>\n";
foreach( $arrMem['devswap'] as $arrDevice) {
$_text .=" <Mount>\n"
. " <MountPointID>" . htmlspecialchars( $i++, ENT_QUOTES ) . "</MountPointID>\n"
. " <Type>Swap</Type>"
. " <Device><Name>" . htmlspecialchars( $arrDevice['dev'], ENT_QUOTES ) . "</Name></Device>\n"
. " <Percent>" . htmlspecialchars( $arrDevice['percent'], ENT_QUOTES ) . "</Percent>\n"
. " <Free>" . htmlspecialchars( $arrDevice['free'], ENT_QUOTES ) . "</Free>\n"
. " <Used>" . htmlspecialchars( $arrDevice['used'], ENT_QUOTES ) . "</Used>\n"
. " <Size>" . htmlspecialchars( $arrDevice['total'], ENT_QUOTES ) . "</Size>\n"
. " </Mount>\n";
}
$_text .= " </Swapdevices>\n";
return $_text;
}
 
//
// html_memory()
//
function html_memory () {
global $XPath;
global $text;
$textdir = direction();
$scale_factor = 2;
$strRam = create_bargraph( $XPath->getData( "/phpsysinfo/Memory/Used" ), $XPath->getData( "/phpsysinfo/Memory/Total" ), $scale_factor );
$strRam .= "&nbsp;&nbsp;" . $XPath->getData( "/phpsysinfo/Memory/Percent" ) . "% ";
if( $XPath->match( "/phpsysinfo/Swap/Total" ) ) {
$strSwap = create_bargraph( $XPath->getData( "/phpsysinfo/Swap/Used" ), $XPath->getData( "/phpsysinfo/Swap/Total" ), $scale_factor );
$strSwap .= "&nbsp;&nbsp;" . $XPath->getData( "/phpsysinfo/Swap/Percent" ) . "% ";
}
if( $XPath->match( "/phpsysinfo/Memory/AppPercent" ) ) {
$strApp = create_bargraph( $XPath->getData( "/phpsysinfo/Memory/App" ), $XPath->getData( "/phpsysinfo/Memory/Total" ), $scale_factor );
$strApp .= "&nbsp;&nbsp;" . $XPath->getData( "/phpsysinfo/Memory/AppPercent" ) . "% ";
}
if( $XPath->match( "/phpsysinfo/Memory/BuffersPercent" ) ) {
$strBuffers = create_bargraph( $XPath->getData( "/phpsysinfo/Memory/Buffers" ), $XPath->getData( "/phpsysinfo/Memory/Total" ), $scale_factor);
$strBuffers .= "&nbsp;&nbsp;" . $XPath->getData( "/phpsysinfo/Memory/BuffersPercent" ) . "% ";
}
if( $XPath->match( "/phpsysinfo/Memory/CachedPercent" ) ) {
$strCached = create_bargraph( $XPath->getData( "/phpsysinfo/Memory/Cached" ), $XPath->getData( "/phpsysinfo/Memory/Total" ), $scale_factor);
$strCached .= "&nbsp;&nbsp;" . $XPath->getData( "/phpsysinfo/Memory/CachedPercent" ) . "% ";
}
$_text = "<table border=\"0\" width=\"100%\" align=\"center\">\n"
. " <tr>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['type'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['percent'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['free'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['used'] . "</b></font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['size'] . "</b></font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $text['phymem'] . "</font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $strRam . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/Free" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/Used" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/Total" ) ) . "</font></td>\n"
. " </tr>\n";
if( isset( $strApp ) ) {
$_text .= " <tr>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">- " . $text['app'] . "</font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $strApp . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/App" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n"
. " </tr>\n";
}
if( isset( $strBuffers ) ) {
$_text .= " <tr>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">- " . $text['buffers'] . "</font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $strBuffers . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/Buffers" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n"
. " </tr>\n";
}
if( isset( $strCached ) ) {
$_text .= " <tr>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">- " . $text['cached'] . "</font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $strCached . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/Cached" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n"
. " </tr>\n";
}
if( isset( $strSwap ) ) {
$_text .= " <tr>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $text['swap'] . "</font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $strSwap . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Swap/Free" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Swap/Used" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData( "/phpsysinfo/Swap/Total" ) ) . "</font></td>\n"
. " </tr>\n";
}
if( ($max = sizeof( $XPath->getDataParts( "/phpsysinfo/Swapdevices" ) ) ) > 2 ) {
for( $i = 1; $i < $max; $i++ ) {
$strSwapdev = create_bargraph( $XPath->getData( "/phpsysinfo/Swapdevices/Mount[" . $i . "]/Used" ), $XPath->getData( "/phpsysinfo/Swapdevices/Mount[" . $i . "]/Size" ), $scale_factor );
$strSwapdev .= "&nbsp;&nbsp;" . $XPath->getData( "/phpsysinfo/Swapdevices/Mount[" . $i . "]/Percent" ) . "% ";
$_text .= " <tr>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"> - " . $XPath->getData( "/phpsysinfo/Swapdevices/Mount[" . $i . "]/Device/Name" ) . "</font></td>\n"
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $strSwapdev . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData("/phpsysinfo/Swapdevices/Mount[" . $i . "]/Free" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData("/phpsysinfo/Swapdevices/Mount[" . $i . "]/Used" ) ) . "</font></td>\n"
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize( $XPath->getData("/phpsysinfo/Swapdevices/Mount[" . $i . "]/Size" ) ) . "</font></td>\n"
. " </tr>\n";
}
}
$_text .= "</table>";
return $_text;
}
 
function wml_memory() {
global $XPath;
global $text;
$_text = "<card id=\"memory\" title=\"" . $text['memusage'] . "\">\n"
. "<p>" . $text['phymem'] . ":<br/>\n"
. "- " . $text['free'] . ": " . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/Free" ) ) . "<br/>\n"
. "- " . $text['used'] . ": " . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/Used" ) ) . "<br/>\n"
. "- " . $text['size'] . ": " . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/Total" ) ) . "</p>\n";
if( $XPath->match( "/phpsysinfo/Memory/App" ) ) {
$_text .= "<p>" . $text['app'] . ":<br/>\n"
. "- " . $text['used'] . ": " . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/App" ) ) . "</p>\n";
}
if( $XPath->match( "/phpsysinfo/Memory/Cached" ) ) {
$_text .= "<p>" . $text['cached'] . ":<br/>\n"
. "- " . $text['used'] . ": " . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/Cached" ) ) . "</p>\n";
}
if( $XPath->match( "/phpsysinfo/Memory/Buffers" ) ) {
$_text .= "<p>" . $text['buffers'] . ":<br/>\n"
. "- " . $text['used'] . ": " . format_bytesize( $XPath->getData( "/phpsysinfo/Memory/Buffers" ) ) . "</p>\n";
}
if( $XPath->match( "/phpsysinfo/Swap/Total" ) ) {
$_text .= "<p>" . $text['swap'] . ":<br/>\n"
. "- " . $text['free'] . ": " . format_bytesize( $XPath->getData( "/phpsysinfo/Swap/Free" ) ) . "<br/>\n"
. "- " . $text['used'] . ": " . format_bytesize( $XPath->getData( "/phpsysinfo/Swap/Used" ) ) . "<br/>\n"
. "- " . $text['size'] . ": " . format_bytesize( $XPath->getData( "/phpsysinfo/Swap/Total" ) ) . "</p>\n";
}
$_text .= "</card>\n";
return $_text;
}
?>