jablonka.czprosek.czf

weathermap

Subversion Repositories:
[/] [lib/] [datasources/] [WeatherMapDataSource_mrtg.php] - Blame information for rev 84

 

Line No. Rev Author Line
11simandl<?php
2// Sample Pluggable datasource for PHP Weathermap 0.9
3// - read a pair of values from a database, and return it
4 
5// TARGET dbplug:databasename:username:pass:hostkey
6 
7class WeatherMapDataSource_mrtg extends WeatherMapDataSource {
8 
9 function Recognise($targetstring)
10 {
11 if(preg_match("/\.(htm|html)$/",$targetstring,$matches))
12 {
13 return TRUE;
14 }
15 else
16 {
17 return FALSE;
18 }
19 }
20 
21 function ReadData($targetstring, &$map, &$item)
22 {
23 $inbw=-1;
24 $outbw=-1;
25 $data_time = 0;
26 
27 $matches=0;
28 
2983simandl// $fd=fopen($targetstring, "r");
30 
31 $old = ini_set('default_socket_timeout', $timeout);
32 $fd = fopen($targetstring, 'r');
33 ini_set('default_socket_timeout', $old);
34 stream_set_timeout($fd, $timeout);
35 stream_set_blocking($fd, 0);
36
37 
38 
39 
401simandl 
41 {
42 while (!feof($fd))
43 {
44 $buffer=fgets($fd, 4096);
45
46 
47
48 
49 }
50 fclose($fd);
51 # $data_time = filemtime($targetstring);
5218simandl }
531simandl else {
54 // some error code to go in here
55 debug ("MRTG ReadData: Couldn't open ($targetstring). \n"); }
56
57 
58
59 
60 }
61}
62
63 
64?>
65

Powered by WebSVN 2.2.1