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: hddtemp.php,v 1.13 2007/02/08 20:16:25 bigmichi1 Exp $
|
|
|
23 |
|
|
|
24 |
function xml_hddtemp() {
|
|
|
25 |
global $hddtemp_avail, $hddtemp;
|
|
|
26 |
$arrBuf = $hddtemp->temperature( $hddtemp_avail );
|
|
|
27 |
|
|
|
28 |
$_text = " <HDDTemp>\n";
|
|
|
29 |
for( $i = 0, $max = sizeof( $arrBuf ); $i < $max; $i++ ) {
|
|
|
30 |
$_text .= " <Item>\n";
|
|
|
31 |
$_text .= " <Label>" . htmlspecialchars( $arrBuf[$i]['label'], ENT_QUOTES ) . "</Label>\n";
|
|
|
32 |
$_text .= " <Value>" . htmlspecialchars( $arrBuf[$i]['value'], ENT_QUOTES ) . "</Value>\n";
|
|
|
33 |
$_text .= " <Model>" . htmlspecialchars( $arrBuf[$i]['model'], ENT_QUOTES ) . "</Model>\n";
|
|
|
34 |
$_text .= " </Item>\n";
|
|
|
35 |
}
|
|
|
36 |
$_text .= " </HDDTemp>\n";
|
|
|
37 |
|
|
|
38 |
return $_text;
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
function html_hddtemp() {
|
|
|
42 |
global $XPath;
|
|
|
43 |
global $text;
|
|
|
44 |
global $sensor_program;
|
|
|
45 |
|
|
|
46 |
$textdir = direction();
|
|
|
47 |
$scale_factor = 2;
|
|
|
48 |
$_text = "";
|
|
|
49 |
$maxvalue = "+60";
|
|
|
50 |
|
|
|
51 |
if( $XPath->match( "/phpsysinfo/HDDTemp" ) ) {
|
|
|
52 |
for( $i = 1, $max = sizeof( $XPath->getDataParts( "/phpsysinfo/HDDTemp" ) ); $i < $max; $i++ ) {
|
|
|
53 |
if( $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Value" ) != 0 ) {
|
|
|
54 |
$_text .= " <tr>\n";
|
|
|
55 |
$_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">". $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Model" ) . "</font></td>\n";
|
|
|
56 |
$_text .= " <td align=\"" . $textdir['left'] . "\" valign=\"top\" nowrap><font size=\"-1\">";
|
|
|
57 |
$_text .= create_bargraph( $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Value" ), $maxvalue, $scale_factor );
|
|
|
58 |
$_text .= temperature( $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Value" ) ) . "</font></td>\n";
|
|
|
59 |
$_text .= " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . temperature( $maxvalue ) . "</font></td></tr>\n";
|
|
|
60 |
}
|
|
|
61 |
}
|
|
|
62 |
}
|
|
|
63 |
if( strlen( $_text ) > 0 && empty( $sensor_program ) ) {
|
|
|
64 |
$_text = " <tr>\n"
|
|
|
65 |
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n"
|
|
|
66 |
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n"
|
|
|
67 |
. " <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_limit'] . "</b></font></td>\n"
|
|
|
68 |
. " </tr>" . $_text;
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
return $_text;
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
function wml_hddtemp() {
|
|
|
75 |
global $XPath;
|
|
|
76 |
global $text;
|
|
|
77 |
|
|
|
78 |
$_text = "";
|
|
|
79 |
|
|
|
80 |
if( $XPath->match( "/phpsysinfo/HDDTemp" ) ) {
|
|
|
81 |
for( $i = 1; $i < sizeof( $XPath->getDataParts( "/phpsysinfo/HDDTemp" ) ); $i++ ) {
|
|
|
82 |
if( $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Value") != 0 ) {
|
|
|
83 |
$_text .= "<p>" . $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Model" ) . ": " . str_replace( "°", "", temperature( $XPath->getData( "/phpsysinfo/HDDTemp/Item[" . $i . "]/Value" ) ) ) . "</p>\n";
|
|
|
84 |
}
|
|
|
85 |
}
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
return $_text;
|
|
|
89 |
}
|
|
|
90 |
?>
|