Index: trunk/extensions/Maps/ParserFunctions/GeoFunctions/Maps_GeoFunctions.php |
— | — | @@ -190,7 +190,6 @@ |
191 | 191 | ), |
192 | 192 | array( 'location', 'bearing', 'distance' ) |
193 | 193 | ); |
194 | | - |
195 | 194 | $doCalculation = $parameters !== false; |
196 | 195 | |
197 | 196 | if ( $doCalculation ) { |
— | — | @@ -203,7 +202,9 @@ |
204 | 203 | } |
205 | 204 | |
206 | 205 | if ( $location ) { |
| 206 | + var_dump($location); |
207 | 207 | $destination = self::findDestination( $location, $parameters['bearing'], $parameters['distance'] ); |
| 208 | + var_dump($destination);exit; |
208 | 209 | $output = MapsCoordinateParser::formatCoordinates( $destination, $parameters['format'], $parameters['directional'] ); |
209 | 210 | } else { |
210 | 211 | global $egValidatorFatalLevel; |
— | — | @@ -279,6 +280,8 @@ |
280 | 281 | * @return array The desitination coordinates, as non-directional floats in an array with lat and lon keys. |
281 | 282 | */ |
282 | 283 | public static function findDestination( array $startingCoordinates, $bearing, $distance ) { |
| 284 | + $startingCoordinates['lat'] = (float)$startingCoordinates['lat']; |
| 285 | + $startingCoordinates['lon'] = (float)$startingCoordinates['lon']; |
283 | 286 | $angularDistance = $distance / Maps_EARTH_RADIUS; |
284 | 287 | $lat = asin( |
285 | 288 | sin( $startingCoordinates['lat'] ) * cos( $angularDistance ) + |
Index: trunk/extensions/Maps/ParserFunctions/Maps_ParserFunctions.php |
— | — | @@ -78,7 +78,7 @@ |
79 | 79 | * @return array |
80 | 80 | */ |
81 | 81 | public static function getMapHtml( Parser &$parser, array $params, $parserFunction ) { |
82 | | - global $wgLang, $egValidatorErrorLevel; |
| 82 | + global $wgLang, $egValidatorErrorLevel, $egValidatorFatalLevel; |
83 | 83 | |
84 | 84 | array_shift( $params ); // We already know the $parser. |
85 | 85 | |
— | — | @@ -116,25 +116,22 @@ |
117 | 117 | |
118 | 118 | if ( $egValidatorErrorLevel >= Validator_ERRORS_WARN ) { |
119 | 119 | if ( count( $coordFails ) > 0 ) { |
120 | | - // TODO: escaping |
121 | | - $output .= '<i>' . wfMsgExt( 'maps_unrecognized_coords_for', array( 'parsemag' ), $wgLang->listToText( $coordFails ), count( $coordFails ) ) . '</i>'; |
| 120 | + $output .= '<i>' . htmlspecialchars( wfMsgExt( 'maps_unrecognized_coords_for', array( 'parsemag' ), $wgLang->listToText( $coordFails ), count( $coordFails ) ) ) . '</i>'; |
122 | 121 | } |
123 | 122 | |
124 | 123 | if ( count( $geoFails ) > 0 ) { |
125 | | - // TODO: escaping |
126 | | - $output .= '<i>' . wfMsgExt( 'maps_geocoding_failed_for', array( 'parsemag' ), $wgLang->listToText( $geoFails ), count( $geoFails ) ) . '</i>'; |
| 124 | + $output .= '<i>' . htmlspecialchars( wfMsgExt( 'maps_geocoding_failed_for', array( 'parsemag' ), $wgLang->listToText( $geoFails ), count( $geoFails ) ) ) . '</i>'; |
127 | 125 | } |
128 | 126 | } |
129 | 127 | } |
130 | | - elseif ( $egValidatorErrorLevel >= Validator_ERRORS_MINIMAL ) { |
| 128 | + elseif ( $egValidatorFatalLevel >= Validator_ERRORS_NONE ) { |
131 | 129 | if ( $coords == '' && ( count( $geoFails ) > 0 || count( $coordFails ) > 0 ) ) { |
132 | | - // TODO: escaping |
133 | 130 | if ( count( $coordFails ) > 0 ) $output = '<i>' . wfMsgExt( 'maps_unrecognized_coords', array( 'parsemag' ), $wgLang->listToText( $coordFails ), count( $coordFails ) ) . '</i>'; |
134 | 131 | if ( count( $geoFails ) > 0 ) $output = '<i>' . wfMsgExt( 'maps_geocoding_failed', array( 'parsemag' ), $wgLang->listToText( $geoFails ), count( $geoFails ) ) . '</i>'; |
135 | | - $output .= '<i>' . wfMsg( 'maps_map_cannot_be_displayed' ) . '</i>'; |
| 132 | + $output .= '<i>' . htmlspecialchars( wfMsg( 'maps_map_cannot_be_displayed' ) ) . '</i>'; |
136 | 133 | } |
137 | 134 | else { |
138 | | - $output = '<i>' . wfMsg( 'maps_coordinates_missing' ) . '</i>'; |
| 135 | + $output = '<i>' . htmlspecialchars( wfMsg( 'maps_coordinates_missing' ) ) . '</i>'; |
139 | 136 | } |
140 | 137 | } |
141 | 138 | |