function html_filesystems() { global $XPath; global $text; $scale_factor = 2; $_text = '<table width="100%" align="center">' . '<tr><td align="left" valign="top"><font size="-1"><b>' . $text['mount'] . '</b></font></td>' . '<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; $i < sizeof($XPath->getDataParts('/phpsysinfo/FileSystem')); $i++) { if ($XPath->match("/phpsysinfo/FileSystem/Mount[{$i}]/MountPoint")) { $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"; $_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><td colspan="3" 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; }
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; }
function wml_network() { global $XPath; global $text; $_text = "<card id=\"network\" title=\"" . $text['network'] . "\">\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/>" . "- U: " . format_bytesize($XPath->getData("/phpsysinfo/Network/NetDevice[{$i}]/TxBytes") / 1024) . "<br/>" . "- D: " . format_bytesize($XPath->getData("/phpsysinfo/Network/NetDevice[{$i}]/RxBytes") / 1024) . "<br/>" . "- E: " . $XPath->getData("/phpsysinfo/Network/NetDevice[{$i}]/Errors") . '/' . $XPath->getData("/phpsysinfo/Network/NetDevice[{$i}]/Drops") . "</p>\n"; } } $_text .= "</card>\n"; return $_text; }
function html_network() { global $XPath; global $text; $_text = '<table width="100%" 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; $i < sizeof($XPath->getDataParts('/phpsysinfo/Network')); $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; }
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['mhz']) { $_text .= " <Mhz>" . $sys['mhz'] . "</Mhz>\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; }
while (list($number, $row) = each($mount_points)) { if (($number + 1) % 2 == 0) { $tpl->assign(array('ITEM_CLASS' => 'content')); } else { $tpl->assign(array('ITEM_CLASS' => 'content2')); } $tpl->assign(array('MOUNT' => $row['mount'], 'TYPE' => $row['fstype'], 'PARTITION' => $row['disk'], 'PERCENT' => $row['percent'], 'FREE' => make_hr($row['free'] * 1014), 'USED' => make_hr($row['used'] * 1024), 'SIZE' => make_hr($row['size'] * 1024))); $tpl->parse('DISK_LIST_ITEM', '.disk_list_item'); } $tpl->parse('DISK_LIST', 'disk_list'); } /* * * static page messages. * */ gen_admin_menu($tpl); gen_mount_point($tpl); $kernel = kernel(); $uptime = uptime(); $load = loadavg(); $cpu = cpu_info(); $mem = memory(); $tpl->assign(array('TR_SYSTEM_INFO_TITLE' => tr('System info'), 'TR_SYSTEM_INFO' => tr('Vital system info'), 'TR_CPU_SYSTEM_INFO' => tr('CPU system Info'), 'TR_CPU_MODEL' => tr('CPU model'), 'TR_CPU_MHZ' => tr('CPU MHz'), 'TR_CPU_CACHE' => tr('CPU cache'), 'TR_CPU_BOGOMIPS' => tr('CPU bogomips'), 'CPU_MODEL' => $cpu['model'], 'CPU_MHZ' => $cpu['mhz'], 'CPU_CACHE' => $cpu['cache'], 'CPU_BOGOMIPS' => $cpu['bogomips'], 'TR_MEMRY_SYSTEM_INFO' => tr('Memory system info'), 'TR_RAM' => tr('RAM'), 'TR_TOTAL' => tr('Total'), 'TR_USED' => tr('Used'), 'TR_FREE' => tr('Free'), 'TR_SWAP' => tr('Swap'), 'TR_UPTIME' => tr('Up time'), 'UPTIME' => $uptime, 'TR_KERNEL' => tr('Kernel'), 'KERNEL' => $kernel, 'TR_LOAD' => tr('Load'), 'LOAD' => $load[0] . ' ' . $load[1] . ' ' . $load[0], 'RAM' => tr('RAM'), 'RAM_TOTAL' => format_bytesize($mem['ram']['total']), 'RAM_USED' => format_bytesize($mem['ram']['used']), 'RAM_FREE' => format_bytesize($mem['ram']['free']), 'SWAP_TOTAL' => format_bytesize($mem['swap']['total']), 'SWAP_USED' => format_bytesize($mem['swap']['used']), 'SWAP_FREE' => format_bytesize($mem['swap']['free']), 'TR_FILE_SYSTEM_INFO' => tr('Filesystem system Info'), 'TR_MOUNT' => tr('Mount'), 'TR_TYPE' => tr('Type'), 'TR_PARTITION' => tr('Partition'), 'TR_PERCENT' => tr('Percent'), 'TR_SIZE' => tr('Size'))); gen_page_message($tpl); $tpl->parse('PAGE', 'page'); $tpl->prnt(); if (isset($cfg['DUMP_GUI_DEBUG'])) { dump_gui_debug(); } unset_messages();
<?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: table_memory.php,v 1.1.1.1 2001/06/17 17:56:53 lkneschke Exp $ $scale_factor = 2; $mem = sys_meminfo(); $ram .= create_bargraph($mem['ram']['percent'], $mem['ram']['percent'], $scale_factor); $ram .= ' ' . $mem['ram']['percent'] . '% '; $swap .= create_bargraph($mem['swap']['percent'], $mem['swap']['percent'], $scale_factor); $swap .= ' ' . $mem['swap']['percent'] . '% '; $_text = '<table width="100%" align="center">' . '<tr><td align="left"><b><font size="-1">' . $text['type'] . '</font></b></td>' . '<td align="left"><b><font size="-1">' . $text['percent'] . '</font></b></td>' . '<td align="right"><b><font size="-1">' . $text['free'] . '</font></b></td>' . '<td align="right"><b><font size="-1">' . $text['used'] . '</font></b></td>' . '<td align="right"><b><font size="-1">' . $text['size'] . '</font></b></td></tr>' . '<tr><td align="left"><font size="-1">' . $text['phymem'] . '</font></td>' . '<td align="left"><font size="-1">' . $ram . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['ram']['t_free']) . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['ram']['t_used']) . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['ram']['total']) . '</font></td>' . '<tr><td align="left"><font size="-1">' . $text['swap'] . '</font></td>' . '<td align="left"><font size="-1">' . $swap . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['swap']['free']) . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['swap']['used']) . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['swap']['total']) . '</font></td>' . '</table>'; $tpl->set_var('memory', makebox($text['memusage'], $_text, '100%'));
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"; } $_text .= "<p><br/>" . $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; }
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>\n"; 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; }
// 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: table_filesystems.php,v 1.1.1.1 2001/06/17 17:56:53 lkneschke Exp $ $scale_factor = 2; $_text = '<table width="100%" align="center">' . '<tr><td align="left">' . $f_body_open . '<b>' . $text['mount'] . '</b>' . $f_body_close . '</td>' . '<td align="left">' . $f_body_open . '<b>' . $text['type'] . '</b>' . $f_body_close . '</td>' . '<td align="left">' . $f_body_open . '<b>' . $text['partition'] . '</b>' . $f_body_close . '</td>' . '<td align="left">' . $f_body_open . '<b>' . $text['percent'] . '</b>' . $f_body_close . '</td>' . '<td align="right">' . $f_body_open . '<b>' . $text['free'] . '</b>' . $f_body_close . '</td>' . '<td align="right">' . $f_body_open . '<b>' . $text['used'] . '</b>' . $f_body_close . '</td>' . '<td align="right">' . $f_body_open . '<b>' . $text['size'] . '</b>' . $f_body_close . '</td></tr>'; $fs = sys_fsinfo(); for ($i = 0; $i < sizeof($fs); $i++) { $sum['size'] += $fs[$i]['size']; $sum['used'] += $fs[$i]['used']; $sum['free'] += $fs[$i]['free']; $_text .= "\t<tr>\n"; $_text .= "\t\t<td align=\"left\">{$f_body_open}" . $fs[$i]['mount'] . "{$f_body_close}</td>\n"; $_text .= "\t\t<td align=\"left\">{$f_body_open}" . $fs[$i]['fstype'] . "{$f_body_close}</td>\n"; $_text .= "\t\t<td align=\"left\">{$f_body_open}" . $fs[$i]['disk'] . "{$f_body_close}</td>\n"; $_text .= "\t\t<td align=\"left\">{$f_body_open}"; $_text .= create_bargraph($fs[$i]['percent'], $fs[$i]['percent'], $scale_factor); $_text .= " " . $fs[$i]['percent'] . "{$f_body_close}</td>\n"; $_text .= "\t\t<td align=\"right\">{$f_body_open}" . format_bytesize($fs[$i]['free']) . "{$f_body_close}</td>\n"; $_text .= "\t\t<td align=\"right\">{$f_body_open}" . format_bytesize($fs[$i]['used']) . "{$f_body_close}</td>\n"; $_text .= "\t\t<td align=\"right\">{$f_body_open}" . format_bytesize($fs[$i]['size']) . "{$f_body_close}</td>\n"; $_text .= "\t</tr>\n"; } $_text .= '<tr><td colspan="3" align="right">' . $f_body_open . '<i>' . $text['totals'] . ' : </i>' . $f_body_close . '</td>'; $_text .= "\t\t<td align=\"left\">{$f_body_open}"; $sum_percent = round($sum['used'] * 100 / $sum['size']); $_text .= create_bargraph($sum_percent, $sum_percent, $scale_factor); $_text .= " " . $sum_percent . "%" . $f_body_close . "</td>\n"; $_text .= '<td align="right">' . $f_body_open . format_bytesize($sum['free']) . $f_body_close . '</td>' . '<td align="right">' . $f_body_open . format_bytesize($sum['used']) . $f_body_close . '</td>' . '<td align="right">' . $f_body_open . format_bytesize($sum['size']) . $f_body_close . '</td></tr>' . '</table>'; $tpl->set_var('filesystems', makebox($text['fs'], $_text, '100%'));
function html_hardware() { global $XPath; global $text; $pci_devices = ""; $ide_devices = ""; $usb_devices = ""; $scsi_devices = ""; $textdir = direction(); for ($i = 1, $max = sizeof($XPath->getDataParts('/phpsysinfo/Hardware/PCI')); $i < $max; $i++) { if ($XPath->match("/phpsysinfo/Hardware/PCI/Device[{$i}]/Name")) { $pci_devices .= "<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}]")) { $ide_devices .= "<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")) { $ide_devices .= " (" . $text['capacity'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/Hardware/IDE/Device[{$i}]/Capacity") / 2) . ")"; } $ide_devices .= "</font></td></tr>"; } } for ($i = 1, $max = sizeof($XPath->getDataParts('/phpsysinfo/Hardware/SCSI')); $i < $max; $i++) { if ($XPath->match("/phpsysinfo/Hardware/SCSI/Device[{$i}]")) { $scsi_devices .= "<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")) { $scsi_devices .= " (" . $text['capacity'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/Hardware/SCSI/Device[{$i}]/Capacity") / 2) . ")"; } $scsi_devices .= "</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")) { $usb_devices .= "<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 cellspacing=0 cellpadding=5 border=\"0\" width=\"100%\" align=\"center\">\n"; if ($XPath->match("/phpsysinfo/Hardware/CPU/Number")) { $_text .= " <tr>\n <td class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['numcpu'] . "</font></td>\n <td class=\"cellText small\"><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 class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['cpumodel'] . "</font></td>\n <td class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Hardware/CPU/Model") . "</font></td>\n </tr>\n"; } if ($XPath->match("/phpsysinfo/Hardware/CPU/Cpuspeed")) { $tmp_speed = $XPath->getData("/phpsysinfo/Hardware/CPU/Cpuspeed"); if ($tmp_speed < 1000) { $_text .= " <tr>\n <td class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['cpuspeed'] . "</font></td>\n <td class=\"cellText small\"><font size=\"-1\">" . $tmp_speed . " MHz</font></td>\n </tr>\n"; } else { $_text .= " <tr>\n <td class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['cpuspeed'] . "</font></td>\n <td class=\"cellText small\"><font size=\"-1\">" . round($tmp_speed / 1000, 2) . " GHz</font></td>\n </tr>\n"; } } if ($XPath->match("/phpsysinfo/Hardware/CPU/Busspeed")) { $tmp_speed = $XPath->getData("/phpsysinfo/Hardware/CPU/Busspeed"); if ($tmp_speed < 1000) { $_text .= " <tr>\n <td class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['busspeed'] . "</font></td>\n <td class=\"cellText small\"><font size=\"-1\">" . $tmp_speed . " MHz</font></td>\n </tr>\n"; } else { $_text .= " <tr>\n <td class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['busspeed'] . "</font></td>\n <td class=\"cellText small\"><font size=\"-1\">" . round($tmp_speed / 1000, 2) . " GHz</font></td>\n </tr>\n"; } } if ($XPath->match("/phpsysinfo/Hardware/CPU/Cache")) { $_text .= " <tr>\n <td class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['cache'] . "</font></td>\n <td class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Hardware/CPU/Cache") . "</font></td>\n </tr>\n"; } if ($XPath->match("/phpsysinfo/Hardware/CPU/Bogomips")) { $_text .= " <tr>\n <td class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['bogomips'] . "</font></td>\n <td class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Hardware/CPU/Bogomips") . "</font></td>\n </tr>\n"; } $_text .= " <tr>\n <td class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['pci'] . "</font></td>\n <td class=\"cellText small\">"; if ($pci_devices) { $_text .= "<table border=0 cellspacing=0 cellpadding=2>" . $pci_devices . "</table>"; } else { $_text .= "<font size=\"-1\"><i>" . $text['none'] . "</i></font>"; } $_text .= "</td>\n </tr>\n"; $_text .= " <tr>\n <td class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['ide'] . "</font></td>\n <td class=\"cellText small\">"; if ($ide_devices) { $_text .= "<table>" . $ide_devices . "</table>"; } else { $_text .= "<font size=\"-1\"><i>" . $text['none'] . "</i></font>"; } $_text .= "</td>\n </tr>\n"; if ($scsi_devices) { $_text .= " <tr>\n <td class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['scsi'] . "</font></td>\n <td class=\"cellText small\"><table>" . $scsi_devices . "</table></td>\n </tr>"; } if ($usb_devices) { $_text .= " <tr>\n <td class=\"cellLabel small\" align=right valign=\"top\"><font size=\"-1\">" . $text['usb'] . "</font></td>\n <td class=\"cellText small\"><table>" . $usb_devices . "</table></td>\n </tr>"; } $_text .= "</table>"; return $_text; }
/** * @brief A page that shows a table with statistic data and a gauge bar * @global type $langQuotaUsed * @global type $langQuotaPercentage * @global type $langQuotaTotal * @global type $langBack * @global type $langQuotaBar * @global type $course_code * @global type $subsystem * @global type $group_id * @global type $ebook_id * @param type $quota * @param type $used * @return string */ function showquota($quota, $used) { global $langQuotaUsed, $langQuotaPercentage, $langQuotaTotal, $langBack, $langQuotaBar, $course_code, $subsystem, $group_id, $ebook_id, $pageName; $retstring = ''; // pososto xrhsimopoioumenou xorou se % $diskUsedPercentage = round($used / $quota * 100) . "%"; // morfopoihsh tou synolikou diathesimou megethous tou quota $quota = format_bytesize($quota / 1024); // morfopoihsh tou synolikou megethous pou xrhsimopoieitai $used = format_bytesize($used / 1024); // telos diamorfwshs ths grafikh mparas kai twn arithmitikwn statistikwn stoixeiwn // ektypwsh pinaka me arithmitika stoixeia + thn grafikh bara if ($subsystem == GROUP) { $link = "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&group_id={$group_id}"; } elseif ($subsystem == EBOOK) { $link = "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&ebook_id={$ebook_id}"; } else { $link = "{$_SERVER['SCRIPT_NAME']}?course={$course_code}"; } $pageName = $langQuotaBar; $retstring .= action_bar(array(array('title' => $langBack, 'url' => $link, 'icon' => 'fa-reply', 'level' => 'primary-label'))); $retstring .= "\n <div class='row'><div class='col-sm-12'>\n <div class='form-wrapper'>\n <form class='form-horizontal' role='form'>\n <div class='form-group'>\n <label class='col-sm-2'>{$langQuotaUsed}:</label>\n <div class='col-sm-10'>\n <p class='form-control-static'>{$used}</p>\n </div>\n </div>\n <div class='form-group'>\n <label class='col-sm-2'>{$langQuotaPercentage}:</label>\n <div class='col-sm-10'>\n <div class='progress'>\n <p class='progress-bar progress-bar-striped active from-control-static' role='progressbar' aria-valuenow='" . str_replace('%', '', $diskUsedPercentage) . "' aria-valuemin='0' aria-valuemax='100' style='width: {$diskUsedPercentage};'>\n {$diskUsedPercentage}\n </p>\n </div>\n </div>\n </div>\n <div class='form-group'>\n <label class='col-sm-2'>{$langQuotaTotal}:</label>\n <div class='col-sm-10'>\n <p class='form-control-static'>{$quota}</p>\n </div>\n </div> \n </form>\n </div></div></div>"; $tmp_cwd = getcwd(); return $retstring; }
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 .= " @ " . 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; }
// // 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: table_network.php,v 1.1.1.1 2001/06/17 17:56:48 lkneschke Exp $ $net = sys_netdevs(); $_text = '<table width="100%" align="center">' . '<tr><td align="left"><b><font size="-1">' . $text['device'] . '</font></b></td>' . '<td align="left"><b><font size="-1">' . $text['received'] . '</font></b></td>' . '<td align="right"><b><font size="-1">' . $text['sent'] . '</font></b></td>' . '<td align="right"><b><font size="-1">' . $text['errors'] . '</font></b></td>'; while (list($dev, $stats) = each($net)) { $_text .= "\t<tr>\n"; $_text .= "\t\t<td align=\"left\">{$f_body_open}" . $dev . "{$f_body_close}</td>\n"; $_text .= "\t\t<td align=\"left\">{$f_body_open}" . format_bytesize($stats['rx_bytes'] / 1024) . "{$f_body_close}</td>\n"; $_text .= "\t\t<td align=\"right\">{$f_body_open}" . format_bytesize($stats['tx_bytes'] / 1024) . "{$f_body_close}</td>\n"; $_text .= "\t\t<td align=\"right\">{$f_body_open}" . $stats['errs'] . '/' . $stats['drop'] . "{$f_body_close}</td>\n"; $_text .= "\t</tr>\n"; } $_text .= '</table>'; $tpl->set_var('network', makebox($text['netusage'], $_text, '100%'));
/** * @brief A page that shows a table with statistic data and a gauge bar * @global type $langQuotaUsed * @global type $langQuotaPercentage * @global type $langQuotaTotal * @global type $langBack * @global type $langQuotaBar * @global type $course_code * @global type $subsystem * @global type $group_id * @global type $ebook_id * @param type $quota * @param type $used * @return string */ function showquota($quota, $used, $backPath = null) { global $langQuotaUsed, $langQuotaPercentage, $langQuotaTotal, $langBack, $langQuotaBar, $course_code, $subsystem, $group_id, $ebook_id, $pageName; $retstring = ''; // pososto xrhsimopoioumenou xorou se % if ($quota == 0) { $diskUsedPercentage = $used > 0 ? '100%' : '0%'; } else { $diskUsedPercentage = round($used / $quota * 100) . '%'; } // morfopoihsh tou synolikou diathesimou megethous tou quota $quota = format_bytesize($quota / 1024); // morfopoihsh tou synolikou megethous pou xrhsimopoieitai $used = format_bytesize($used / 1024); // telos diamorfwshs ths grafikh mparas kai twn arithmitikwn statistikwn stoixeiwn // ektypwsh pinaka me arithmitika stoixeia + thn grafikh bara $pageName = $langQuotaBar; if (!is_null($backPath)) { $retstring .= action_bar(array(array('title' => $langBack, 'url' => $backPath, 'icon' => 'fa-reply', 'level' => 'primary-label'))); } else { $retstring .= action_bar(array(array('title' => $langBack, 'url' => documentBackLink($backPath), 'icon' => 'fa-reply', 'level' => 'primary-label'))); } $retstring .= "\n <div class='row'><div class='col-sm-12'>\n <div class='form-wrapper'>\n <form class='form-horizontal' role='form'>\n <div class='form-group'>\n <label class='col-sm-3 control-label'>{$langQuotaUsed}:</label>\n <div class='col-sm-9'>\n <p class='form-control-static'>{$used}</p>\n </div>\n </div>\n <div class='form-group'>\n <label class='col-sm-3 control-label'>{$langQuotaPercentage}:</label>\n <div class='col-sm-9'>\n <div class='progress'>\n <p class='progress-bar active from-control-static' role='progressbar' aria-valuenow='" . str_replace('%', '', $diskUsedPercentage) . "' aria-valuemin='0' aria-valuemax='100' style='min-width: 2em; width: {$diskUsedPercentage};'>\n {$diskUsedPercentage}\n </p>\n </div>\n </div>\n </div>\n <div class='form-group'>\n <label class='col-sm-3 control-label'>{$langQuotaTotal}:</label>\n <div class='col-sm-9'>\n <p class='form-control-static'>{$quota}</p>\n </div>\n </div> \n </form>\n </div></div></div>"; $tmp_cwd = getcwd(); return $retstring; }