diff --git a/html/includes/graphs/device/current.inc.php b/html/includes/graphs/device/current.inc.php
index e17c525b63..4fb096550e 100644
--- a/html/includes/graphs/device/current.inc.php
+++ b/html/includes/graphs/device/current.inc.php
@@ -1,54 +1,9 @@
\ No newline at end of file
+?>
diff --git a/html/includes/graphs/device/fanspeed.inc.php b/html/includes/graphs/device/fanspeed.inc.php
index 045adeeacd..7680f33727 100644
--- a/html/includes/graphs/device/fanspeed.inc.php
+++ b/html/includes/graphs/device/fanspeed.inc.php
@@ -1,56 +1,9 @@
\ No newline at end of file
+?>
diff --git a/html/includes/graphs/device/frequency.inc.php b/html/includes/graphs/device/frequency.inc.php
index 4f055ec44a..b071b4bfd0 100644
--- a/html/includes/graphs/device/frequency.inc.php
+++ b/html/includes/graphs/device/frequency.inc.php
@@ -1,57 +1,9 @@
\ No newline at end of file
+?>
diff --git a/html/includes/graphs/device/humidity.inc.php b/html/includes/graphs/device/humidity.inc.php
index f1e6384719..b7d0f1e171 100644
--- a/html/includes/graphs/device/humidity.inc.php
+++ b/html/includes/graphs/device/humidity.inc.php
@@ -1,51 +1,9 @@
\ No newline at end of file
+?>
diff --git a/html/includes/graphs/device/temperature.inc.php b/html/includes/graphs/device/temperature.inc.php
index 0e89404ffe..bcc9674853 100644
--- a/html/includes/graphs/device/temperature.inc.php
+++ b/html/includes/graphs/device/temperature.inc.php
@@ -1,52 +1,9 @@
"300") { $descr_len = "40"; } else { $descr_len = "22"; }
+include("includes/graphs/device/sensor.inc.php");
-$rrd_options .= " -l 0 -E ";
-$iter = "1";
-$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '$id' ORDER BY sensor_index");
-$rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\n'";
-while ($temperature = mysql_fetch_assoc($sql))
-{
- # FIXME generic colour function
- switch ($iter)
- {
- case "1":
- $colour= "CC0000";
- break;
- case "2":
- $colour= "008C00";
- break;
- case "3":
- $colour= "4096EE";
- break;
- case "4":
- $colour= "73880A";
- break;
- case "5":
- $colour= "D01F3C";
- break;
- case "6":
- $colour= "36393D";
- break;
- case "7":
- default:
- $colour= "FF0084";
- unset($iter);
- break;
- }
-
- $temperature['sensor_descr_fixed'] = substr(str_pad($temperature['sensor_descr'], $descr_len),0,$descr_len);
- $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/temperature-" . safename($temperature['sensor_type']."-".$temperature['sensor_index']) . ".rrd";
- $rrd_options .= " DEF:sensor" . $temperature['sensor_id'] . "=$rrd_file:sensor:AVERAGE ";
- $rrd_options .= " LINE1:sensor" . $temperature['sensor_id'] . "#" . $colour . ":'" . str_replace(':','\:',str_replace('\*','*',$temperature['sensor_descr_fixed'])) . "'";
- $rrd_options .= " GPRINT:sensor" . $temperature['sensor_id'] . ":LAST:%4.1lfC ";
- $rrd_options .= " GPRINT:sensor" . $temperature['sensor_id'] . ":MIN:%4.1lfC ";
- $rrd_options .= " GPRINT:sensor" . $temperature['sensor_id'] . ":MAX:%4.1lfC\\\l ";
- $iter++;
-}
-
-?>
\ No newline at end of file
+?>
diff --git a/html/includes/graphs/device/voltage.inc.php b/html/includes/graphs/device/voltage.inc.php
index c15ec3381c..3a2423fc71 100644
--- a/html/includes/graphs/device/voltage.inc.php
+++ b/html/includes/graphs/device/voltage.inc.php
@@ -1,57 +1,9 @@
"300") { $descr_len = "38"; } else { $descr_len = "18"; }
-$rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\n'";
-
-$iter = "1";
-$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '$id'");
-while ($sensor = mysql_fetch_assoc($sql))
-{
- # FIXME generic colour function
- switch ($iter)
- {
- case "1":
- $colour= "CC0000";
- break;
- case "2":
- $colour= "008C00";
- break;
- case "3":
- $colour= "4096EE";
- break;
- case "4":
- $colour= "73880A";
- break;
- case "5":
- $colour= "D01F3C";
- break;
- case "6":
- $colour= "36393D";
- break;
- case "7":
- default:
- $colour= "FF0084";
- unset($iter);
- break;
- }
-
- $sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], $descr_len),0,$descr_len);
- $sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
-
- $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/voltage-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
-
- $rrd_options .= " DEF:sensor" . $sensor['sensor_id'] . "=$rrd_filename:sensor:AVERAGE";
- $rrd_options .= " LINE1:sensor" . $sensor['sensor_id'] . "#".$colour.":'" . $sensor['sensor_descr_fixed'] . "'";
- $rrd_options .= " GPRINT:sensor" . $sensor['sensor_id'] . ":AVERAGE:%5.2lfV";
- $rrd_options .= " GPRINT:sensor" . $sensor['sensor_id'] . ":MIN:%5.2lfV";
- $rrd_options .= " GPRINT:sensor" . $sensor['sensor_id'] . ":MAX:%5.2lfV\\\\l";
-
- $iter++;
-}
-
-?>
\ No newline at end of file
+?>