325 |
richard |
1 |
<?php
|
|
|
2 |
/***************************************************************************
|
|
|
3 |
* Copyright (C) 2006 by phpSysInfo - A PHP System Information Script *
|
|
|
4 |
* http://phpsysinfo.sourceforge.net/ *
|
|
|
5 |
* *
|
|
|
6 |
* This program is free software; you can redistribute it and/or modify *
|
|
|
7 |
* it under the terms of the GNU General Public License as published by *
|
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
9 |
* (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 *
|
|
|
18 |
* Free Software Foundation, Inc., *
|
|
|
19 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
20 |
***************************************************************************/
|
|
|
21 |
|
|
|
22 |
// $Id: mbinfo.php,v 1.20 2007/02/18 19:11:31 bigmichi1 Exp $
|
|
|
23 |
|
|
|
24 |
function xml_mbinfo() {
|
|
|
25 |
global $text;
|
|
|
26 |
global $mbinfo;
|
|
|
27 |
|
|
|
28 |
$_text = "";
|
|
|
29 |
|
|
|
30 |
$arrBuff = $mbinfo->temperature();
|
|
|
31 |
$_text = " <MBinfo>\n";
|
|
|
32 |
if( sizeof($arrBuff ) > 0 ) {
|
|
|
33 |
$_text .= " <Temperature>\n";
|
|
|
34 |
foreach( $arrBuff as $arrValue ) {
|
|
|
35 |
$_text .= " <Item>\n";
|
|
|
36 |
$_text .= " <Label>" . htmlspecialchars( $arrValue['label'], ENT_QUOTES ) . "</Label>\n";
|
|
|
37 |
$_text .= " <Value>" . htmlspecialchars( $arrValue['value'], ENT_QUOTES ) . "</Value>\n";
|
|
|
38 |
$_text .= " <Limit>" . htmlspecialchars( $arrValue['limit'], ENT_QUOTES ) . "</Limit>\n";
|
|
|
39 |
$_text .= " </Item>\n";
|
|
|
40 |
}
|
|
|
41 |
$_text .= " </Temperature>\n";
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
$arrBuff = $mbinfo->fans();
|
|
|
45 |
if( sizeof( $arrBuff ) > 0 ) {
|
|
|
46 |
$_text .= " <Fans>\n";
|
|
|
47 |
foreach( $arrBuff as $arrValue ) {
|
|
|
48 |
$_text .= " <Item>\n";
|
|
|
49 |
$_text .= " <Label>" . htmlspecialchars( $arrValue['label'], ENT_QUOTES ) . "</Label>\n";
|
|
|
50 |
$_text .= " <Value>" . htmlspecialchars( $arrValue['value'], ENT_QUOTES ) . "</Value>\n";
|
|
|
51 |
$_text .= " <Min>" . htmlspecialchars( $arrValue['min'], ENT_QUOTES ) . "</Min>\n";
|
|
|
52 |
$_text .= " </Item>\n";
|
|
|
53 |
}
|
|
|
54 |
$_text .= " </Fans>\n";
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
$arrBuff = $mbinfo->voltage();
|
|
|
58 |
if( sizeof( $arrBuff ) > 0 ) {
|
|
|
59 |
$_text .= " <Voltage>\n";
|
|
|
60 |
foreach( $arrBuff as $arrValue ) {
|
|
|
61 |
$_text .= " <Item>\n";
|
|
|
62 |
$_text .= " <Label>" . htmlspecialchars( $arrValue['label'], ENT_QUOTES ) . "</Label>\n";
|
|
|
63 |
$_text .= " <Value>" . htmlspecialchars( $arrValue['value'], ENT_QUOTES ) . "</Value>\n";
|
|
|
64 |
$_text .= " <Min>" . htmlspecialchars( $arrValue['min'], ENT_QUOTES ) . "</Min>\n";
|
|
|
65 |
$_text .= " <Max>" . htmlspecialchars( $arrValue['max'], ENT_QUOTES ) . "</Max>\n";
|
|
|
66 |
$_text .= " </Item>\n";
|
|
|
67 |
}
|
|
|
68 |
$_text .= " </Voltage>\n";
|
|
|
69 |
}
|
|
|
70 |
$_text .= " </MBinfo>\n";
|
|
|
71 |
|
|
|
72 |
return $_text;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
function html_mbtemp() {
|
|
|
76 |
global $text;
|
|
|
77 |
global $XPath;
|
|
|
78 |
|
|
|
79 |
$textdir = direction();
|
|
|
80 |
$scale_factor = 2;
|
|
|
81 |
|
|
|
82 |
$_text = " <tr>\n"
|
|
|
83 |
. " <td><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n"
|
|
|
84 |
. " <td><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n"
|
|
|
85 |
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_limit'] . "</b></font></td>\n"
|
|
|
86 |
. " </tr>\n";
|
|
|
87 |
|
|
|
88 |
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Temperature" ) ); $i < $max; $i++ ) {
|
|
|
89 |
$_text .= " <tr>\n"
|
|
|
90 |
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Label" ) . "</font></td>\n"
|
|
|
91 |
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">";
|
|
|
92 |
if( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ) == 0) {
|
|
|
93 |
$_text .= "Unknown - Not connected?";
|
|
|
94 |
} else {
|
|
|
95 |
$_text .= create_bargraph( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ), $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Limit" ), $scale_factor );
|
|
|
96 |
}
|
|
|
97 |
$_text .= temperature( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ) ) . "</font></td>\n"
|
|
|
98 |
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . temperature( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Limit" ) ) . "</font></td>\n"
|
|
|
99 |
. " </tr>\n";
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
return $_text;
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
function html_mbfans() {
|
|
|
106 |
global $text;
|
|
|
107 |
global $XPath;
|
|
|
108 |
|
|
|
109 |
$textdir = direction();
|
|
|
110 |
$booShowfans = false;
|
|
|
111 |
|
|
|
112 |
$_text ="<table width=\"100%\">\n";
|
|
|
113 |
$_text .= " <tr>\n"
|
|
|
114 |
. " <td><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n"
|
|
|
115 |
. " <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n"
|
|
|
116 |
. " <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_min'] . "</b></font></td>\n"
|
|
|
117 |
. " </tr>\n";
|
|
|
118 |
|
|
|
119 |
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Fans" ) ); $i < $max; $i++ ) {
|
|
|
120 |
$_text .= " <tr>\n"
|
|
|
121 |
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Fans/Item[" . $i . "]/Label" ) . "</font></td>\n"
|
|
|
122 |
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . round( $XPath->getData( "/phpsysinfo/MBinfo/Fans/Item[" . $i . "]/Value" ) ) . " " . $text['rpm_mark'] . "</font></td>\n"
|
|
|
123 |
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Fans/Item[" . $i . "]/Min" ) . " " . $text['rpm_mark'] . "</font></td>\n"
|
|
|
124 |
. " </tr>\n";
|
|
|
125 |
if( round( $XPath->getData( "/phpsysinfo/MBinfo/Fans/Item[" . $i . "]/Value" ) ) > 0 ) {
|
|
|
126 |
$booShowfans = true;
|
|
|
127 |
}
|
|
|
128 |
}
|
|
|
129 |
$_text .= "</table>\n";
|
|
|
130 |
|
|
|
131 |
if( ! $booShowfans ) {
|
|
|
132 |
$_text = "";
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
return $_text;
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
function html_mbvoltage() {
|
|
|
139 |
global $text;
|
|
|
140 |
global $XPath;
|
|
|
141 |
|
|
|
142 |
$textdir = direction();
|
|
|
143 |
|
|
|
144 |
$_text = "<table width=\"100%\">\n";
|
|
|
145 |
$_text .= " <tr>\n"
|
|
|
146 |
. " <td><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n"
|
|
|
147 |
. " <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n"
|
|
|
148 |
. " <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_min'] . "</b></font></td>\n"
|
|
|
149 |
. " <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_max'] . "</b></font></td>\n"
|
|
|
150 |
. " </tr>\n";
|
|
|
151 |
|
|
|
152 |
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Voltage" ) ); $i < $max; $i++ ) {
|
|
|
153 |
$_text .= " <tr>\n"
|
|
|
154 |
. " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Label" ) . "</font></td>\n"
|
|
|
155 |
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Value" ) . " " . $text['voltage_mark'] . "</font></td>\n"
|
|
|
156 |
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Min" ) . " " . $text['voltage_mark'] . "</font></td>\n"
|
|
|
157 |
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Max" ) . " " . $text['voltage_mark'] . "</font></td>\n"
|
|
|
158 |
. " </tr>\n";
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
$_text .= "</table>\n";
|
|
|
162 |
|
|
|
163 |
return $_text;
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
function wml_mbtemp() {
|
|
|
167 |
global $XPath;
|
|
|
168 |
|
|
|
169 |
$_text = "";
|
|
|
170 |
|
|
|
171 |
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Temperature" ) ); $i < $max; $i++ ) {
|
|
|
172 |
$_text .= "<p>" . $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Label" ) . ": ";
|
|
|
173 |
if( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ) == 0 ) {
|
|
|
174 |
$_text .= "Unknown - Not connected?</p>";
|
|
|
175 |
} else {
|
|
|
176 |
$_text .= " " . str_replace( "°", "", temperature( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ) ) ) . "</p>\n";
|
|
|
177 |
}
|
|
|
178 |
}
|
|
|
179 |
|
|
|
180 |
return $_text;
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
function wml_mbfans() {
|
|
|
184 |
global $text;
|
|
|
185 |
global $XPath;
|
|
|
186 |
|
|
|
187 |
$_text = "<card id=\"fans\" title=\"" . $text['fans'] . "\">\n";
|
|
|
188 |
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Fans" ) ); $i < $max; $i++ ) {
|
|
|
189 |
$_text .= "<p>" . $XPath->getData( "/phpsysinfo/MBinfo/Fans/Item[" . $i . "]/Label" ) . ": " . round( $XPath->getData( "/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value" ) ) . " " . $text['rpm_mark'] . "</p>\n";
|
|
|
190 |
}
|
|
|
191 |
$_text .= "</card>\n";
|
|
|
192 |
|
|
|
193 |
return $_text;
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
function wml_mbvoltage() {
|
|
|
197 |
global $text;
|
|
|
198 |
global $XPath;
|
|
|
199 |
|
|
|
200 |
$_text = "<card id=\"volt\" title=\"" . $text['voltage'] . "\">\n";
|
|
|
201 |
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/MBinfo/Voltage" ) ); $i < $max; $i++ ) {
|
|
|
202 |
$_text .= "<p>" . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Label" ) . ": " . $XPath->getData( "/phpsysinfo/MBinfo/Voltage/Item[" . $i . "]/Value" ) . " " . $text['voltage_mark'] . "</p>\n";
|
|
|
203 |
}
|
|
|
204 |
$_text .= "</card>\n";
|
|
|
205 |
|
|
|
206 |
return $_text;
|
|
|
207 |
}
|
|
|
208 |
?>
|