[ Index ] |
|
Code source de eGroupWare 1.2.106-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: filesystems.php 21228 2006-04-06 13:52:08Z ralfbecker $ 21 22 // 23 // xml_filesystems() 24 // 25 function xml_filesystems () { 26 global $sysinfo; 27 global $show_mount_point; 28 29 $fs = $sysinfo->filesystems(); 30 31 $_text = " <FileSystem>\n"; 32 for ($i=0, $max = sizeof($fs); $i < $max; $i++) { 33 $_text .= " <Mount>\n"; 34 $_text .= " <MountPointID>" . htmlspecialchars($i, ENT_QUOTES) . "</MountPointID>\n"; 35 36 if ($show_mount_point) { 37 $_text .= " <MountPoint>" . htmlspecialchars($fs[$i]['mount'], ENT_QUOTES) . "</MountPoint>\n"; 38 } 39 40 $_text .= " <Type>" . htmlspecialchars($fs[$i]['fstype'], ENT_QUOTES) . "</Type>\n" 41 . " <Device><Name>" . htmlspecialchars($fs[$i]['disk'], ENT_QUOTES) . "</Name></Device>\n" 42 . " <Percent>" . htmlspecialchars($fs[$i]['percent'], ENT_QUOTES) . "</Percent>\n" 43 . " <Free>" . htmlspecialchars($fs[$i]['free'], ENT_QUOTES) . "</Free>\n" 44 . " <Used>" . htmlspecialchars($fs[$i]['used'], ENT_QUOTES) . "</Used>\n" 45 . " <Size>" . htmlspecialchars($fs[$i]['size'], ENT_QUOTES) . "</Size>\n"; 46 if (isset($fs[$i]['options'])) 47 $_text .= " <Options>" . htmlspecialchars($fs[$i]['options'], ENT_QUOTES) . "</Options>\n"; 48 $_text .= " </Mount>\n"; 49 } 50 $_text .= " </FileSystem>\n"; 51 return $_text; 52 } 53 54 // 55 // html_filesystems() 56 // 57 function html_filesystems () { 58 global $XPath; 59 global $text; 60 global $show_mount_point; 61 62 $textdir = direction(); 63 64 $sum = array("size" => 0, "used" => 0, "free" => 0); 65 66 $counted_devlist = array(); 67 $scale_factor = 2; 68 69 $_text = "<table border=\"0\" width=\"100%\" align=\"center\">\n"; 70 $_text .= " <tr>\n"; 71 72 if ($show_mount_point) { 73 $_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['mount'] . "</b></font></td>\n"; 74 } 75 76 $_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['type'] . "</b></font></td>\n" 77 . " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['partition'] . "</b></font></td>\n" 78 . " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['percent'] . "</b></font></td>\n" 79 . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['free'] . "</b></font></td>\n" 80 . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['used'] . "</b></font></td>\n" 81 . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['size'] . "</b></font></td>\n </tr>\n"; 82 83 for ($i=1, $max = sizeof($XPath->getDataParts('/phpsysinfo/FileSystem')); $i < $max; $i++) { 84 if ($XPath->match("/phpsysinfo/FileSystem/Mount[$i]/MountPointID")) { 85 if (!$XPath->match("/phpsysinfo/FileSystem/Mount[$i]/Options") || !stristr($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Options"), "bind")) { 86 if (!in_array($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Device/Name"), $counted_devlist)) { 87 $sum['size'] += $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Size"); 88 $sum['used'] += $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Used"); 89 $sum['free'] += $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Free"); 90 if (PHP_OS != "WINNT") 91 $counted_devlist[] = $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Device/Name"); 92 else 93 $counted_devlist[] = $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/MountPoint"); 94 } 95 } 96 $_text .= " <tr>\n"; 97 98 if ($show_mount_point) { 99 $_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/MountPoint") . "</font></td>\n"; 100 } 101 $_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Type") . "</font></td>\n" 102 . " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Device/Name") . "</font></td>\n" 103 . " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" 104 . create_bargraph($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Used"), $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Size"), $scale_factor, $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Type")) 105 . " " . $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Percent") . "%</font></td>\n" 106 . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Free")) . "</font></td>\n" 107 . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Used")) . "</font></td>\n" 108 . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Size")) . "</font></td>\n" 109 . " </tr>\n"; 110 } 111 } 112 113 $_text .= " <tr>\n"; 114 115 if ($show_mount_point) { 116 $_text .= " <td colspan=\"3\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><i>" . $text['totals'] . " : </i></font></td>\n"; 117 } else { 118 $_text .= " <td colspan=\"2\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><i>" . $text['totals'] . " : </i></font></td>\n"; 119 } 120 121 $_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" 122 . create_bargraph($sum['used'], $sum['size'], $scale_factor) 123 . " " . round(100 / $sum['size'] * $sum['used']) . "%" . "</font></td>\n" 124 . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($sum['free']) . "</font></td>\n" 125 . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($sum['used']) . "</font></td>\n" 126 . " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($sum['size']) . "</font></td>\n </tr>\n" 127 . "</table>\n"; 128 129 return $_text; 130 } 131 132 function wml_filesystem() { 133 global $XPath; 134 global $text; 135 global $show_mount_point; 136 137 $_text = "<card id=\"filesystem\" title=\"" . $text['fs'] . "\">\n"; 138 139 for ($i = 1; $i < sizeof($XPath->getDataParts('/phpsysinfo/FileSystem')); $i++) { 140 if ($XPath->match("/phpsysinfo/FileSystem/Mount[$i]/MountPointID")) { 141 $_text .= "<p>\n"; 142 if ($show_mount_point) { 143 $_text .= $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/MountPoint") . "<br/>\n"; 144 } else { 145 $_text .= $XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Device/Name") . "<br/>\n"; 146 } 147 $_text .= "- " . $text['free'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Free")) . "<br/>\n" 148 . "- " . $text['used'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Used")) . "<br/>\n" 149 . "- " . $text['size'] . ": " . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[$i]/Size")) . "<br/>\n" 150 . "</p>\n"; 151 } 152 } 153 154 $_text .= "</card>\n"; 155 return $_text; 156 } 157 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |