From: Brion Vibber Date: Mon, 28 Jun 2010 18:41:33 +0000 (-0400) Subject: Fix for PHP notice when given an integer degrees in decimalDegreesToDMS(); using... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b2ad8ec571bd68a92e433e817531151ebf8aa4d0;p=quix0rs-gnu-social.git Fix for PHP notice when given an integer degrees in decimalDegreesToDMS(); using math instead of string manipulation to split integer portion from decimal remainder. --- diff --git a/lib/noticelist.php b/lib/noticelist.php index 432ea78d5b..e23cf3b6d5 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -463,12 +463,14 @@ class NoticeListItem extends Widget $this->out->elementEnd('span'); } + /** + * @param number $dec decimal degrees + * @return array split into 'deg', 'min', and 'sec' + */ function decimalDegreesToDMS($dec) { - - $vars = explode(".",$dec); - $deg = $vars[0]; - $tempma = "0.".$vars[1]; + $deg = intval($dec); + $tempma = abs($dec) - abs($deg); $tempma = $tempma * 3600; $min = floor($tempma / 60);