Skip to content

Commit ea57b45

Browse files
authored
Merge pull request #100 from vhuk/fix-8.2-deprecations-part-1
Fix PHP deprecation
2 parents ea60439 + 04dbd21 commit ea57b45

7 files changed

Lines changed: 26 additions & 11 deletions

lib/WeatherMap.functions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ function wimagefilledrectangle( $image ,$x1, $y1, $x2, $y2, $color )
18831883
$r = $r/255; $g=$g/255; $b=$b/255; $a=(127-$a)/127;
18841884

18851885
metadump("FRECT $x1 $y1 $x2 $y2 $r $g $b $a");
1886-
return(imagefilledrectangle( $image ,$x1, $y1, $x2, $y2, $color ));
1886+
return(imagefilledrectangle( $image ,(int)$x1, (int)$y1, (int)$x2, (int)$y2, $color ));
18871887
}
18881888

18891889
function wimagerectangle( $image ,$x1, $y1, $x2, $y2, $color )
@@ -1915,7 +1915,7 @@ function wimagepolygon($image, $points, $num_points, $color)
19151915

19161916
metadump("POLY $num_points ".$pts." $r $g $b $a");
19171917

1918-
return(imagepolygon($image, $points, $num_points, $color));
1918+
return(imagepolygon($image, $points, $color));
19191919
}
19201920

19211921
function wimagefilledpolygon($image, $points, $num_points, $color)
@@ -1935,7 +1935,7 @@ function wimagefilledpolygon($image, $points, $num_points, $color)
19351935

19361936
metadump("FPOLY $num_points ".$pts." $r $g $b $a");
19371937

1938-
return(imagefilledpolygon($image, $points, $num_points, $color));
1938+
return(imagefilledpolygon($image, $points, $color));
19391939
}
19401940

19411941
function wimagecreatetruecolor($width, $height)

lib/WeatherMapNode.class.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ class WeatherMapNode extends WeatherMapItem
5454
var $template;
5555
var $polar;
5656
var $boundingboxes=array();
57-
57+
var $aiconoutlinecolour;
58+
var $aiconfillcolour;
5859
function __construct()
5960
{
6061
$this->inherit_fieldlist=array
@@ -627,6 +628,11 @@ function pre_render($im, &$map)
627628
$txt_y -= $bbox_y1;
628629
$txt_y += ($this->labeloffsety + $dy);
629630

631+
$label_x1=(int)$label_x1;
632+
$label_y1=(int)$label_y1;
633+
$label_x2=(int)$label_x2;
634+
$label_y2=(int)$label_y2;
635+
630636
# print "FINAL TEXT at $txt_x , $txt_y\n";
631637

632638
// if there's an icon, then you can choose to have no background
@@ -716,7 +722,7 @@ function NewDraw($im, &$map)
716722
if(isset($this->image))
717723
{
718724
imagealphablending($im, true);
719-
imagecopy ( $im, $this->image, $this->x - $this->centre_x, $this->y - $this->centre_y, 0, 0, imagesx($this->image), imagesy($this->image) );
725+
imagecopy ( $im, $this->image, (int)($this->x - $this->centre_x), (int)($this->y - $this->centre_y), 0, 0, imagesx($this->image), imagesy($this->image) );
720726
}
721727

722728
}

lib/Weathermap.class.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ class WeatherMap extends WeatherMapBase
274274
var $coverage = array();
275275
var $colourtable = array();
276276
var $warncount = 0;
277+
var $numscales = array();
278+
var $dumpconfig;
279+
var $labelstyle;
280+
var $fonts;
281+
var $basehref;
282+
var $image;
277283

