[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 // 3 // phpSysInfo - A PHP System Information Script 4 // http://phpsysinfo.sourceforge.net/ 5 // 6 // This program is free software; you can redistribute it and/or 7 // modify it under the terms of the GNU General Public License 8 // as published by the Free Software Foundation; either version 2 9 // of the License, or (at your option) any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with this program; if not, write to the Free Software 18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 // 20 // $Id: network.php,v 1.13 2005/12/31 17:25:26 bigmichi1 Exp $ 21 22 // 23 // xml_network() 24 // 25 function xml_network () { 26 global $sysinfo; 27 $net = $sysinfo->network(); 28 29 $_text = " <Network>\n"; 30 while (list($dev, $stats) = each($net)) { 31 $_text .= " <NetDevice>\n" 32 . " <Name>" . htmlspecialchars(trim($dev), ENT_QUOTES) . "</Name>\n" 33 . " <RxBytes>" . htmlspecialchars($stats['rx_bytes'], ENT_QUOTES) . "</RxBytes>\n" 34 . " <TxBytes>" . htmlspecialchars($stats['tx_bytes'], ENT_QUOTES) . "</TxBytes>\n" 35 . " <Errors>" . htmlspecialchars($stats['errs'], ENT_QUOTES) . "</Errors>\n" 36 . " <Drops>" . htmlspecialchars($stats['drop'], ENT_QUOTES) . "</Drops>\n" 37 . " </NetDevice>\n"; 38 } 39 $_text .= " </Network>\n"; 40 41 return $_text; 42 } 43 44 // 45 // html_network() 46 // 47 function html_network () { 48 global $XPath; 49 global $text; 50 51 $textdir = direction(); 52 53 $_text = "<table border=\"0\" cellspacing=0 cellpadding=5 width=\"100%\" align=\"center\">\n" 54 . " <tr>\n" 55 . " <td width=40% class=\"colHeader small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['device'] . "</b></font></td>\n" 56 . " <td width=20% class=\"colHeader small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['received'] . "</b></font></td>\n" 57 . " <td width=20% class=\"colHeader small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['sent'] . "</b></font></td>\n" 58 . " <td width=20% class=\"colHeader small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['errors'] . "</b></font></td>\n" 59 . " </tr>\n"; 60 61 for ($i=1, $max = sizeof($XPath->getDataParts("/phpsysinfo/Network")); $i < $max; $i++) { 62 if ($XPath->match("/phpsysinfo/Network/NetDevice[$i]/Name")) { 63 $_text .= " <tr>\n"; 64 $_text .= " <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Network/NetDevice[$i]/Name") . "</font></td>\n"; 65 $_text .= " <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Network/NetDevice[$i]/RxBytes") / 1024) . "</font></td>\n"; 66 $_text .= " <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Network/NetDevice[$i]/TxBytes") / 1024) . "</font></td>\n"; 67 $_text .= " <td class=\"listTableRow small\" 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"; 68 $_text .= " </tr>\n"; 69 } 70 } 71 $_text .= "</table>"; 72 73 return $_text; 74 } 75 76 function wml_network() { 77 global $XPath; 78 global $text; 79 80 $_text = "<card id=\"network\" title=\"" . $text['network'] . "\">\n"; 81 for ($i=1, $max = sizeof($XPath->getDataParts("/phpsysinfo/Network")); $i < $max; $i++) { 82 if ($XPath->match("/phpsysinfo/Network/NetDevice[$i]/Name")) { 83 $_text .= "<p>" . $text['device'] . ": " . $XPath->getData("/phpsysinfo/Network/NetDevice[$i]/Name") . "<br/>" 84 . "- U: " . format_bytesize($XPath->getData("/phpsysinfo/Network/NetDevice[$i]/TxBytes") / 1024) . "<br/>" 85 . "- D: " . format_bytesize($XPath->getData("/phpsysinfo/Network/NetDevice[$i]/RxBytes") / 1024) . "<br/>" 86 . "- E: " . $XPath->getData("/phpsysinfo/Network/NetDevice[$i]/Errors") . '/' . $XPath->getData("/phpsysinfo/Network/NetDevice[$i]/Drops") . "</p>\n"; 87 } 88 } 89 $_text .= "</card>\n"; 90 91 return $_text; 92 } 93 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |