mirror of
				https://github.com/Mibew/open-street-map-plugin.git
				synced 2025-10-31 10:31:08 +03:00 
			
		
		
		
	
							parent
							
								
									d606b3ec86
								
							
						
					
					
						commit
						7351975ec9
					
				
							
								
								
									
										18
									
								
								Plugin.php
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								Plugin.php
									
									
									
									
									
								
							| @ -75,16 +75,13 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi | |||||||
|     public function usersFunctionCallHandler(&$function) |     public function usersFunctionCallHandler(&$function) | ||||||
|     { |     { | ||||||
|         if ($function['function'] == 'googleMapsGetInfo') { |         if ($function['function'] == 'googleMapsGetInfo') { | ||||||
|             // An IP string can contain more than one IP adress. For example it
 |             // An IP string can contain more than one IP address. For example it
 | ||||||
|             // can be something like this: "x.x.x.x (x.x.x.x)". Thus we need to
 |             // can be something like this: "x.x.x.x (x.x.x.x)". We need to
 | ||||||
|             // extract all IPS from the string and use the last one.
 |             // use only first one.
 | ||||||
|             $count = preg_match_all( |             $ips = explode(' ', $function['arguments']['ip'], 2); | ||||||
|                 "/(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3})/", |             $ip = filter_var($ips[0], FILTER_VALIDATE_IP); | ||||||
|                 $function['arguments']['ip'], |             if (!$ip) { | ||||||
|                 $matches |                 // There is no valid IP in the string. An error should be returned.
 | ||||||
|             ); |  | ||||||
|             if (!$count) { |  | ||||||
|                 // There is no IP in the string. An error should be returned.
 |  | ||||||
|                 $function['results'] = array( |                 $function['results'] = array( | ||||||
|                     'errorCode' => 1, |                     'errorCode' => 1, | ||||||
|                     'errorMessage' => 'The specified IP is invalid!', |                     'errorMessage' => 'The specified IP is invalid!', | ||||||
| @ -92,7 +89,6 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi | |||||||
| 
 | 
 | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|             $ip = end($matches[0]); |  | ||||||
|             $info = PluginManager::getInstance() |             $info = PluginManager::getInstance() | ||||||
|                 ->getPlugin('Mibew:GeoIp') |                 ->getPlugin('Mibew:GeoIp') | ||||||
|                 ->getGeoInfo($ip, get_current_locale()); |                 ->getGeoInfo($ip, get_current_locale()); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user