278284
function WeatherMap(){
279285
return __construct();
@@ -503,7 +509,7 @@ function myimagestring($image, $fontnumber, $x, $y, $string, $colour, $angle = 0
503509
}
504510

505511
if (($fontnumber > 0) && ($fontnumber < 6)) {
506-
imagestring($image, $fontnumber, $x, $y - imagefontheight($fontnumber), $string, $colour);
512+
imagestring($image, $fontnumber, (int)$x, (int)$y - imagefontheight($fontnumber), $string, $colour);
507513
if ($angle != 0) {
508514
wm_warn("Angled text doesn't work with non-FreeType fonts [WMWARN02]\n");
509515
}
@@ -1106,7 +1112,7 @@ function DrawLabelRotated(
11061112
)) {
11071113
$bgcol = myimagecolorallocate($im, $bgcolour[0], $bgcolour[1], $bgcolour[2]);
11081114
# imagefilledrectangle($im, $x1, $y1, $x2, $y2, $bgcol);
1109-
wimagefilledpolygon($im, $points, 4, $bgcol);
1115+
wimagefilledpolygon($im, array_slice($points,0,8), 4, $bgcol);
11101116
}
11111117

11121118
if ($outlinecolour != array
@@ -1117,7 +1123,7 @@ function DrawLabelRotated(
11171123
)) {
11181124
$outlinecol = myimagecolorallocate($im, $outlinecolour[0], $outlinecolour[1], $outlinecolour[2]);
11191125
# imagerectangle($im, $x1, $y1, $x2, $y2, $outlinecol);
1120-
wimagepolygon($im, $points, 4, $outlinecol);
1126+
wimagepolygon($im, array_slice($points,0,8), 4, $outlinecol);
11211127
}
11221128

11231129
$textcol = myimagecolorallocate($im, $textcolour[0], $textcolour[1], $textcolour[2]);

lib/datasources/WeatherMapDataSource_fping.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// TARGET fping:hostname
77

88
class WeatherMapDataSource_fping extends WeatherMapDataSource {
9+
var $fping_cmd;
910

1011
var $addresscache = array();
1112
var $donepings = FALSE;

lib/datasources/WeatherMapDataSource_mrtg.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ function ReadData($targetstring, &$map, &$item)
3939
while (!feof($fd))
4040
{
4141
$buffer=fgets($fd, 4096);
42-
wm_debug("MRTG ReadData: Matching on '${matchvalue}in $matchperiod' and '${matchvalue}out $matchperiod'\n");
42+
wm_debug("MRTG ReadData: Matching on '{$matchvalue}in $matchperiod' and '{$matchvalue}out $matchperiod'\n");
4343

44-
if (preg_match("/<\!-- ${matchvalue}in $matchperiod ([-+]?\d+\.?\d*) -->/", $buffer, $matches)) { $data[IN] = $matches[1] * 8; }
45-
if (preg_match("/<\!-- ${matchvalue}out $matchperiod ([-+]?\d+\.?\d*) -->/", $buffer, $matches)) { $data[OUT] = $matches[1] * 8; }
44+
if (preg_match("/<\!-- {$matchvalue}in $matchperiod ([-+]?\d+\.?\d*) -->/", $buffer, $matches)) { $data[IN] = $matches[1] * 8; }
45+
if (preg_match("/<\!-- {$matchvalue}out $matchperiod ([-+]?\d+\.?\d*) -->/", $buffer, $matches)) { $data[OUT] = $matches[1] * 8; }
4646
}
4747
fclose($fd);
4848
# don't bother with the modified time if the target is a URL

lib/datasources/WeatherMapDataSource_snmp.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// (that is, TARGET snmp:community:host:in_oid:out_oid
1515

1616
class WeatherMapDataSource_snmp extends WeatherMapDataSource {
17+
var $down_cache;
1718

1819
function Init(&$map)
1920
{

lib/datasources/WeatherMapDataSource_snmp2c.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
class WeatherMapDataSource_snmp2c extends WeatherMapDataSource
1717
{
18+
var $down_cache;
1819

1920
function Init(&$map)
2021
{

0 commit comments

Comments
 (0)