[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpsysinfo/includes/xml network.php, 1.2 vitals.php,
From: |
skwashd |
Subject: |
[Phpgroupware-cvs] phpsysinfo/includes/xml network.php, 1.2 vitals.php, 1.2 memory.php, 1.2 filesystems.php, 1.2 mbinfo.php, 1.1 hardware.php, 1.2 index.html, 1.1 |
Date: |
Sat, 19 Nov 2005 06:52:00 +0100 |
Update of phpsysinfo/includes/xml
Added Files:
Branch: MAIN
network.php lines: +73 -0
vitals.php lines: +81 -0
memory.php lines: +86 -0
filesystems.php lines: +127 -0
mbinfo.php
hardware.php lines: +237 -0
index.html
Log Message:
adding missing xml include files
====================================================
Index: network.php
<?php
//
// 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.2 2005/11/19 05:52:47 skwashd Exp $
//
// xml_network()
//
function xml_network () {
global $sysinfo;
$net = $sysinfo->network();
$_text = " <Network>\n";
while (list($dev, $stats) = each($net)) {
$_text .= " <NetDevice>\n"
. " <Name>" . trim($dev) . "</Name>\n"
. " <RxBytes>" . $stats['rx_bytes'] . "</RxBytes>\n"
. " <TxBytes>" . $stats['tx_bytes'] . "</TxBytes>\n"
. " <Errors>" . $stats['errs'] . "</Errors>\n"
. " <Drops>" . $stats['drop'] . "</Drops>\n"
. " </NetDevice>\n";
}
$_text .= " </Network>\n";
return $_text;
}
//
// html_network()
//
function html_network () {
global $XPath;
global $text;
$_text = '<table border="0" width="90%" align="center">'
. '<tr><td align="left" valign="top"><font size="-1"><b>' .
$text['device'] . '</b></font></td>'
. '<td align="right" valign="top"><font size="-1"><b>' .
$text['received'] . '</b></font></td>'
. '<td align="right" valign="top"><font size="-1"><b>' .
$text['sent'] . '</b></font></td>'
. '<td align="right" valign="top"><font size="-1"><b>' .
$text['errors'] . '</b></font></td>';
for ($i=1, $max = sizeof($XPath->getDataParts('/phpsysinfo/Network')); $i <
$max; $i++) {
if ($XPath->match("/phpsysinfo/Network/NetDevice[$i]/Name")) {
$_text .= "\t<tr>\n";
$_text .= "\t\t<td align=\"left\" valign=\"top\"><font
size=\"-1\">" . $XPath->getData("/phpsysinfo/Network/NetDevice[$i]/Name") .
"</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font
size=\"-1\">" .
format_bytesize($XPath->getData("/phpsysinfo/Network/NetDevice[$i]/RxBytes") /
1024) . "</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font
size=\"-1\">" .
format_bytesize($XPath->getData("/phpsysinfo/Network/NetDevice[$i]/TxBytes") /
1024) . "</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font
size=\"-1\">" . $XPath->getData("/phpsysinfo/Network/NetDevice[$i]/Errors") .
'/' . $XPath->getData("/phpsysinfo/Network/NetDevice[$i]/Drops") .
"</font></td>\n";
$_text .= "\t</tr>\n";
}
}
$_text .= '</table>';
return $_text;
}
?>
====================================================
Index: vitals.php
<?php
// 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.2 2005/11/19 05:52:47 skwashd Exp $
// xml_vitals()
function xml_vitals ()
{
global $sysinfo;
$ar_buf = $sysinfo->loadavg();
for ($i = 0; $i < 3; $i++) {
$load_avg .= $ar_buf[$i] . ' ';
}
$_text = " <Vitals>\n"
. " <Hostname>" . $sysinfo->chostname() . "</Hostname>\n"
. " <IPAddr>" . $sysinfo->ip_addr() . "</IPAddr>\n"
. " <Kernel>" . $sysinfo->kernel() . "</Kernel>\n"
. " <Distro>" . $sysinfo->distro() . "</Distro>\n"
. " <Distroicon>" . $sysinfo->distroicon() . "</Distroicon>\n"
. " <Uptime>" . $sysinfo->uptime() . "</Uptime>\n"
. " <Users>" . $sysinfo->users() . "</Users>\n"
. " <LoadAvg>" . trim($load_avg) . "</LoadAvg>\n"
. " </Vitals>\n";
return $_text;
}
// html_vitals()
function html_vitals ()
{
global $XPath;
global $text;
$min = $XPath->getData('/phpsysinfo/Vitals/Uptime') / 60;
$hours = $min / 60;
$days = floor($hours / 24);
$hours = floor($hours - ($days * 24));
$min = floor($min - ($days * 60 * 24) - ($hours * 60));
if ($days != 0) {
$uptime = "$days " . $text['days'] . " ";
}
if ($hours != 0) {
$uptime .= "$hours " . $text['hours'] . " ";
}
$uptime .= "$min " . $text['minutes'];
$_text = '<table border="0" width="90%" align="center">'
. '<tr><td valign="top"><font size="-1">' . $text['hostname'] .
'</font></td><td><font size="-1">' .
$XPath->getData('/phpsysinfo/Vitals/Hostname') . '</font></td></tr>'
. '<tr><td valign="top"><font size="-1">' . $text['ip'] .
'</font></td><td><font size="-1">' .
$XPath->getData('/phpsysinfo/Vitals/IPAddr') . '</font></td></tr>'
. '<tr><td valign="top"><font size="-1">' . $text['kversion'] .
'</font></td><td><font size="-1">' .
$XPath->getData('/phpsysinfo/Vitals/Kernel') . '</font></td></tr>'
. '<tr><td valign="top"><font size="-1">' . $text['dversion'] .
'</font></td><td><img width="16" height="16" alt="" src="images/' .
$XPath->getData('/phpsysinfo/Vitals/Distroicon') . '"> <font size="-1">' .
$XPath->getData('/phpsysinfo/Vitals/Distro') . '</font></td></tr>'
. '<tr><td valign="top"><font size="-1">' . $text['uptime'] .
'</font></td><td><font size="-1">' . $uptime . '</font></td></tr>'
. '<tr><td valign="top"><font size="-1">' . $text['users'] .
'</font></td><td><font size="-1">' .
$XPath->getData('/phpsysinfo/Vitals/Users') . '</font></td></tr>'
. '<tr><td valign="top"><font size="-1">' . $text['loadavg'] .
'</font></td><td><font size="-1">' .
$XPath->getData('/phpsysinfo/Vitals/LoadAvg') . '</font></td></tr>'
. '</table>';
return $_text;
}
?>
====================================================
Index: memory.php
<?php
//
// 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.2 2005/11/19 05:52:47 skwashd Exp $
//
// xml_memory()
//
function xml_memory () {
global $sysinfo;
$mem = $sysinfo->memory();
$_text = " <Memory>\n"
. " <Free>" . $mem['ram']['t_free'] . "</Free>\n"
. " <Used>" . $mem['ram']['t_used'] . "</Used>\n"
. " <Total>" . $mem['ram']['total'] . "</Total>\n"
. " <Percent>" . $mem['ram']['percent'] . "</Percent>\n"
. " </Memory>\n"
. " <Swap>\n"
. " <Free>" . $mem['swap']['free'] . "</Free>\n"
. " <Used>" . $mem['swap']['used'] . "</Used>\n"
. " <Total>" . $mem['swap']['total'] . "</Total>\n"
. " <Percent>" . $mem['swap']['percent'] . "</Percent>\n"
. " </Swap>\n";
return $_text;
}
//
// xml_memory()
//
function html_memory () {
global $XPath;
global $text;
$scale_factor = 2;
$ram .= create_bargraph($XPath->getData('/phpsysinfo/Memory/Percent'),
$XPath->getData('/phpsysinfo/Memory/Percent'), $scale_factor);
$ram .= ' ' . $XPath->getData('/phpsysinfo/Memory/Percent') . '%
';
$swap .= create_bargraph($XPath->getData('/phpsysinfo/Swap/Percent'),
$XPath->getData('/phpsysinfo/Swap/Percent'), $scale_factor);
$swap .= ' ' . $XPath->getData('/phpsysinfo/Swap/Percent') . '%
';
$_text = '<table border="0" width="90%" align="center">'
. '<tr><td align="left" valign="top"><font size="-1"><b>' .
$text['type'] . '</b></font></td>'
. '<td align="left" valign="top"><font size="-1"><b>' .
$text['percent'] . '</b></font></td>'
. '<td align="right" valign="top"><font size="-1"><b>' .
$text['free'] . '</b></font></td>'
. '<td align="right" valign="top"><font size="-1"><b>' .
$text['used'] . '</b></font></td>'
. '<td align="right" valign="top"><font size="-1"><b>' .
$text['size'] . '</b></font></td></tr>'
. '<tr><td align="left" valign="top"><font size="-1">' .
$text['phymem'] . '</font></td>'
. '<td align="left" valign="top"><font size="-1">' . $ram .
'</font></td>'
. '<td align="right" valign="top"><font size="-1">' .
format_bytesize($XPath->getData('/phpsysinfo/Memory/Free')) . '</font></td>'
. '<td align="right" valign="top"><font size="-1">' .
format_bytesize($XPath->getData('/phpsysinfo/Memory/Used')) . '</font></td>'
. '<td align="right" valign="top"><font size="-1">' .
format_bytesize($XPath->getData('/phpsysinfo/Memory/Total')) . '</font></td>'
. '<tr><td align="left" valign="top"><font size="-1">' .
$text['swap'] . '</font></td>'
. '<td align="left" valign="top"><font size="-1">' . $swap .
'</font></td>'
. '<td align="right" valign="top"><font size="-1">' .
format_bytesize($XPath->getData('/phpsysinfo/Swap/Free')) . '</font></td>'
. '<td align="right" valign="top"><font size="-1">' .
format_bytesize($XPath->getData('/phpsysinfo/Swap/Used')) . '</font></td>'
. '<td align="right" valign="top"><font size="-1">' .
format_bytesize($XPath->getData('/phpsysinfo/Swap/Total')) . '</font></td>'
. '</table>';
return $_text;
}
?>
====================================================
Index: filesystems.php
<?php
//
// 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.2 2005/11/19 05:52:47 skwashd Exp $
//
// xml_filesystems()
//
function xml_filesystems () {
global $sysinfo;
global $show_mount_point;
$fs = $sysinfo->filesystems();
$_text = " <FileSystem>\n";
for ($i=0, $max = sizeof($fs); $i < $max; $i++) {
$sum['size'] += $fs[$i]['size'];
$sum['used'] += $fs[$i]['used'];
$sum['free'] += $fs[$i]['free'];
$_text .= " <Mount>\n";
$_text .= " <MountPointID>" . $i . "</MountPointID>\n";
if ($show_mount_point) {
$_text .= " <MountPoint>" . $fs[$i]['mount'] . "</MountPoint>\n";
}
$_text .= " <Type>" . $fs[$i]['fstype'] . "</Type>\n"
. " <Device>" . $fs[$i]['disk'] . "</Device>\n"
. " <Percent>" . $fs[$i]['percent'] . "</Percent>\n"
. " <Free>" . $fs[$i]['free'] . "</Free>\n"
. " <Used>" . $fs[$i]['used'] . "</Used>\n"
. " <Size>" . $fs[$i]['size'] . "</Size>\n"
. " </Mount>\n";
}
$_text .= " </FileSystem>\n";
return $_text;
}
//
// html_filesystems()
//
function html_filesystems () {
global $XPath;
global $text;
global $show_mount_point;
$scale_factor = 2;
$_text = '<table border="0" width="90%" align="center">';
$_text .= '<tr>';
if ($show_mount_point) {
$_text .= '<td align="left" valign="top"><font size="-1"><b>' .
$text['mount'] . '</b></font></td>';
}
$_text .= '<td align="left" valign="top"><font size="-1"><b>' .
$text['type'] . '</b></font></td>'
. '<td align="left" valign="top"><font size="-1"><b>' .
$text['partition'] . '</b></font></td>'
. '<td align="left" valign="top"><font size="-1"><b>' .
$text['percent'] . '</b></font></td>'
. '<td align="right" valign="top"><font size="-1"><b>' .
$text['free'] . '</b></font></td>'
. '<td align="right" valign="top"><font size="-1"><b>' .
$text['used'] . '</b></font></td>'
. '<td align="right" valign="top"><font size="-1"><b>' .
$text['size'] . '</b></font></td></tr>';
for ($i=1, $max = sizeof($XPath->getDataParts('/phpsysinfo/FileSystem'));
$i < $max; $i++) {
if ($XPath->match("/phpsysinfo/FileSystem/Mount[$i]/MountPointID")) {
$sum['size'] +=
$XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Size");
$sum['used'] +=
$XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Used");
$sum['free'] +=
$XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Free");
$_text .= "\t<tr>\n";
if ($show_mount_point) {
$_text .= "\t\t<td align=\"left\" valign=\"top\"><font
size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/MountPoint")
. "</font></td>\n";
}
$_text .= "\t\t<td align=\"left\" valign=\"top\"><font
size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Type") .
"</font></td>\n";
$_text .= "\t\t<td align=\"left\" valign=\"top\"><font
size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Device") .
"</font></td>\n";
$_text .= "\t\t<td align=\"left\" valign=\"top\"><font
size=\"-1\">";
$_text .=
create_bargraph($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Percent"),
$XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Percent"), $scale_factor,
$XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Type"));
$_text .= " " .
$XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Percent") . "</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font
size=\"-1\">" .
format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Free")) .
"</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font
size=\"-1\">" .
format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Used")) .
"</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font
size=\"-1\">" .
format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Size")) .
"</font></td>\n";
$_text .= "\t</tr>\n";
}
}
$_text .= '<tr>';
if ($show_mount_point) {
$_text .= '<td colspan="3" align="right" valign="top"><font
size="-1"><i>' . $text['totals'] . ' : </i></font></td>';
} else {
$_text .= '<td colspan="2" align="right" valign="top"><font
size="-1"><i>' . $text['totals'] . ' : </i></font></td>';
}
$_text .= "\t\t<td align=\"left\" valign=\"top\"><font size=\"-1\">";
$sum_percent = round(($sum['used'] * 100) / $sum['size']);
$_text .= create_bargraph($sum_percent, $sum_percent, $scale_factor);
$_text .= " " . $sum_percent . "%" . "</font></td>\n";
$_text .= '<td align="right" valign="top"><font size="-1">' .
format_bytesize($sum['free']) . '</font></td>'
. '<td align="right" valign="top"><font size="-1">' .
format_bytesize($sum['used']) . '</font></td>'
. '<td align="right" valign="top"><font size="-1">' .
format_bytesize($sum['size']) . '</font></td></tr>'
. '</table>';
return $_text;
}
?>
====================================================
Index: mbinfo.php
<?php
//
// 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.1 2005/11/19 05:52:47 skwashd Exp $
function xml_mbtemp() {
global $text;
global $mbinfo;
$data = $mbinfo->temperature();
$_text = " <MBinfo>\n";
if (sizeof($data) > 0) {
$_text .= " <Temperature>\n";
for ($i=0, $max = sizeof($data); $i < $max; $i++) {
$_text .= " <Item>\n";
$_text .= " <Label>" . $data[$i]['label'] . "</Label>\n";
$_text .= " <Value>" . $data[$i]['value'] . "</Value>\n";
$_text .= " <Limit>" . $data[$i]['limit'] . "</Limit>\n";
$_text .= " </Item>\n";
}
$_text .= " </Temperature>\n";
}
return $_text;
};
function xml_mbfans() {
global $text;
global $mbinfo;
$data = $mbinfo->fans();
if (sizeof($data) > 0) {
$_text = " <Fans>\n";
for ($i=0, $max = sizeof($data); $i < $max; $i++) {
$_text .= " <Item>\n";
$_text .= " <Label>" . $data[$i]['label'] . "</Label>\n";
$_text .= " <Value>" . $data[$i]['value'] . "</Value>\n";
$_text .= " <Min>" . $data[$i]['min'] . "</Min>\n";
$_text .= " <Div>" . $data[$i]['div'] . "</Div>\n";
$_text .= " </Item>\n";
}
$_text .= " </Fans>\n";
}
return $_text;
};
function xml_mbvoltage() {
global $text;
global $mbinfo;
$data = $mbinfo->voltage();
if (sizeof($data) > 0) {
$_text = " <Voltage>\n";
for ($i=0, $max = sizeof($data); $i < $max; $i++) {
$_text .= " <Item>\n";
$_text .= " <Label>" . $data[$i]['label'] . "</Label>\n";
$_text .= " <Value>" . $data[$i]['value'] . "</Value>\n";
$_text .= " <Min>" . $data[$i]['min'] . "</Min>\n";
$_text .= " <Max>" . $data[$i]['max'] . "</Max>\n";
$_text .= " </Item>\n";
}
$_text .= " </Voltage>\n";
}
$_text .= " </MBinfo>\n";
return $_text;
};
function html_mbtemp() {
global $text;
global $mbinfo;
$data=array();
$scale_factor = 4;
$_text = "\n<table width=\"100%\">\n";
$_text .= '<tr><td><font size="-1"><b>'. $text['s_label'] .
'</b></font></td><td><font size="-1"><b>' . $text['s_value'] .
'</b></font></td><td align="right" valign="top"><font size="-1"><b>' .
$text['s_limit'] . '</b></font></td></tr>';
$data = $mbinfo->temperature();
for ($i=0, $max = sizeof($data); $i < $max; $i++) {
$_text .= "\t<tr>\n";
$_text .= "\t\t<td align=\"left\" valign=\"top\"><font size=\"-1\">".
$data[$i]['label'] . "</font></td>\n";
$_text .= "\t\t<td align=\"left\" valign=\"top\"><font size=\"-1\">";
$_text .= create_bargraph($data[$i]['value'], $data[$i]['value'],
$scale_factor);
$_text .= " " . round($data[$i]['value']) . $text['degree_mark'] .
"</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font size=\"-1\">".
$data[$i]['limit'] . " " . $text['degree_mark'] . "</font></td>\n";
};
$_text .= "\n</table>\n";
return $_text;
};
function html_mbfans() {
global $text;
global $mbinfo;
$_text ="\n<table width=\"100%\">\n";
$_text .= '<tr><td><font size="-1"><b>' . $text['s_label'] .
'</b></font></td><td align="right"><font size="-1"><b>' . $text['s_value'] .
'</b></font></td><td align="right"><font size="-1"><b>' . $text['s_min'] .
'</b></font></td><td align="right"><font size="-1"><b>' . $text['s_div'] .
'</b></font></td></tr>';
$data = $mbinfo->fans();
$show_fans = FALSE;
for ($i=0, $max = sizeof($data); $i < $max; $i++) {
$_text .= "\t<tr>\n";
$_text .= "\t\t<td align=\"left\" valign=\"top\"><font size=\"-1\">".
$data[$i]['label'] . "</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font size=\"-1\">".
round($data[$i]['value']) . " " . $text['rpm_mark'] . "</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font size=\"-1\">".
$data[$i]['min'] . " " . $text['rpm_mark'] . "</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font size=\"-1\">
" . $data[$i]['div'] . "</font></td>\n";
if (round($data[$i]['value']) > 0) {
$show_fans = TRUE;
}
};
$_text .= "\n</table>\n";
if (!$show_fans) {
$_text = '';
}
return $_text;
};
function html_mbvoltage() {
global $text;
global $mbinfo;
$_text = "\n<table width=\"100%\">\n";
$_text .= '<tr><td><font size="-1"><b>' . $text['s_label'] .
'</b></font></td><td align="right"><font size="-1"><b>' . $text['s_value'] .
'</b></font></td><td align="right"><font size="-1"><b>' . $text['s_min'] .
'</b></font></td><td align="right"><font size="-1"><b>' . $text['s_max'] .
'</b></font></td></tr>';
$data = $mbinfo->voltage();
for ($i=0, $max = sizeof($data); $i < $max; $i++) {
$_text .= "\t<tr>\n";
$_text .= "\t\t<td align=\"left\" valign=\"top\"><font
size=\"-1\">". $data[$i]['label'] . "</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font
size=\"-1\">". $data[$i]['value'] . " " . $text['voltage_mark'] .
"</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font
size=\"-1\">". $data[$i]['min'] . " " . $text['voltage_mark'] .
"</font></td>\n";
$_text .= "\t\t<td align=\"right\" valign=\"top\"><font
size=\"-1\">" . $data[$i]['max'] . " " . $text['voltage_mark'] .
"</font></td>\n";
};
$_text .= "\n</table>\n";
return $_text;
};
?>
====================================================
Index: hardware.php
<?php
// 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.2 2005/11/19 05:52:47 skwashd Exp $
function xml_hardware ()
{
global $sysinfo;
global $text;
$sys = $sysinfo->cpu_info();
$ar_buf = $sysinfo->pci();
if (count($ar_buf)) {
for ($i = 0, $max = sizeof($ar_buf); $i < $max; $i++) {
if ($ar_buf[$i]) {
$pci_devices .= " <Device>" . chop($ar_buf[$i]) .
"</Device>\n";
}
}
}
$ar_buf = $sysinfo->ide();
ksort($ar_buf);
if (count($ar_buf)) {
while (list($key, $value) = each($ar_buf)) {
$ide_devices .= " <Device>" . $key . ': ' .
$ar_buf[$key]['model'];
if (isset($ar_buf[$key]['capacity'])) {
$ide_devices .= ' (' . $text['capacity'] . ': ' .
format_bytesize($ar_buf[$key]['capacity'] / 2) . ')';
}
$ide_devices .= "</Device>\n";
}
}
$ar_buf = $sysinfo->scsi();
ksort($ar_buf);
if (count($ar_buf)) {
while (list($key, $value) = each($ar_buf)) {
if ($key >= '0' && $key <= '9') {
$scsi_devices .= " <Device>" . $ar_buf[$key]['model'];
} else {
$scsi_devices .= " <Device>" . $key . ': ' .
$ar_buf[$key]['model'];
}
if (isset($ar_buf[$key]['capacity'])) {
$scsi_devices .= ' (' . $text['capacity'] . ': ' .
format_bytesize($ar_buf[$key]['capacity'] / 2) . ')';
}
$scsi_devices .= "</Device>\n";
}
}
$ar_buf = $sysinfo->usb();
if (count($ar_buf)) {
for ($i = 0, $max = sizeof($ar_buf); $i < $max; $i++) {
if ($ar_buf[$i]) {
$usb_devices .= " <Device>" . chop($ar_buf[$i]) .
"</Device>\n";
}
}
}
$ar_buf = $sysinfo->sbus();
if (count($ar_buf)) {
for ($i = 0, $max = sizeof($ar_buf); $i < $max; $i++) {
if ($ar_buf[$i]) {
$sbus_devices .= " <Device>" . chop($ar_buf[$i]) .
"</Device>\n";
}
}
}
$_text = " <Hardware>\n";
$_text .= " <CPU>\n";
if ($sys['cpus']) {
$_text .= " <Number>" . $sys['cpus'] . "</Number>\n";
}
if ($sys['model']) {
$_text .= " <Model>" . $sys['model'] . "</Model>\n";
}
if ($sys['cpuspeed']) {
$_text .= " <Cpuspeed>" . $sys['cpuspeed'] . "</Cpuspeed>\n";
}
if ($sys['busspeed']) {
$_text .= " <Busspeed>" . $sys['busspeed'] . "</Busspeed>\n";
}
if ($sys['cache']) {
$_text .= " <Cache>" . $sys['cache'] . "</Cache>\n";
}
if ($sys['bogomips']) {
$_text .= " <Bogomips>" . $sys['bogomips'] . "</Bogomips>\n";
}
$_text .= " </CPU>\n";
$_text .= " <PCI>\n";
if ($pci_devices) {
$_text .= $pci_devices;
}
$_text .= " </PCI>\n";
$_text .= " <IDE>\n";
if ($ide_devices) {
$_text .= $ide_devices;
}
$_text .= " </IDE>\n";
$_text .= " <SCSI>\n";
if ($scsi_devices) {
$_text .= $scsi_devices;
}
$_text .= " </SCSI>\n";
$_text .= " <USB>\n";
if ($usb_devices) {
$_text .= $usb_devices;
}
$_text .= " </USB>\n";
$_text .= " <SBUS>\n";
if ($sbus_devices) {
$_text .= $sbus_devices;
}
$_text .= " </SBUS>\n";
$_text .= " </Hardware>\n";
return $_text;
}
function html_hardware ()
{
global $XPath;
global $text;
for ($i = 1, $max =
sizeof($XPath->getDataParts('/phpsysinfo/Hardware/PCI')); $i < $max; $i++) {
if ($XPath->match("/phpsysinfo/Hardware/PCI/Device[$i]")) {
$pci_devices .=
$XPath->getData("/phpsysinfo/Hardware/PCI/Device[$i]") . '<br>';
}
}
for ($i = 1, $max =
sizeof($XPath->getDataParts('/phpsysinfo/Hardware/IDE')); $i < $max; $i++) {
if ($XPath->match("/phpsysinfo/Hardware/IDE/Device[$i]")) {
$ide_devices .=
$XPath->getData("/phpsysinfo/Hardware/IDE/Device[$i]") . '<br>';
}
}
for ($i = 1, $max =
sizeof($XPath->getDataParts('/phpsysinfo/Hardware/SCSI')); $i < $max; $i++) {
if ($XPath->match("/phpsysinfo/Hardware/SCSI/Device[$i]")) {
$scsi_devices .=
$XPath->getData("/phpsysinfo/Hardware/SCSI/Device[$i]") . '<br>';
}
}
for ($i = 1, $max =
sizeof($XPath->getDataParts('/phpsysinfo/Hardware/USB')); $i < $max; $i++) {
if ($XPath->match("/phpsysinfo/Hardware/USB/Device[$i]")) {
$usb_devices .=
$XPath->getData("/phpsysinfo/Hardware/USB/Device[$i]") . '<br>';
}
}
$_text = '<table border="0" width="90%" align="center">';
if ($XPath->match("/phpsysinfo/Hardware/CPU/Number")) {
$_text .= '<tr><td valign="top"><font size="-1">' . $text['numcpu'] .
'</font></td><td><font size="-1">' .
$XPath->getData("/phpsysinfo/Hardware/CPU/Number") . '</font></td></tr>';
}
if ($XPath->match("/phpsysinfo/Hardware/CPU/Model")) {
$_text .= '<tr><td valign="top"><font size="-1">' . $text['cpumodel'] .
'</font></td><td><font size="-1">' .
$XPath->getData("/phpsysinfo/Hardware/CPU/Model") . '</font></td></tr>';
}
if ($XPath->match("/phpsysinfo/Hardware/CPU/Cpuspeed")) {
$tmp_speed = $XPath->getData("/phpsysinfo/Hardware/CPU/Cpuspeed");
if ($tmp_speed < 1000) {
$_text .= '<tr><td valign="top"><font size="-1">' .
$text['cpuspeed'] . '</font></td><td><font size="-1">' . $tmp_speed . '
MHz</font></td></tr>';
} else {
$_text .= '<tr><td valign="top"><font size="-1">' .
$text['cpuspeed'] . '</font></td><td><font size="-1">' . round($tmp_speed /
1000, 2) . ' GHz</font></td></tr>';
}
}
if ($XPath->match("/phpsysinfo/Hardware/CPU/Busspeed")) {
$tmp_speed = $XPath->getData("/phpsysinfo/Hardware/CPU/Busspeed");
if ($tmp_speed < 1000) {
$_text .= '<tr><td valign="top"><font size="-1">' .
$text['busspeed'] . '</font></td><td><font size="-1">' . $tmp_speed . '
MHz</font></td></tr>';
} else {
$_text .= '<tr><td valign="top"><font size="-1">' .
$text['busspeed'] . '</font></td><td><font size="-1">' . round($tmp_speed /
1000, 2) . ' GHz</font></td></tr>';
}
}
if ($XPath->match("/phpsysinfo/Hardware/CPU/Cache")) {
$_text .= '<tr><td valign="top"><font size="-1">' . $text['cache'] .
'</font></td><td><font size="-1">' .
$XPath->getData("/phpsysinfo/Hardware/CPU/Cache") . '</font></td></tr>';
}
if ($XPath->match("/phpsysinfo/Hardware/CPU/Bogomips")) {
$_text .= '<tr><td valign="top"><font size="-1">' . $text['bogomips'] .
'</font></td><td><font size="-1">' .
$XPath->getData("/phpsysinfo/Hardware/CPU/Bogomips") . '</font></td></tr>';
}
$_text .= '<tr><td valign="top"><font size="-1">' . $text['pci'] .
'</font></td><td><font size="-1">';
if ($pci_devices) {
$_text .= $pci_devices;
} else {
$_text .= '<i>' . $text['none'] . '</i>';
}
$_text .= '</font></td></tr>';
$_text .= '<tr><td valign="top"><font size="-1">' . $text['ide'] .
'</font></td><td><font size="-1">';
if ($ide_devices) {
$_text .= $ide_devices;
} else {
$_text .= '<i>' . $text['none'] . '</i>';
}
$_text .= '</font></td></tr>';
if ($scsi_devices) {
$_text .= '<tr><td valign="top"><font size="-1">' . $text['scsi'] .
'</font></td><td><font size="-1">' . $scsi_devices . '</font></td></tr>';
}
if ($usb_devices) {
$_text .= '<tr><td valign="top"><font size="-1">' . $text['usb'] .
'</font></td><td><font size="-1">' . $usb_devices . '</font></td></tr>';
}
$_text .= '</table>';
return $_text;
}
?>
====================================================
Index: index.html
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpsysinfo/includes/xml network.php, 1.2 vitals.php, 1.2 memory.php, 1.2 filesystems.php, 1.2 mbinfo.php, 1.1 hardware.php, 1.2 index.html, 1.1,
skwashd <=
- Prev by Date:
[Phpgroupware-cvs] phpsysinfo/doc ChangeLog,1.3
- Next by Date:
[Phpgroupware-cvs] phpsysinfo/includes/lang pt-br.php, 1.1 lv.php, 1.1 ko.php, 1.1 pt.php, 1.1 ru.php, 1.1 sr.php, 1.1 gr.php, 1.1 ar_utf8.php, 1.1 jp.php, 1.1 cn.php, 1.1 bg.php, 1.1 index.html, 1.1 ja.php, 1.1
- Previous by thread:
[Phpgroupware-cvs] phpsysinfo/doc ChangeLog,1.3
- Next by thread:
[Phpgroupware-cvs] phpsysinfo/includes/lang pt-br.php, 1.1 lv.php, 1.1 ko.php, 1.1 pt.php, 1.1 ru.php, 1.1 sr.php, 1.1 gr.php, 1.1 ar_utf8.php, 1.1 jp.php, 1.1 cn.php, 1.1 bg.php, 1.1 index.html, 1.1 ja.php, 1.1
- Index(es):