Includes QRZ XML Lookup functions if you have a subcription
这个提交包含在:
		
							父节点
							
								
									b03d71177c
								
							
						
					
					
						当前提交
						93156261e2
					
				
					共有  3 个文件被更改,包括 104 次插入 和 0 次删除
				
			
		|  | @ -9,12 +9,15 @@ | |||
| |	'app_name'		Name of the App 'Cloudlog' | ||||
| |	'app_version'	Set by the dev team. | ||||
| |	'directory'		directory where cloudlog is installed eg "logger" | ||||
| |	'callbook'		Selects which Callbook lookup to use defaults "callbytxt" but supports "qrz" | ||||
| */ | ||||
| 
 | ||||
| $config['app_name'] = "Cloudlog"; | ||||
| $config['app_version'] = "0.1"; | ||||
| $config['directory'] = "logbook"; | ||||
| 
 | ||||
| $config['callbook'] = "callbytxt"; // Options are qrz or callbytxt
 | ||||
| 
 | ||||
| /* | ||||
| |-------------------------------------------------------------------------- | ||||
| | Logbook Options | ||||
|  | @ -51,6 +54,18 @@ $config['auth_level'][2] = "Editor"; | |||
| $config['auth_level'][3] = "API User"; | ||||
| $config['auth_level'][99] = "Administrator"; | ||||
| 
 | ||||
| /* | ||||
| |-------------------------------------------------------------------------- | ||||
| | QRZ Subscription Information | ||||
| |-------------------------------------------------------------------------- | ||||
| | | ||||
| | 	'username'		QRZ.com Username | ||||
| |	'password'		Default locator used to calculate bearings/distance | ||||
| */ | ||||
| 
 | ||||
| $config['qrz_username'] = ""; | ||||
| $config['qrz_password'] = ""; | ||||
| 
 | ||||
| /* | ||||
| |-------------------------------------------------------------------------- | ||||
| | Base Site URL | ||||
|  |  | |||
							
								
								
									
										83
									
								
								application/libraries/qrz.php
									
									
									
									
									
										普通文件
									
								
							
							
						
						
									
										83
									
								
								application/libraries/qrz.php
									
									
									
									
									
										普通文件
									
								
							|  | @ -0,0 +1,83 @@ | |||
| <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');  | ||||
| 
 | ||||
| /* | ||||
| 	Controls the interaction with the QRZ.com Subscription based XML API. | ||||
| */ | ||||
| 
 | ||||
| 
 | ||||
| class Qrz { | ||||
| 
 | ||||
| 	// Return session key
 | ||||
| 	public function session($username, $password) { | ||||
| 		// URL to the XML Source
 | ||||
| 		$xml_feed_url = 'http://xmldata.qrz.com/xml/current/?username='.$username.';password='.$password.';agent=cloudlog'; | ||||
| 		 | ||||
| 		// CURL Functions
 | ||||
| 		$ch = curl_init(); | ||||
| 		curl_setopt($ch, CURLOPT_URL, $xml_feed_url); | ||||
| 		curl_setopt($ch, CURLOPT_HEADER, false); | ||||
| 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||||
| 		$xml = curl_exec($ch); | ||||
| 		curl_close($ch); | ||||
| 		 | ||||
| 		// Create XML object
 | ||||
| 		$xml = simplexml_load_string($xml); | ||||
| 		 | ||||
| 		// Return Session Key
 | ||||
| 		return (string) $xml->Session->Key; | ||||
| 	} | ||||
| 	 | ||||
| 	// Set Session Key session.
 | ||||
| 	public function set_session($username, $password) { | ||||
| 	 | ||||
| 		// URL to the XML Source
 | ||||
| 		$xml_feed_url = 'http://xmldata.qrz.com/xml/current/?username='.$username.';password='.$password.';agent=cloudlog'; | ||||
| 		 | ||||
| 		// CURL Functions
 | ||||
| 		$ch = curl_init(); | ||||
| 		curl_setopt($ch, CURLOPT_URL, $xml_feed_url); | ||||
| 		curl_setopt($ch, CURLOPT_HEADER, false); | ||||
| 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||||
| 		$xml = curl_exec($ch); | ||||
| 		curl_close($ch); | ||||
| 		 | ||||
| 		// Create XML object
 | ||||
| 		$xml = simplexml_load_string($xml); | ||||
| 		 | ||||
| 		$key = (string) $xml->Session->Key; | ||||
| 
 | ||||
| 		$this->session->set_userdata('qrz_session_key', $key); | ||||
| 		 | ||||
| 		return true; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	public function search($callsign, $key) | ||||
| 	{ | ||||
| 
 | ||||
| 		// URL to the XML Source
 | ||||
| 		$xml_feed_url = 'http://xmldata.qrz.com/xml/current/?s='.$key.';callsign='.$callsign.''; | ||||
| 		 | ||||
| 		// CURL Functions
 | ||||
| 		$ch = curl_init(); | ||||
| 		curl_setopt($ch, CURLOPT_URL, $xml_feed_url); | ||||
| 		curl_setopt($ch, CURLOPT_HEADER, false); | ||||
| 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||||
| 		$xml = curl_exec($ch); | ||||
| 		curl_close($ch); | ||||
| 		 | ||||
| 		// Create XML object
 | ||||
| 		$xml = simplexml_load_string($xml); | ||||
| 	 | ||||
| 		// Return Required Fields
 | ||||
| 		$data['callsign'] = (string) $xml->Callsign->call; | ||||
| 		$data['name'] = (string) $xml->Callsign->fname; | ||||
| 		$data['gridsquare'] = (string) $xml->Callsign->grid;	 | ||||
| 		$data['city'] = (string) $xml->Callsign->addr2; | ||||
| 		$data['lat'] = (string) $xml->Callsign->lat; | ||||
| 		$data['long'] = (string) $xml->Callsign->lon; | ||||
| 		$data['iota'] = (string) $xml->Callsign->iota; | ||||
| 			 | ||||
| 		return $data; | ||||
| 	} | ||||
| } | ||||
|  | @ -515,6 +515,12 @@ | |||
| 						$('#qth').val(result); | ||||
| 					}); | ||||
| 				} | ||||
| 		 | ||||
| 				if($('#qth').val() == "") { | ||||
| 					$.get('logbook/callsign_iota/' + $(this).val(), function(result) { | ||||
| 						$('#iota_ref').val(result); | ||||
| 					}); | ||||
| 				} | ||||
| 
 | ||||
| 			} | ||||
| 		}); | ||||
|  |  | |||
		正在加载…
	
		在新工单中引用