kopia lustrzana https://github.com/magicbug/Cloudlog
Switched to use search.ham.io
rodzic
b1017b7b3c
commit
951b31a03f
|
@ -16,4 +16,4 @@ Copyright (c) 2011 Peter Goodhall ([2E0SQL](http://www.m3php.com)).
|
|||
|
||||
* Andy (M0VKG) [http://m0vkg.org.uk](http://m0vkg.org.uk/)
|
||||
* Gavin (M1BXF) [http://www.geekshed.co.uk](http://www.geekshed.co.uk/)
|
||||
* Graham (W5ISP) [http://www.callbytxt.org](http://www.callbytxt.org)
|
||||
* Graham (W5ISP) [http://ham.io](http://ham.io)
|
|
@ -9,14 +9,14 @@
|
|||
| '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"
|
||||
| 'callbook' Selects which Callbook lookup to use defaults "hamio" but supports "qrz"
|
||||
*/
|
||||
|
||||
$config['app_name'] = "Cloudlog";
|
||||
$config['app_version'] = "0.1";
|
||||
$config['directory'] = "logbook";
|
||||
|
||||
$config['callbook'] = "callbytxt"; // Options are qrz or callbytxt
|
||||
$config['callbook'] = "hamio"; // Options are hamio or qrz
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -124,10 +124,10 @@ class Logbook extends CI_Controller {
|
|||
echo $callbook['gridsquare'];
|
||||
|
||||
} else {
|
||||
// Lookup using Callbytxt
|
||||
$this->load->library('callbytxt');
|
||||
// Lookup using hamio
|
||||
$this->load->library('hamio');
|
||||
|
||||
$callbook = $this->callbytxt->callsign($qra);
|
||||
$callbook = $this->hamio->callsign($qra);
|
||||
|
||||
echo $callbook['gridsquare'];
|
||||
}
|
||||
|
@ -149,10 +149,10 @@ class Logbook extends CI_Controller {
|
|||
echo $callbook['city'];
|
||||
|
||||
} else {
|
||||
// Lookup using Callbytxt
|
||||
$this->load->library('callbytxt');
|
||||
// Lookup using hamio
|
||||
$this->load->library('hamio');
|
||||
|
||||
$callbook = $this->callbytxt->callsign($callsign);
|
||||
$callbook = $this->hamio->callsign($callsign);
|
||||
|
||||
echo $callbook['city'];
|
||||
}
|
||||
|
@ -197,10 +197,10 @@ class Logbook extends CI_Controller {
|
|||
$callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'));
|
||||
echo $callbook['name'];
|
||||
} else {
|
||||
// Lookup using Callbytxt
|
||||
$this->load->library('callbytxt');
|
||||
// Lookup using hamio
|
||||
$this->load->library('hamio');
|
||||
|
||||
$callbook = $this->callbytxt->callsign($callsign);
|
||||
$callbook = $this->hamio->callsign($callsign);
|
||||
|
||||
echo $callbook['name'];
|
||||
}
|
||||
|
@ -240,8 +240,8 @@ class Logbook extends CI_Controller {
|
|||
}
|
||||
echo "</table>";
|
||||
} else {
|
||||
$this->load->library('Callbytxt');
|
||||
$data['callsign'] = $this->callbytxt->callsign($id);
|
||||
$this->load->library('hamio');
|
||||
$data['callsign'] = $this->hamio->callsign($id);
|
||||
$data['id'] = strtoupper($id);
|
||||
|
||||
$this->load->view('search/result', $data);
|
||||
|
@ -305,10 +305,10 @@ class Logbook extends CI_Controller {
|
|||
|
||||
|
||||
} else {
|
||||
// Lookup using Callbytxt
|
||||
$this->load->library('callbytxt');
|
||||
// Lookup using hamio
|
||||
$this->load->library('hamio');
|
||||
|
||||
$data['callsign'] = $this->callbytxt->callsign($id);
|
||||
$data['callsign'] = $this->hamio->callsign($id);
|
||||
}
|
||||
|
||||
$data['id'] = strtoupper($id);
|
||||
|
|
|
@ -5,9 +5,9 @@ class Welcome extends CI_Controller {
|
|||
|
||||
public function index()
|
||||
{
|
||||
$this->load->library('callbytxt');
|
||||
$this->load->library('hamio');
|
||||
|
||||
$callbook = $this->callbytxt->callsign('m3php');
|
||||
$callbook = $this->hamio->callsign('m3php');
|
||||
|
||||
print_r($callbook);
|
||||
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Callbytxt {
|
||||
|
||||
/*
|
||||
Communicates with the Callbytxt API functions
|
||||
*/
|
||||
|
||||
public function callsign($callsign)
|
||||
{
|
||||
ini_set ('display_errors', 1);
|
||||
$jsonurl = "http://callbytxt.org/db/".$callsign.".json";
|
||||
|
||||
$json = @file_get_contents($jsonurl,0,null,null);
|
||||
$json_output = json_decode($json);
|
||||
|
||||
if(isset($json_output)) {
|
||||
$data['callsign'] = $json_output->calls->callsign;
|
||||
$data['name'] = ucfirst(strtolower((current(explode(' ', $json_output->calls->first_name)))));
|
||||
|
||||
if(strtoupper($json_output->calls->gridsquare) == "JJ00AA") {
|
||||
$data['gridsquare'] = "";
|
||||
} else {
|
||||
$data['gridsquare'] = ucfirst($json_output->calls->gridsquare);
|
||||
}
|
||||
|
||||
$data['city'] = ucfirst(strtolower(($json_output->calls->city)));
|
||||
|
||||
$data['lat'] = ucfirst($json_output->calls->lat);
|
||||
$data['long'] = ucfirst($json_output->calls->long);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file Callbytxt.php */
|
|
@ -0,0 +1,30 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Hamio {
|
||||
|
||||
/*
|
||||
Communicates with the ham.io API functions
|
||||
*/
|
||||
|
||||
public function callsign($callsign)
|
||||
{
|
||||
ini_set ('display_errors', 1);
|
||||
$jsonurl = "http://search.ham.io/api/call/".$callsign;
|
||||
|
||||
$json = @file_get_contents($jsonurl,0,null,null);
|
||||
$json_output = json_decode($json);
|
||||
|
||||
if(isset($json_output)) {
|
||||
$data['callsign'] = $json_output->calls->callsign;
|
||||
$data['name'] = "$json_output->calls->first_name $json_output->calls->last_name";
|
||||
$data['gridsquare'] = $json_output->calls->gridsquare;
|
||||
$data['city'] = ucfirst(strtolower(($json_output->calls->city)));
|
||||
$data['lat'] = ucfirst($json_output->calls->latitude);
|
||||
$data['long'] = ucfirst($json_output->calls->longitude);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file hamio.php */
|
|
@ -253,12 +253,6 @@ class Logbook_model extends CI_Model {
|
|||
{
|
||||
$data = $query->row();
|
||||
$name = $data->COL_NAME;
|
||||
} else {
|
||||
//$json = file_get_contents("http://callbytxt.org/db/".$callsign.".json");
|
||||
|
||||
//$obj = json_decode($json);
|
||||
//$uppercase_name = strtolower($obj->{'calls'}->{'first_name'});
|
||||
// $name = ucwords($uppercase_name);
|
||||
}
|
||||
|
||||
return $name;
|
||||
|
|
Ładowanie…
Reference in New Issue